1
ME456: Mechatronics Systems Design
Chapter 7: Measuring Light with an LED
Prof. Clark J. Radcliffe Mechanical Engineering
Michigan State University http://www.egr.msu.edu/classes/me456/radcliff
LED Light Sensors
• Reference: R. Stojanovic and D.Karadaglic, “Single LED
Takes On Both Light Emitting and Light Detecting Duties”, Electronic Design, Vol. 55, No. 16, 7.19.07
www.electronicdesign.com
LED’s
• Can be both light emitters and detectors
• When voltage biased, – they emit light – characteristic voltage “diode drop” at a
current of 10-20 mA. • When subjected to light,
– they generate a backwards biased current proportional to the light striking the diode.
Photocurrent
• typical photodiode LED – about 50pA photocurrent.
• The light emitted and the detected – at nearly the same frequency – green-yellow LED emits wavelength 555nM – detects light at 525nm.
• Small photocurrent as a detector – is readily detected by a microcontroller
LED used as a Photodetector
• Analytical Model: Parallel Combination – Current Source (~50pA)
• LED’s response to external light – Very Small Internal Capacitance (10-15pF )
• LED internal structure: parallel current generator and Capacitance
2 Conductors+ Dielectric Gap = Capacitor
Photodiode across Gap Current Generator
The Conceptual Model
iR
LED with light applied
Equivalent
current source and parallel capacitor
2
Discharge Time
If the LED is initially “charged” to = 5 volts, the time required for the voltage to drop to 1/0 threshold voltage (1.4 volts) is directly related to the average photocurrent iR.
Simulated responses show the behavior for
Cr = 10pF and iR = 25µA and 50 µA
RCTIME Values
LED Voltage Vcr vs Photocurrent ir(Cr = 10 pF)
0.00E+001.00E+002.00E+003.00E+004.00E+005.00E+006.00E+00
0 0.001 0.002 0.003
Time, t
Vcr
(t)
ir=25uAir=50uA
Analytical Model
• For constant light, iR = constant • Response decreases linearly from VP1(0)
At iR = 25µA , t1.4 = 0.7 ms => 3500 counts At iR = 50µA , t1.4 = 1.4 ms => 7000 counts
dt!= (t)i C1- (0) V(t)V R
rP1P1
LED Voltage Vcr vs Photocurrent ir(Cr = 10 pF)
0.00E+001.00E+002.00E+003.00E+004.00E+005.00E+006.00E+00
0 0.001 0.002 0.003
Time, t
Vcr(
t)
ir=25uAir=50uA
Testing the Sensor
• Pin 2 = 0, Pin 1 is controlled by RCTIME
The Physical Circuit The Test Code '{$STAMP BS2} '{$PBASIC 2.5} 'file:LED_Light_Detecter.bs2 'Clark Radcliffe Michigan State University July 31, 2007 'Requires an LED in series with a 220 Ohm resister between pins p0 and p1 'connections P1---|<-----220Ohm---P0 (Note flat side to pin P1 'Symbols P0 PIN 0 P1 PIN 1 'Declarations light VAR Word 'measurement variable OUTPUT P1 'Pins P0 & P1 are both outputs OUTPUT P0 LOW P0 'set P0 TO ground DO HIGH P1 'Set P1 HIGH TO charge LED Capacitance PAUSE 1000 'WAIT FOR LED capacitance TO charge RCTIME P1, 1, light 'Measure discharge current from light DEBUG CLS, "Light Count = ", DEC5 light 'Display measurement LOOP
3
Now Detect AND Emit '{$STAMP BS2}!'{$PBASIC 2.5}!’File:LED_Light_Detecter.bs2!'Clark Radcliffe Michigan State University July 31, 2007!'Requires an LED in series with a 220 Ohm resister between pins 0 and 1!'connections P1-•--|<--•--220Ohm--•-P0 (Note flat side to P1)!'Declarations!'Symbols!P1 PIN 1!P0 PIN 0!light VAR WORD!DO!'Measure light Level: High Count = Low light! LOW P0! HIGH P1 ‘Reverse Charge the LED Capacitance! PAUSE 250! RCTIME P1, 1, light ‘Measure Time for Light-Current to discharge C! DEBUG CLS, "Light Count = ", DEC5 light!'Blink LED! LOW P1 ‘Forward Bias ground! HIGH P0 ‘Forward bias 5v to light LED! PAUSE 250 ‘Blink for ¼ second!LOOP !