Design Idea
LED senses and displays ambient-light intensity
LED doubles as photosensor and visual indicator of ambient-light intensity.
Dhananjay V Gadre and Sheetal Vashist, ECE Division, Netaji Subhas Institute of Technology, New Delhi, India; Edited by Brad Thompson and Fran Granville -- EDN, 11/9/2006
In addition to their customary roles as indicators and illuminators, modern LEDs can also serve as photovoltaic detectors (reference 1 and reference 2). Simply connecting a red LED to a multimeter and illuminating the LED with a source of bright light, such as a similar red LED, produce a reading of more than 1.4V (Figure 1). One model for a reverse-biased LED comprises a charged capacitor that connects in parallel with a light-dependent current source (Reference 1). Increasing the incident light increases the current source and more rapidly discharges the equivalent capacitor to the supply voltage.
Figure 2 shows a method of using an LED as a photovoltaic detector. Connecting one of the microcontroller's outputs, Pin 2, to the LED's cathode applies reverse bias that charges the LED's internal capacitance to the supply voltage. Connecting the LED's cathode to Input Pin 3 attaches a high-impedance load to the LED. Illuminating the LED generates photocurrent. Originally charged to the supply voltage, the LED's internal capacitance discharges through the photocurrent source, and, when the voltage on the capacitor falls below the microcontroller's lower logic threshold voltage, Pin 3 senses a logic zero. Increasing the incident-light intensity more quickly discharges the capacitor, and lower light levels decrease the discharge rate. The microcontroller, an Atmel AVR ATtiny15, measures the time for Pin 3's voltage to reach logic zero and computes the amount of ambient light incident on the LED. In addition, the microcontroller flashes the same LED at a frequency proportional to the incident light's intensity.
Figure 3 shows a 3-mm, super-bright-red LED, D1, from Everlight Electronics Co Ltd, which comes in a water-clear encapsulant as an ambient-light sensor. Having only four components, the circuit operates from any dc-power source from 3 to 5.5V. The circuit uses only three of six of the AVR ATtiny15's I/O pins, and the remaining pins are available to control or communicate with external devices. The sensor LED connects to the AVR microcontroller's port pins PB0 and PB1; another port pin, PB3, produces a square wave with a frequency proportional to the incident-light intensity. The circuit operates by first applying forward bias to the LED for a fixed interval and then applying reverse bias to the LED by changing the bit sequences you apply to PB0 and PB1. Next, the microcontroller reconfigures PB0 as an input pin. An internal timing loop measures the interval, T, for the voltage you apply to PB0 to decrease from logic one to logic zero.
Reconfiguring pins PB0 and PB1 to apply forward bias to the LED completes the cycle. Time interval T varies inversely with the amount of ambient light incident on the LED. For lower light, the LED flashes at a lower frequency, and, as the incident-light intensity increases, the LED flashes more frequently to provide a visual indication of the incident-light intensity.
For low values of forward current, an LED's light-output intensity is fairly linear (Reference 2). To test the circuit, couple the light output of a second and identical LED to the sensor LED, D1, in Figure 3. Ensure that external light doesn't strike the sensor LED by enclosing the LEDs in a sealed tube covered with opaque black tape. Varying the illuminating LED's forward current from 0.33 to 2.8 mA produces a relatively linear sensor- flash-frequency plot (Figure 4).
The efficiency of an LED as a sensor depends upon its reverse-biased internal-current source and capacitance. To estimate the reverse photocurrent, connect a 1-MΩ resistor in parallel with a sensor LED and measure the voltage across the resistor while applying a constant level of illumination from an external source. Replace the 1-MΩ resistor with 500- and 100-kΩ resistors and repeat the measurements. For a representative LED under constant illumination and shielded from stray ambient light, we measured a photocurrent of approximately 25 nA for all three resistor values. For the same level of illumination applied to the sensor LED, measure the frequency generated at Pin PB3.
To calculate the LED's reverse-biased capacitance, substitute the delay-loop time, the LED's photovoltaic current, and the microcontroller's logic-one and -zero threshold voltages into the equation and solve for C, the LED's effective reverse-biased junction capacitance: (dV/dt)=(I/C), where dV is the measured logic-one voltage minus the logic-zero voltage, dt is the measured time to discharge the LED's internal capacitor, and I is the calculated value of LED's photocurrent source. The calculated values for the selected LED range from 25 to 60 pF. This range compares with the data in reference 3 and reference 4, although Reference 3 reports only the current source's values. You can download the AVR microcontroller's assembly-language firmware, Listing 1, from this Design Idea.
| References |
|














