Thursday, September 12, 2013

Basic Light and Temperature Sensing

Here I use two cheap analog sensors for temperature and light:
http://www.adafruit.com/products/165
http://www.adafruit.com/products/161

And convert their analog values to digital values using an Analog to Digital convertor (ADC)
http://www.adafruit.com/products/856

To make things easy I wire these up on an external breadboard connected to the Pi using a Pi cobbler:
http://www.adafruit.com/products/914

Tutorials for installing and using these components can be found on Adafruit's website and I used them heavily. I could explain the technical details of all these components but Adafruit probably does a more elegant job and has tons of documentation so please follow the links for more information. Also the temperature sensor and the ADC are used by TONS of people so a quick google search will give lots of results as well!



Also a quick note about the light sensor:
I use a 1K resistor to change by values a bit. This resistor gives me a nice range when the light is bright. If you use a larger resistor (say 10k) it will be better at resolving lower light level differences. Play around with it and use a resistor that gives you a nice dynamic range for the light levels you are interested in sensing.

2 comments:

  1. Could you make a video on how to wire the raspberry pi to the breadboard and the MCP3008

    ReplyDelete
  2. I use the pi cobbler to connect my pi to the breadboard then I followed these instructions explicitly when setting up my sensors. Adafruit has much nicer diagrams and cleaner breadboards then I will ever be able to make.

    https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview

    ReplyDelete