DM00118999

DM00118999
DT0030
Design tip
VL6180X ambient light sensing
By Ken Weiner
Main components
VL6180X
Proximity and ambient light sensing (ALS) module
Purpose and Benefits
This design tip explains how to use and implement the ambient light sensing features of the
VL6180X.
2
It is assumed that the user can communicate with the VL6180X through I C, is familiar with
writing to the device registers and the device start up procedure.
Figure 1. VL6180X
Ambient Light Sensing (ALS) Overview
The VL6180X can measure the incoming ambient light over a wide dynamic range. The
ALS sensor uses a photopic filter in order to approximate the spectral response of the
human eye. The raw data output from the ALS is a 16-bit (0 – 65,535) value that is
proportional to the amount of light within the field of view during the integration time. The
device has a ±42 degree field of view (FOV). The ALS count is converted to lux by the host
processor when necessary. Lux is the standard unit of light intensity or measurement of
the amount of perceived light in an area. Table 1 shows some typical examples of lux
values for different conditions.
Rev 1 DT0030
1/5
www.st.com
Table 1.
Illuminance (lux)
0.0001
0.002
0.27- 1.0
1
50
80
100
400
1000
10,000 – 25,000
32,000 – 100,000
Typical lighting conditions
Scene Description
Moonless overcast night
Moonless clear night
Full Moon on clear night
Twilight
Typical family room lighting
Typical Office / Hallway lighting
Dark overcast day
Sunrise or sunset on clear day
Overcast day, typical TV studio lighting
Clear Day indirect sunlight
Direct Sunlight
Analog Gain
Analog gain is selected to match the ALS dynamic range to the expected light range of the
application and to compensate for the use of cover glass. The analog gain is set by writing
the index value in the SYSALS_ANALOGUE_GAIN (0x003F) register as defined in Table
2.
Table 2.
Index
Value
Reg
(0x003F)
Analog
Settings
Actual
gain
values
ALS dynamic range
(1)
Dynamic Range
(no Cover Glass)
(2)
Min (Lux)
Max (Lux)
0x06
1
1.01
3.20
20,800
0x05
1.25
1.28
2.56
16,640
0x04
1.67
1.72
1.93
12,530
0x03
2.5
2.6
1.28
8,320
0x02
5
5.21
0.64
4,160
0x01
10
10.32
0.32
2,080
0x00
20
20
0.16
1,040
0x07
40
40
0.08
520
1. ALS Lux Resolution 0.32 @ 100ms integration time
2. Minimum ALS count 10
Dynamic Range (10%
transmissive cover
glass)
Min (Lux)
Max (Lux)
32.0
>100,000
25.6
>100,000
19.2
>100,000
12.8
83,200
6.4
41,600
3.2
20,800
1.6
10,400
0.8
5,200
When converting the ALS count value to lux using actual gain value, as shown in Table 2,
will give a more accurate result.
ALS Result Scalar
In additional to analog gain, the VL6180X has a result scalar that multiplies the ALS count
prior to it being written to RESULT__ALS_VAL (0x0050). This value, in addition to the
analog gain, is useful in very low light conditions to increase the dynamic range. The
scalar value is a 5-bit number stored in FIRMWARE__RESULT_SCALER (0x0120) with a
range of (1 -32).
Integration Time
The ambient light sensor works by counting photons over a fixed time period referred to as
the integration time. The resulting output value is proportional to the amount of light
sensed or photons received during the integration period. The system is set in the factory
Rev 1 DT0030
2/5
www.st.com
to match 0.32 lux per ALS count at an integration time of 100ms. The 100ms integration
time is optimal for most applications. It is recommended to adjust the analog gain setting
for different light level applications rather than adjusting integration time.
When necessary, the integration time can be changed. For example, when the sample rate
is required to be faster than the 100ms integration time allowed, decreasing the integration
time will allow for faster sampling rates. Lowering the integration time will, however,
increase the effect of the light flicker on the result. It is recommended to keep integration
time in steps of 50ms to reduce the impact of light flicker. The integration time is stored in
the SYSALS__INTEGRATION_PERIOD (0x0040) in milliseconds. The range is 1 to
499ms so the value in the register is one less than the desired value in milliseconds:
SYSALS__INTEGRATION_PERIOD = integration period – 1.
In applications where the low light dynamic range is more important than measuring high
brightness scenes, increasing the integration time will increase the dynamic range while
lowering the brightness at which the sensor saturates.
ALS Lux Resolution
As previously stated, the default ALS lux resolution is 0.32 lux per count and it is
recommended not to be changed since the system was tuned to this count with 100ms
integration time. The ALS Lux resolution is not a stored value in a register nor does it
affect the operation of the unit, but is a value used when converting the ALS count to lux.
In applications that would benefit from a more specific value, the lux resolution can be
calibrated by using an external light meter to measure the amount of light and then record
the ALS count value.
ALS Lux Resolution = Lux Reading / ALS Count Value
It is best to set the analog gain to 1, set the integration time to the value used in the
application, and the light level set to the most critical level for the application. For example,
if either a low or high ALS threshold interrupt is used, then the threshold would be the best
light level to set. Care has to be taken when making this calibration, since differences in
the field of view between the VL6180X and a standard lux meter can produce differing
results. Adding a cone to the lux meter or using a diffuser can mitigate this effect.
Cover Glass Calibration
The use of cover glass in an application will block a percentage of light measured at the
sensor. This reflected or absorbed light by the glass needs to be accounted for when
converting the ALS count to lux. The calibration of the cover glass is only needed when the
cover glass is modified. Like ALS lux resolution, the calibration is only used in the
conversion from ALS counts to lux and is not written to the VL6180X. To calibrate for cover
glass, the device should be placed under a stable light source similar in color temperature
and intensity as the application. Multiple ALS measurements are taken both with and
without the cover glass. The calibration factor is the ratio of the averaged results:
Cover Glass Cal Factor = Avg without glass / Avg with glass
Rev 1 DT0030
3/5
www.st.com
Converting ALS Count to Lux
To convert the ALS count to lux, the factors discussed above need to be taken into
account. The ALS count read from the RESULT_ALS_VAL (0x0050) is proportional to the
level of ambient light and can be converted to lux by the following equation:
Lux = RESULT__ALS_VAL / Analog Gain Value * ALS Lux Res * 100 /
(SYSALS__INTEGRATION_PERIOD +1) / FIRMWARE__RESULT_SCALER *
Cover Glass Cal Factor
Example: ALS Count =2040; Analog Gain = 1.67; no cover glass; scalar = 1
Lux = 2040 / 1.67 * 0.32 * 100 / (99 +1) / 1 * 1 = 390.90
Use of Interrupts and Thresholds
The VL6180X can be set up to trigger an interrupt on ALS values as well as range data.
The ALS interrupt can be configured to trigger when either below a Low Threshold, above a
High Threshold, outside a window, or whenever a new reading is ready. An interrupt can
either be polled or set to trigger a GPIO signal. For example, this can be useful in
applications where the ranging feature is not needed when there are no lights on in a room.
The host processor can configure the VL6180X to trigger the GPIO1 on a high light level,
then go to sleep until the lights come back on. The configuration of the GPIO is set in bits
3-5 of SYSTEM__INTERRUPT_CONFIG_GPIO (0x0014). The threshold levels are set in
either SYSALS__THRESH_HIGH (0x003A) or SYSALS__THRESH_LOW (0x003C). The
threshold levels are written in ALS counts rather than in lux.
In the example of a low power application where the ranging functions is needed only when
the lights in a room are on and the typical lighting in the room is 100lux, the VL6180X
GPIO1 can be configured trigger HIGH when the light increases to 75Lux by setting the
following registers after running the standard start up scripts:
SYSTEM__INTERRUPT_CONFIG_GPIO = 0x10
ALS Interrupt to High Threshold
SYSTEM__MODE_GPIO1 = 0x30
Enable GPIO1 interrupt
SYSALS__THRESH_HIGH = 0x0960
Sets high threshold to 75 lux
0x960 = 2,400 ALS count = 75lux / Analog Gain / 0.01 (cover glass cal) / 0.32 (res)
SYSALS__INTERMEASUREMENT_PERIOD = 0x32 Sets sample period to 500ms
SYSALS__START = 0x03
Starts ALS Continuous
Next, the processor can go into a low power sleep state waiting for the VL6180X to trigger
the host processor to wake up as the lights turn on and the lux level increases above
75Lux. The host processor can then change the VL6180X configuration to ranging or
interleaved mode.
Support Material
Related design support material
MOB-EK2-180-03 - VL6180X Premium Evaluation Kit
Documentation
Datasheet: VL6180X - Proximity and ambient light sensing (ALS) module
Revision History
Date
12-June-2014
Version
1
Changes
Initial release
Rev 1 DT0030
4/5
www.st.com
Please Read Carefully
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries
(“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and
services described herein at any time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST
assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If
any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the
use of such third party products or services, or any intellectual property contained therein or considered as a warranty
covering the use in any manner whatsoever of such third party products or services or any intellectual property contained
therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR
IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT
LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR
EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR
OTHER INTELLECTUAL PROPERTY RIGHT.
ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH
AS LIFE SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY
REQUIREMENTS; (B) AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS,
AND/OR (D) AEROSPACE APPLICATIONS OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR
SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN
INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING
INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY DOMAINS ACCORDING TO ST
PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE DEEMED
SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall
immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in
any manner whatsoever, any liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
© 2014 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United
States of America
www.st.com
Rev 1 DT0030
5/5
www.st.com
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement