SBOS993A December 2021 – December 2022 OPT4001
PRODUCTION DATA
The OPT4001 device measures light and updates output registers with proportional ADC codes. Output of the device is represented by two parts (i) 4 bits of EXPONENT and (ii) 20 bits of MANTISSA. This arrangement of binary logarithmic full-scale range with linear representation with in a range helps in covering a large dynamic range of measurements. MANTISSA represents the linear ADC codes proportional to the measured light within a given full-scale range and the EXPONENT represents the current-full scale range selected. The selected range can be automatically determined by the auto-range selection logic or manually selected as per Table 8-3.
Lux level can be determined using the following equations:
or
where RESULT_MSB, RESULT_LSB and EXPONENT are parts of the output register
RESULT_MSB register carries the most significant 12 bits of the MANTISSA and RESULT_LSB register carries the least significant 8 bits of the MANTISSA. MANTISSA is then computed using the above equations to get the 20 bit number. EXPONENT is directly read from the register which is 4 bits.
Once the EXPONENT and MANTISSA portions are calculated the linearized ADC_CODES is calculated using the following equation:
or
With maximum value for register E being 8 ADC_CODES is effectively a 28 bit number. The semi-logarithmic numbers have been converted to a linear ADC_CODES representation, which is simple to convert to lux given by the following formula
The MANTISSA and ADC_CODES are large numbers with 20 and 28 bits required to represent them. While developing firmware or software for these calculations, allocating appropriate data types to prevent data overflow is important. Some explicit typecasting to a larger data type such as 32 bit representation before left shift operation (<<) operations is recommended.
Threshold result registers THRESHOLD_H_RESULT and THRESHOLD_L_RESULT are 12 bit, while threshold exponent registers THRESHOLD_H_EXPONENT and THRESHOLD_L_EXPONENT are 4 bits. Since threshold is compared at linear ADC_CODES, the threshold registers are padded with zeros internally as shown to compare with the ADC_CODES
or
and
or
Threshold are then compared as shown to detect fault events.
and
Based on the FAULT_COUNT register setting, with consecutive fault high or fault low events, respective FLAG_H and FLAG_L registers are set, more details of which can be found in Section 8.4.2. Understanding the relation between THRESHOLD_H_EXPONENT, THRESHOLD_H_RESULT, THRESHOLD_L_EXPONENT, THRESHOLD_L_RESULT and the output registers is important to be able to set appropriate threshold based on application needs.