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.
[...]
Buy this article as PDF
Pages: 8
(incl. VAT)