Close

Ambient light sensing

christoph-tackChristoph Tack wrote 10/06/2019 at 08:49 • 8 min read • Like

It would be better if this could be done automatically.  Maxim Integrated has an application note concerning display brightness adjustment according to ambient light levels.  They make reference to a logarithmic conversion proposed by Microsoft Windows.

Brightness mapping ambient-light levels to optimal screen brightness. f(x) = Screen Brightness (%)

In the first implementation, the brightness adjustment involved three settings:

The APDS-9960 outputs integer light levels, which compare more or less to lux.  The smallest non-dark light level that can be measured is 1 lux.  As a result from the formula above, the minimum screen brightness (which corresponds to 1 lux) is 27%.  All lower screen brightness levels would be unused because the APDS-9960 can measure light levels smaller than 1 lux. 

The MAX7219 display panel only has 16 brightness levels.  It would be a shame not to use them all.  So a different brightness mapping will be used.

In the clock, the display brightness levels 0 to 15 are linearly mapped to brightness ratios of 27% to 100%.  Then the inverse formula of the one above has been used.

g(x) = light level in lux, x=brightness level [0 15]

Another problem with this formula is that it uses a computationally intensive logarithmic function.  Instead of calculating a brightness setting for a specific light level, a lookup table will be used defining what light level corresponds to a certain brightness setting.  There are only 16 brightness levels, so the lookup table doesn't take up much memory space.

Ambient light sensor selection

The clock should monitor the intensity of the ambient light in order to adjust the intensity of the LED array.  Especially in the dark it can be quite annoying when the LED array is too bright.  Many choices for sensing the ambient light are available.

Important factors that determine the choice are cost and sensitivity in the human eye light spectrum (390 to 700nm).

IC sensor

LDR

Contains the poisonous CdS.  Not RoHS compliant.

Photo diode

Photo transistor

Like

Discussions