create new tag
view all tags

Measuring Light Intensity with a Photo Resistor and a Capacitor


A photo resistor is a device whose resistivity decreases with increasing intensity of light is receives. To measure the resistance one would usually measure the voltage drop across the photo resistor using and analogue to digital converter (ADC). This will be seen in another experiment. In this experiment however we will see how we can implement a simple analogue to digital converter ourselves by measuring the time it takes to charge a capacitor.

Exercise 1: Setting up the circuit

We have to get an idea of the resistance the photo resistor exhibits and observe this value as the light intensity hitting it, changes. Since we cannot measure the resistance directly we will measure the time it takes to change a capacitor to a level where the gpio pin switches from low to high.

Circuit for the light intensity measurement
To this end we set up the circuit as shown above. The time to fully charge the capacitor will depend on the current flowing through the 2 resistors and will therefore change when through the change of light the resistor of the photo sensor changes.

Be careful: We use an electrolyte capacitor which can explode it connected the wrong way round. Find out which pin corresponds to plus and which one to minus and connect them as shown!

Exercise 2: Reading the photo resistance

The program we must write will first pull the point between photo resistor and capacitor to ground in order to discharge the capacitor. Keep it on ground level for 100 ms to make sure the capacitor is fully discharged. Now switch the gpio pin to input which allow the capacitor to charge up. Measure the time it takes until the capacitor is charged enough such that the gpio sees a “high” level on this pin.

Exercise 3: Write results to a file and analyze

Open a data file within your program onto which you always append new data as they come in. Plot this result file with gnuplot and analyze the result.

-- Uli Raich - 2017-04-06


Topic revision: r1 - 2017-04-06 - uli
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback