---+ Measuring Light Intensity with a Photo Resistor and a Capacitor ---++ Goal: 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. | <img alt="photoResistorCircuit.png" height="456" src="%ATTACHURL%/photoResistorCircuit.png" title="photoResistorCircuit.png" width="309" /> | | 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. <font color="#ff3300"> *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!* </font> ---++ 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. -- %USERSIG{UliRaich - 2017-04-06}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
photoResistorCircuit.png
r1
manage
14.3 K
2017-04-06 - 11:06
UnknownUser
This topic: Embedded_Systems
>
WebHome
>
CourseExercises
>
LightMeasurement
Topic revision: r1 - 2017-04-06 - uli
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback