Lady Ada used a photocell to analog Voltage Reading Method with a 5V supply in a configuration where the analog voltage reading ranges from 0V (ground) to about 5V. Although a 3.3v supply can also be used as it is based on the idea that as the resistance of the photocell decreases, the total resistance of the photocell and the pull-down resistor decreases from over 600KΩ to 10KΩ
She adopted the easiest way to measure a resistive sensor by connecting one end to Power and the other to a pull-down resistor to ground. Then the analog input of a microcontroller such as an Arduino is connected to point between the fixed pull-down resistor and the variable photocell resistor
The trick lies in the way, where current flows through both resistors increases which in turn causes the voltage across the fixed 10KΩ resistor to increase. She has used a table to indicate the approximate analog voltage based on the sensor light/resistance w/a 5V supply and 10KΩ pull-down resistor. It is available on her website
But there are some setbacks, for instance, if you want to have the sensor in a bright area and you use a 10KΩ pull-down, it will quickly saturate as it will hit the ‘ceiling’ of 5V and not be able to differentiate between bright and really bright. Therefore, replace the 10KΩ pull-down with a 1KΩ pull-down. Hence, it won’t be able to detect dark level differences but it will be able to detect bright light differences better. Else, “Axel Benz” formula can also be used by first measuring the minimum and maximum resistance value with the multi meter and then finding the resistor value with
Lady Ada has used a sketch that will take the analog voltage reading and help to determine how bright the red LED is. The LED has to be connected to a PWM pin for this to work. A simple Code is used for Analog Light Measurements as it just prints out what it interprets as the amount of light in a qualitative manner.
This capture from an oscilloscope shows what’s happening on the digital pin (yellow). The blue line indicates when the sketch starts counting and when the counting is complete, about 1.2ms later.
As it is clearly understood concept that photocells are resistors, it is possible to use them without analog pins on microcontroller. This is possible because of the advantage that is taken from a basic electronic property of resistors and capacitors. The concept is that when capacitor is initially storing no voltage, and is connected to power like 5V through a resistor, it will charge up to the power voltage slowly. To summarize, the bigger the resistor, the slower it is. Here, the capacitor acts like a bucket and the resistor is like a thin pipe. So, when a bucket is to be filled up with a very thin pipe, it takes enough time that can be used to figure out how wide the pipe is by timing how long it takes to fill the bucket up halfway.
The capacitor can be changed anyway but make sure the timings will also change for these photocells although 0.1uF ceramic capacitor is the best one to start for these photocells. For bright ranges measurement, use a 1uF capacitor and for darker ranges, go down to 0.01uF.
The detailed information is available on the website
Filed Under: Reviews