The light-dependent resistor is a very useful sensor, but Arduino cannot directly read resistance. The circuit of Figure 5-6 takes the resistance of the LDR and converts it to a voltage that Arduino can read.
This same circuit works for any resistive sensor, and there are many different types of resistive sensors, such as sensors that measure force, stretching, bending, or heat. For example, you could connect a thermistor (heat-dependent resistor) instead of the LDR and have an LED that changes brightness according to the temperature.
NOTE
If you do work with a thermistor, be aware that there isn’t a direct connection between the value you read and the actual temperature measured. If you need an exact reading, you should read the numbers that come out of the analogue pin while measuring with a real thermometer. You could put these numbers side by side in a table and work out a way to calibrate the analogue results to real-world temperatures. Alternately, you could use a digital temperature sensor such as the Analog Devices TMP36.
Up to now, we have used an LED as the output device. It would be difficult to measure temperature, for instance, by trying to judge how bright an LED is. Wouldn’t it be nice if we could actually get the values that Arduino is reading from the sensor? We could make the LED blink the values in Morse code, but there is a much easier way for Arduino to send information to us humans, using that same USB cable that you’ve been using to upload your sketches into the Arduino.
Leave a Reply