Adding an ambient light sensor to portable devices such as tablets, smartphones, and laptops extends battery life and enables easy-to-view displays that are optimized to the environment. This article covers the various issues that arise when using such sensors in portable devices.
In the connected world of today, most portable devices feature a display that allows users to access video and Internet content. Concerns regarding power consumption and viewing comfort have led many of these devices to include ambient light sensors in an effort to make the device aware of its surroundings. In dim environments, the display backlight can be dialed back to save battery power, and in bright environments, the enhanced use of fonts and backgrounds can improve use by making the device more readable. This article discusses a few application considerations to keep in mind when designing products with ambient light sensors.
Spectral sensitivity of light measurements
First, consider the human eye's view of ambient light. Our eye's sensitivity to light is generally described by the photopic curve, also called the CIE curve (see Figure 1). It shows that the human eye is blind to wavelengths in the ultraviolet (<400 nm) and infrared (>700 nm) ranges. It also indicates that the eye is most sensitive to green light (~555 nm), and is less sensitive to the blue and red wavelengths. Therefore we use a normalized version of this sensitivity curve to convert an incident optical-power density (specified in μW/cm2) to sensitivity units for the human eye (specified in lux). At 555 nm, one lux is equivalent to approximately 0.15 μW/cm2 of optical power intensity.
The challenges posed by manufacturing and technology make it difficult for a practical, low-cost ambient-light sensors to replicate this spectrum exactly. It's also difficult to reject IR and UV radiation completely. As a consequence of the wide spectral content in common light sources, even a slight deviation from the photopic curve, combined with incomplete IR and UV rejection, can have a substantial effect on the accuracy of brightness measurements by ambient light sensors.
Figure 1: The photopic curve shows the eye's response to different wavelengths of light. Green light generates a maximum response in the eye, but the eye cannot see light in the infrared (>700 nm) or ultraviolet (<400 nm) portions of the spectrum.
In fact, many commercially available lux meters have a tough time matching the photopic curve exactly. As a result, most lux meters come specified with a parameter called f1' that is commonly used to represent how well a lux meter matches the photopic CIE curve. Inexperienced users should also keep in mind another problem when handling commercial lux meters — many meters claim to be calibrated to standards traceable to the National Institute of Standards and Technology (NIST). In reality, this claim only asserts that the lux meter gives the correct reading when tested with an incandescent (Type A) light source. No guarantee is made for the accuracy of lux measurements of non-incandescent light sources such as fluorescent lighting, sunlight, or LEDs, even though such sources are becoming more common. Indeed, the world is moving toward the prohibition of incandescent light sources in everyday life, due to their low energy efficiency.
As a result, modern ambient-light sensors attempt to live with an incomplete match to the photopic CIE curve, and instead use the principle of superposition to calculate the ambient light brightness. Most light sensors on the market today use two or more different types of photodiodes, each sensitive to a different portion of the light spectrum. By combining these photodiode outputs mathematically, each with a suitably adjusted gain, the sensor can be made to output a fairly accurate measurement of ambient brightness for the light sources commonly available.
Figure 2: These plots compare the light spectra of sunlight (upper left), halogen/incandescent lamps (upper right), fluorescent lamps (lower left), and white LEDs (lower right).
If, for example, two photodiode types PD1 and PD2 give different readings for two incident light sources, you can derive a gain constant for each photodiode such that the sensor provides an accurate lux reading for both light sources:
|LightSource1 = Gain1 x PD1 + Gain2 x PD2
|LightSource2 = Gain1 x PD1 + Gain2 x PD2.
The greater the number of photodiode types, the greater the number of light sources that can be matched closely.
The spectra of light sources found in everyday life differ greatly (see Figure 2). Of the light sources commonly encountered in home and office, fluorescent and incandescent lights are considered to be the extremes-one with very little infrared content, and the other with significantly more infrared content. Data sheets for most ambient-light sensors, therefore, show a response comparing these two common light sources (see Figure 3).
Dynamic range of light measurements
The human eye is sensitive to a wide range of light conditions. When light-adjusted to a dark environment (it can take a few minutes to become attuned to this condition), the eye can detect brightness levels down to 10-4 lux. At the other end of the scale, the eye has some darkness perception even in environments as bright as 108 lux.
Figure 3: The data sheets for most ambient-light sensors include a graph of typical light sensitivity versus the meter reading in lux. This one shows the response of a MAX44009/MAX9635 ambient-light sensor.
The typical brightness of environments encountered by people in real life is usually far narrower, ranging from 0.1 lux outdoors at night, to 300 lux for office lighting, to 100,000 lux in bright sunlight. Most portable devices require an accurate detection of ambient light intensity from five lux up to about 1000 lux. Portable-display backlights can't really compete with the power of the sun, and for light environments below a certain level, the display is simply maintained at a minimum brightness.
Note that the human eye's perception of brightness is logarithmic (similar to the ear's sensitivity to sound). A lux level must increase almost ten times before the eye perceives it to be twice as bright. A similar transfer function then relates the ideal percentage of display backlight brightness to relative ambient lux, as shown in the linear and logarithmic graphs in Figure 4 and Figure 5.
Figure 4: This linear graph demonstrates backlight strength versus the relative lux delivered. The black line is the ideal logarithmic curve, and the blue line is a piece-wise linear approximation more suitable for implementation with microcontroller code.
As a result, fine resolution is required for low-light measurements, and large resolution is sufficient for high lux measurements. The simplest method for implementing this scheme is to use high-resolution converters with front-end programmable gain, which allow one to balance the requirements of large dynamic range at the high end with high sensitivity at the low-end measurements.
The MAX44009 differs from other digital light sensors with its inclusion of an on-chip auto-ranging scheme. This scheme allows the IC to make 22-bit dynamic range measurements automatically, improving the code efficiency without needing the microcontroller to reconfigure registers. Further, these measurements are compressed and represented in a 12-bit format — in effect providing a pseudo-logarithmic step size for light measurements. For example, the MAX44009 uses a 4-bit exponent and an 8-bit mantissa to represent the 22-bit dynamic range, providing a 0.045 lux/count resolution at low light levels, and a higher count size at higher levels of ambient light.
Figure 5: These curves present the linear data of Figure 4 using a logarithmic scale for relative lux. The black line is the ideal logarithmic curve and the blue line is a piecewise linear approximation more suitable for implementation with microcontroller code.
Effect of black glass
The look and feel of modern electronic devices — their industrial design — are now as important as the features and functionality they provide. Customers have come to regard modern portable devices as representing "who they are." Ambient light sensors, for instance, are important to the devices, but it is now mandatory that these sensors be hidden from sight so as not to distract the user from the look and the feel of the product.
For glass panels, this "cover-up" is usually accomplished by applying a layer of thin black ink (that absorbs nearly all incident light) to the sensor opening. The small amount of light that gets through the ink then reaches the light sensor, enabling ambient-light measurements while allowing the panel to retain a sleek and unbroken black border (see Figure 6).
Figure 6: A typical tablet design shows the use of a black border panel around the LCD display. The presence of an ambient light sensor is hidden from the view of the user.
Unfortunately, this black ink has implications for the proper functioning of light sensors. It not only attenuates the amount of light reaching the sensor, but also changes the spectrum of that light. First, consider the light-attenuation problem. Most black ink allows only two percent to ten percent of visible light to get through, so five lux of external light can become only 0.1 lux at the sensor. The light sensor therefore needs high sensitivity. Secondly, the change of spectrum is such that while only two percent to ten percent of visible light gets through the ink, it passes nearly all incident infrared radiation through to the sensor (see Figure 7).
Figure 7: This typical spectral profile characterizes the black ink found in commercial electronic devices today, showing the percentage transmission versus wavelength of incident light.
Non-uniform, spectral-transmission profiles impose the additional requirement that most modern light sensors be recalibrated to obtain accurate readings of the ambient lux when placed under a black ink. Any factory settings chosen for accurate light measurements without the black ink will therefore need readjusting. For that reason, the MAX44007 and MAX44004 ambient light sensors allow access to the multiple internal photodiodes. This flexibility lets the user tailor and recalibrate the sensor response for most applications. Sensitivities are 0.025 lux/LSB for the MAX44007 and 0.03 lux/LSB for the MAX44004.
Use of interrupt pin in light sensors
Most applications don't require real-time changes in the display backlight strength, whose purpose would be to prevent a response to spurious noises such as passing shadows. On the other hand, a quick response to consistent changes in the ambient light allows the user to remain fully engaged with the device, without the distraction of having to adjust the display brightness for readability. Note also that continuous polling of a light sensor (to check whether the ambient levels have changed) and the implementation of noise rejection in firmware represents a burden to the application's software resources. It slows the response to user commands, and raises the power consumption due to an increase in microcontroller processing.
Modern light sensors, therefore, come equipped with a powerful feature — the interrupt pin. The sensor continuously compares ambient-light readings against internal programmable window thresholds, and generates an interrupt when light levels exceed those thresholds, thereby alerting the host microcontroller that light conditions have indeed changed. A persist time before the interrupt is actually flagged to the host eliminates false triggers due to spurious, short-duration fluctuations in the ambient light.
The use of an interrupt pin allows the sensor to be smart, asking for host intervention only when action is needed. Processing resources of the host microcontroller can then be dedicated to other tasks, or the microcontroller can extend battery life by remaining in a low-power wait state. A typical application circuit (see Figure 8) demonstrates the use of an interrupt pin. Note that the open-drain connection to this pin allows a wire-OR connection to multiple devices and sources.
Figure 8: This typical application circuit for an ambient-light sensor on a multi-drop I2C bus shows the connection of interrupt pin to host microcontroller.
This article outlined some application considerations commonly encountered when designing in a light sensor for modern portable devices. When established early in the development, a close engagement and partnership with the IC supplier can ensure a flexible and reliable system.