Analog Pi
Analog input needs special treatment in the digital Raspberry Pi world. We show you what you need to do to get analog data into your Rasp Pi via the USB port.
Analog input needs special treatment in the digital Raspberry Pi world. We show you what you need to do to get analog data into your Rasp Pi via the USB port.
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.
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.
For someone who usually needs help unsticking his fingers whenever he busts out the superglue, the prospect of messing around with hot, molten metal was terrifying. Desperate times require desperate measures, however, and I had a hardware store nearby where I could get a soldering iron and some solder in five minutes.
Soldering is more difficult than I thought. The ladies of Adafruit [3] do this kind of thing in their videos all the time, daintily touch their soldering irons to the pins of tiny components and magically connecting everything together.
With the Digispark, you have to solder the six-pin female header to the I/O pins along the top of the device and a three-pin header to the 5V, ground, and VIN pins that run along the side. After ruining my first Digispark trying to do just that, I got lucky the second time around and even managed not to make the joints look too messy. Although I was pleased with myself, my wife was not impressed.
Pages: 8
Price $15.99
(incl. VAT)