Free Print Subscription Printer-friendly version Email to a Friend

Single microcontroller pin senses ambient light, controls illumination

( 01 Feb 2007 )
Loren Passmore, Berkeley, CA

As in a previous Design Idea (Reference 1), this design uses an LED as a transducer to measure the ambient-light level and to provide illumination. This Design Idea uses the same principle as its predecessor but consists of only one LED, two resistors, one IC, and one 0.1µF bypass capacitor. This circuit for providing ambient-light feedback requires no additional components. Despite requiring only a few components, the circuit in Figure 1 offers considerable f lexibility because the microprocessor's software controls the LED's brightness and its relationship to ambient-light levels. For night-light applications, one mode turns on the LED when ambient light decreases. Conversely, for power-saving regulation of a portable device's LCD backlight, a second mode turns on the LED when the ambient-light level increases.

You can download Listing 1, sample code for this Design Idea, at www.edna.com/061026di1. The code provides 64 levels of PWM (pulse-width-modulated) intensity control over the LED's brightness in either mode. In operation, one of the microprocessor's multifunction pins drives the LED with a PWM waveform for several hundred milliseconds. After the waveform's final cycle, the software switches the microprocessor's pin to input mode and connects the LED to the microprocessor's internal 16-bit sigma-delta ADC. Ambient light illuminates the LED, producing voltage, which the ADC measures, and the microprocessor computes the PWM waveform's parameters for the next series of illumination cycles. The cycle rate's high repetition frequency eliminates any discernible flickering of the LED.

<%@ LANGUAGE="VBSCRIPT" %>
<% Randomize: ord=int(rnd*1000000000) %>


POWER STATE
In the listing, when the software and ambient-light level specify that the LED should turn off for an extended interval, the CPU goes into a low-power state for 250msec. During its sleep mode and for a few hundred microseconds while performing ADC conversions, the circuit draws only about 20µA and thus suits itself well to battery-poweredsystem applications.

At start-up, the microprocessor stores an initial voltage level, which the LED produces, and uses this value to scale the PWM levels. Shading the LED or moving the circuit into a darker area immediately increases the LED's brightness, which the listing's 64 PWM levels control in small steps. The MSP430F2013's ADC presents input impedance of approximately 200kO. When driving this impedance, an LED occupying a small, 0805, surface-mount footprint generates only a few 10s of millivolts. However, the MSP430- F2013's 16-bit ADC resolves the LED's voltage with sufficient resolution to ensure good performance under normal roomlighting levels.

In addition, the MSP430F2013 includes a four-level PGA (programmable-gain amplifier), offering gains of one, four, eight, and 16 to further amplify the LED's minuscule output voltage. The circuit also exploits the microprocessor's onboard lowfrequency clock oscillator, which allows low-powered operation without an external crystal. The resultant circuit includes only six components, including a battery. Note: The code can execute on Texas Instruments' (www.ti. com) eZ430 demonstration board without hardware modifications because the board includes an LED connected to port P1.0.


REFERENCE
1. Myers, Howard, "Stealth-mode LED controls itself," EDN, May 25, 2006, pg 98.

 
Free Print Subscription Printer-friendly version Email to a Friend
 
Article Rating 
Average Rate: No rating yet
 
Poor Quite Good Good Very Good Excellent
 
Related Content 
 
 
KNOWLEDGE CENTER
Panasonic Key Devices Guide 2008 :
 
Fairchild Semiconductor :
 
Texas Instruments: DaVinci™ Technology
 
Texas Instruments: Safe Bet Series
 
 
 
Highest Rated  
Feedback Loop  

ADS BY GOOGLE 
 
 
 
ADVERTISEMENT
Press Release 
 
TECHNOLOGY NEWS
 
RESOURCE CENTER

 
 
PRODUCT NEWS
 
FEATURED SPONSORS
 
 
DESIGN CENTERS
 
ADVERTISEMENT
     
Reference Designs 
   
     
 
 
 


 
 
RSS
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

POLL
What type of environmental regulation do you think will be most beneficial for the tech industry?
Proper recycling and disposal
Push for power efficiency and energy conservation
Chemical/lead regulation
View results