How to Implement End-of-Conversion Detection in Analog Devices' Ambient Light Sensors
How to Implement End-of-Conversion Detection in Analog Devices' Ambient Light Sensors
Abstract
This application note explains how the interrupt pin on Analog Devices' ambient light sensors can be used to implement end-of-conversion detection to improve response time to measurements.
Introduction
Analog Devices' 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 I2C 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 I2C registers.
Register Map
The I2C register map for these light sensors is shown in Table 1.
Register | Bit | Register Address | Power-On Reset State | R/W | |||||||
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ||||
Status | |||||||||||
Interrupt Status | — | — | — | — | — | — | — | INTS | 0x00 | 0x00 | R |
Interrupt Enable | — | — | — | — | — | — | — | INTE | 0x01 | 0x00 | R/W |
Configuration | |||||||||||
Configuration | CONT | MANUAL | — | — | CDR | TIM[2:0] | 0x02 | 0x03 | R/W | ||
LUX Reading | |||||||||||
LUX High Byte | E3 | E2 | E1 | E0 | M7 | M6 | M5 | M4 | 0x03 | 0x00 | R |
LUX Low Byte | — | — | — | — | M3 | M2 | M1 | M0 | 0x04 | 0x00 | R |
Threshold Set | |||||||||||
Upper Threshold High Byte |
UE3 | UE2 | UE1 | UE0 | UM7 | UM6 | UM5 | UM4 | 0x05 | 0xFF | R/W |
Lower Threshold High Byte |
LE3 | LE2 | LE1 | LE0 | LM7 | LM6 | LM5 | LM4 | 0x06 | 0x00 | R/W |
Threshold Timer | T7 | T6 | T5 | T4 | T3 | T2 | T1 | T0 | 0x07 | 0xFF | R/W |
Implementing End-of-Conversion Detection
Implementation 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 I2C 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:
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
Step 2. Configure the part for an instantaneous and forced interrupt trigger at the end of conversion.
Write lower threshold high byte = 1111 1111.
Write higher threshold high byte = 0000 0000.
Write threshold timer = 0000 0000.
Step 3. Stay in a "wait" state until a user command initiates a valid conversion.
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.
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.
Step 5. Return to Step 3.