Adding analog input to the Pi using the Digispark

My original project was simple enough: I wanted to use an analog dial – like one you would find on a safe. A program on the Pi would then set the combination. By twiddling a knob, a user would input a guess and, if it matched, the Pi would flash a green LED and unlock a hypothetical safe, door, or whatever. If the combination was wrong, the Pi would flash a red LED and the user would have to try again.

A Road to Nowhere

The plan was to use the analog pins on the Raspberry Pi – which was the first problem: The Raspberry Pi has no analog pins. So, although it can send out messages (i.e., make LEDs blink), as far as receiving information from the outside world, it's as blind as a bat, or at least severely colorblind. Although I looked for workarounds, the Pi is a purely digital machine. I googled to see how other people have done this sort of thing and discovered they use an extra piece of hardware called an ADC (analog-to-digital converter) [1]. When you clip the ADC onto a breadboard, it translates the analog signals from your sensors into something the Pi can understand. Although I could have ordered an ADC, I didn't have the time to wait for delivery.

Being a Kickstarter junkie, though, I did have three Digisparks [2] – coin-sized, Arduino-like development boards  – lying around. I bought them for US$ 8 a pop when the guy making them was crowdfunding, but I had never used the Digisparks (Figure 1), because I realized that, to do so, I would have to solder bits onto them.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Get your Pi to read analog data

    The Raspberry Pi still lacks analog GPIOs that would allow it to read directly from temperature and light sensors, or even humble potentiometers. With an inexpensive chip and some software-fu you can grant the Pi the gift of analog sensing.

  • A home intrusion detection setup (sort of)

    At least part of the popularity of the Raspberry Pi can be attributed to its high maker value; that is, a skilled maker with a Pi can build marvelous and beautiful things. Me? Not so much, but I was willing to try to build a home security system with the stuff in my junk box. Here's what happened …

  • A new way of no-solder prototyping

    The Grove system's standardized connector and multitude of devices allow quick and easy project prototyping with your favorite small-board computers.

  • Write your own drivers for Arduino

    So, you have some new kit for your Arduino – maybe some sensors or ICs – but programming them is clumsy and painful. Don't despair: You can make your life easier by writing your own drivers!

  • Use an analog sensor as a video game controller

    We put our Analog-to-Digital converter to work reading positions from an analog sensor (a potentiometer) and control a bat in a simple implementation of the classic Breakout game.