PDA

View Full Version : Reading analog sensors with the Raspberry Pi



wraggster
July 29th, 2012, 15:24
http://hackadaycom.files.wordpress.com/2012/07/raspi.jpeg (http://hackadaycom.files.wordpress.com/2012/07/raspi.jpeg)
Adafruit just posted an awesome tutorial on reading analog sensors (http://learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi/overview) with the Raspberry Pi. It’s a great walkthrough that can be applied to your next Raspi project as well as any project where you just need one more analog input.
Earlier, the folks over at Adafruit posted a tutorial (http://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi) on using a MCP3008 (https://www.adafruit.com/products/856) ADC with the Raspi to directly read analog values using a Raspi. Sometimes, though, you don’t need eight analog inputs and a 12-bit ADC to get a project off the ground. Adafruit’s tutorial for reading analog values without an ADC relies on a single 1μF ceramic capacitor attached between a digital input and ground. By pulling the sensor line high for a millisecond or two, the capacitor charges at different rates depending on the value of the analog sensor.
Yes, it’s just an RC timing circuit but seeing as how the Raspi doesn’t have an analog input, we figure this tutorial could help out a few people.
http://hackaday.com/2012/07/28/reading-analog-sensors-with-the-raspberry-pi/