How to Implement End-of-Conversion Detection in Maxim's Ambient Light Sensors
IntroductionMaxim's MAX44007 and MAX44009 high-performance ambient light sensors combine a photodiode, front-end analog circuitry (AFE), two high-resolution ADCs, digital subtraction and data formatting circuitry, and an I²C interface block. These light sensors also provide industry-leading low operating-current levels (0.65µA), low-voltage 1.8V ICC operation, ultra-low light sensitivity, and a small 2mm x 2mm x 0.6mm package.
When optical integration times are multiples of 100ms (e.g., 100/200/400/800ms), these ambient light sensors provide excellent 50Hz/60Hz rejection. In many cases, however, applications require an end-of-conversion signal to prevent unnecessary delay in accessing reliable, ambient light-sensor information. This application note describes how to use the device's interrupt pin to implement end-of-conversion functionality and details the setup of the I²C registers.
Register MapThe I²C register map for these light sensors is shown in Table 1.
|Register||Bit||Register Address||Power-On Reset State||R/W|
|LUX High Byte||E3||E2||E1||E0||M7||M6||M5||M4||0x03||0x00||R|
|LUX Low Byte||—||—||—||—||M3||M2||M1||M0||0x04||0x00||R|
Implementing End-of-Conversion DetectionImplementation is based on the fact that the interrupt detection logic is activated internally in the IC only after the ADC has valid data, i.e., at the end of an ADC conversion. During an ongoing ADC conversion/integration time, the interrupt detection logic ignores the I²C register setting changes. When the part is set up to trigger an interrupt regardless of the results of its conversion (for example, by setting the lower threshold to be greater than the upper threshold), an end-of-conversion signal can be obtained by monitoring the interrupt pin.
A detailed step-by-step example algorithm is shown below.
Step 1. Configure the part for quick access.
Write 1100 0111 to Configuration register 0x02. This sets up the part with following nondefault settings:Step 2. Configure the part for an instantaneous and forced interrupt trigger at the end of conversion.CONT = 1, for immediate and continuous conversion
MANUAL = 1, to allow minimal manual adjustment of the integration time
TIM = 111, to set the integration time to the minimum possible = 6.25ms
Write lower threshold high byte = 1111 1111.Step 3. Stay in a "wait" state until a user command initiates a valid conversion.
Write higher threshold high byte = 0000 0000.
Write threshold timer = 0000 0000.
Ignore any interrupt triggers from the part during this time.Step 4. Initiate start of a valid conversion (after commanded by master).
Write 1000 0000 to Configuration register 0x02. This sets the part up with autoranging and continuous conversion.Step 5. Return to Step 3.
Read the Interrupt Status register 0x00 to clear any set interrupts. The active-low INT pin should go high.
Wait for an interrupt trigger by monitoring the active-low INT pin. (Note: the maximum wait time will be 6.25ms due to the TIM configuration in Step 1.)
Now the actual light sensor measurement begins.
Read the Interrupt Status register 0x00 to clear the set interrupt. The active-low INT pin should go high.
Write 1100 0111 to set the part to return to a 6.25ms integration time after the end of the current conversion period.
Wait for an interrupt trigger by monitoring the active-low INT pin, which signals an end of conversion for valid light measurement.