VISHAY SEMICONDUCTORS www.vishay.com Optical Sensors Application Note Designing the VEML7700 into an Application By Reinhard Schaar HIGH-ACCURACY AMBIENT LIGHT SENSOR: VEML7700 The VEML7700 is a very high-sensitivity, high-accuracy ambient light sensor in a miniature transparent 6.8 mm by 3 mm package. It includes a highly sensitive photodiode, low-noise amplifier, 16-bit A/D converter, and supports an easy-to-use I2C bus communication interface and additional interrupt feature. The ambient light read-out is available as a digital value, and the built-in photodiode response is near that of the human eye. The 16-bit dynamic range for ambient light detection is 0 lx to ~ 120 klx, with resolution down to 0.0036 lx/ct. Beside100 Hz and 120 Hz flicker noise rejection and a low temperature coefficient, the device consumes just 0.5 μA in shut down mode. In addition, another four Power saving modes are available that allow operating current to be reduced down to just 2 μA. The device operates within a temperature range of -25 °C to +85 °C. The VEML7700’s very high sensitivity of just 0.0036 lx allows the sensor to be placed behind very dark cover glasses that will dramatically reduce the total light reaching it. The sensor will also work behind clear cover glass, because even very high illumination - such as direct sunlight - will not saturate the device and read-outs up to 120 klx are possible. 4 3 2 1 Pinning 1: SCL 2: VDD 3: GND 4: SDA VEML7700 SCL 1 GND 3 Timing Controller Output Buffer I2C Interface 2 ALS-PD Low Pass Filter Oscillator SDA 4 Fig. 1 - VEML7700 Block Diagram Revision: 03-Jun-16 Document Number: 84323 1 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE VDD Temperature Sensor Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application APPLICATION CIRCUITRY FOR THE VEML7700 The VEML7700 can be connected to a power supply, ranging from 2.5 V to 3.6 V. The pull-up resistors at the I2C bus lines may also be connected to a power supply between 1.7 V to 3.6 V, allowing them to be at the same level needed for the microcontroller. Proposed values for the pull-up resistors should be > 1 kΩ, e.g.: 2.2 kΩ to 4.7 kΩ for the R1 and R2 resistors (at SDA and SCL). 2.5 V to 3.6 V R3 1.7 V to 3.6 V C1 10R C2 10 μF 100 nF R1 R2 VDD (2) C1 and R3 are optional for very disturbed supply Host Microcontroller VEML7700 SDA (4) I2C bus data SDA SCL (1) I2C bus clock SCL GND (3) Fig. 2 - VEML7700 Application Circuit The VEML7700 is insensitive to any kind of disturbances, so a small ceramic capacitor at its supply pin will be enough. Only if the power supply line could be very noisy and the voltage range close to the lower limit of 2.5 V a R-C decoupler, as shown in the above circuitry, should be used. REGISTERS OF THE VEML7700 The VEML7700 has six user-accessible 16-bit command codes. The addresses are 00h to 06h (03h not defined / reserved). COMMAND REGISTER FORMAT REGISTER NAME BIT 00 ALS_CONF 0 15 : 0 ALS gain, integration time, interrupt, and shutdown W 15 : 8 ALS high threshold window setting (MSB) W W 01 ALS_WH 02 ALS_WL 03 Power saving 04 ALS 05 WHITE 06 ALS_INT FUNCTION / DESCRIPTION R/W 7:0 ALS high threshold window setting (LSB) 15 : 8 ALS low threshold window setting (MSB) W 7:0 ALS low threshold window setting (LSB) W 15 : 0 Set (15 : 3) 0000 0000 0000 0b 15 : 8 MSB 8 bits data of whole ALS 16 bits R 7:0 LSB 8 bits data of whole ALS 16 bits R 15 : 8 MSB 8 bits data of whole WHITE 16 bits R 7:0 LSB 8 bits data of whole WHITE 16 bits R 15 : 0 ALS INT trigger event R Note • Command code 0 default value is 01 = devices is shutdown Revision: 03-Jun-16 Document Number: 84323 2 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE COMMAND CODE Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application WAKE-UP OF THE VEML7700 For random measurements, e.g. once per second, the sensor may be switched to shut down mode, where power consumption is lowest. BASIC CHARACTERISTICS (Tamb = 25 °C, unless otherwise specified) PARAMETER TEST CONDITION SYMBOL MIN. TYP. MAX. VDD 2.5 3.3 3.6 V VDD is 3.3 V Isd - 0.5 - μA VDD is 3.3 V, PSM = 11, refresh time 4100 ms IDD - 2 - μA VDD is 3.3 V, PSM = 00, refresh time 600 ms IDD - 8 - μA VDD is 3.3 V, PSM_EN = 0, refresh time 100 ms IDD - 45 - μA Supply voltage Shut down current (rem_2) Operation mode current (rem_2) UNIT Note • rem_1: light source: white LED rem_2: light conditions: dark This shut down mode is set with a “1” within bit 0 of the command register: COMMAND REGISTER FORMAT COMMAND CODE REGISTER NAME 00 ALS_SD BIT 0 FUNCTION / DESCRIPTION ALS shut down setting 0 = ALS power on 1 = ALS shut down R/W W When activating the sensor, set bit 0 of the command register to “0” with a wait time of 2.5 ms before the first measurement is needed, allowing for the correct start of the signal processor and oscillator. Please also refer to the chapter “Power Saving Modes.” RESOLUTION AND GAIN SETTINGS OF THE VEML7700 The VEML7700 is specified with a resolution of 0.0036 lx/counts. This high resolution is only available for a smaller light range of approximately 0 lx to 230 lx. For this range a high gain factor can be selected. For light levels up to about 120 000 lx, a reduced gain factor of 1/8 would then lead to a possible resolution of 0.0576 lx/counts (with an integration time of 800 ms), respective of 0.4608 lx/counts (with IT = 100 ms). Command Code ALS_GAIN Command code: 00, bits 12 and 11 COMMAND REGISTER FORMAT REGISTER NAME BIT 00 Reserved 15 : 13 Set 000b W 12 : 11 Gain selection 00 = ALS gain x 1 01 = ALS gain x 2 10 = ALS gain x (1/8) 11 = ALS gain x (1/4) W ALS_GAIN FUNCTION / DESCRIPTION R/W Remark: to avoid possible saturation / overflow effects, application software should always start with low gain: ALS gain x 1/8 or gain 1/4. ALS gain x 2 shows the highest resolution and should only be used with very low illumination values, e.g. if sensor is placed below a very “dark” cover allowing only low light levels reaching the photodiode. Revision: 03-Jun-16 Document Number: 84323 3 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE COMMAND CODE Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application Command Code ALS_IT Command code: 00, bits 9 to 6 COMMAND REGISTER FORMAT COMMAND CODE REGISTER NAME ALS_IT BIT 9:6 FUNCTION / DESCRIPTION ALS integration time setting 1100 = 25 ms 1000 = 50 ms 0000 = 100 ms 0001 = 200 ms 0010 = 400 ms 0011 = 800 ms R/W W Remark: the standard integration time is 100 ms. If a very high resolution is needed, one may increase this integration time up to 800 ms. If faster measurement results are needed, it can be decreased down to 25 ms. READ-OUT OF ALS MEASUREMENT RESULTS The VEML7700 stores the measurement results within the command code 04. The most significant bits are stored to bits 15 : 8 and the least significant bits to bits 7 : 0. The VEML7700 can memorize the last ambient data before shutdown and keep this data before waking up. When the device is in shutdown mode, the host can freely read this data directly via a read command. When the VEML7700 wakes up, the data will be refreshed by new detection. Command Code ALS Command code: 04, bits 15 : 8 (MSB), bits 7 : 0 (LSB) COMMAND REGISTER FORMAT COMMAND CODE 04 REGISTER NAME ALS BIT FUNCTION / DESCRIPTION R/W 15 : 8 MSB 8 bits data of whole ALS 16 bits R 7:0 LSB 8 bits data of whole ALS 16 bits R TRANSFERRING ALS MEASUREMENT RESULTS INTO A DECIMAL VALUE Command code 04 contains the results of the ALS measurement. This 16-bit code needs to be converted to a decimal value to determine the corresponding lux value. The calculation of the corresponding lux level is dependent on the programmed gain setting and the chosen integration time. Document Number: 84323 4 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Revision: 03-Jun-16 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application CALCULATING THE LUX LEVEL With the standard integration time of 100 ms, one has to just calculate the corresponding light level according to the programmed gain and corresponding resolution. This resolution is most sensitive with gain = 2 and an integration time of 800 ms, specified to 0.0036 lx/step. For each shorter integration time by half, the resolution value is doubled. The same principle is valid for the gain. For gain = 1 it is again doubled, and for gain = 1/4 it is four times higher, and for gain = 1/8 it is again doubled. The table below shows this factor of “2” for the four gain values: RESOLUTION AND MAXIMUM DETECTION RANGE GAIN 2 GAIN 1 GAIN 1/4 GAIN 1/8 GAIN 2 TYPICAL RESOLUTION IT (ms) GAIN 1 GAIN 1/4 GAIN 1/8 MAXIMUM POSSIBLE ILLUMINATION 800 0.0036 0.0072 0.0288 0.0576 236 472 1887 3775 400 0.0072 0.0144 0.0576 0.1152 472 944 3775 7550 200 0.0144 0.0288 0.1152 0.2304 944 1887 7550 15 099 100 0.0288 0.0576 0.2304 0.4608 1887 3775 15 099 30 199 50 0.0576 0.1152 0.4608 0.9216 3775 7550 30 199 60 398 25 0.1152 0.2304 0.9216 1.8432 7550 15 099 60 398 120 796 Example: If the 16-bit word of the ALS data shows: 0000 0101 1100 1000 = 1480 (dec.), the programmed ALS gain is 1/4, and the integration time is 100 ms. The corresponding lux level is: light level [lx] = 1480 x 0.2304 = 341 lx Light level [lx] = 1480 x 0.2304 = 341 lx Revision: 03-Jun-16 Document Number: 84323 5 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Fig. 3 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application The screen shot below shows the linearity for the four gain factors. Gain: x 2 3526 Gain: x 2 3526 Gain: x 1 1763 Gain: x 1/4 440 Gain: x 1/8 220 Fig. 4 - VEML7700 Counts vs. Gain If the light level is very low, or if just a small percentage of outside light reaches the sensor, a higher integration time will need to be chosen. For just 1 lx, 35 counts are enough with the ALS gain mode: “gain x 2,” but for 0.1 lx just 3.5 counts will remain. With an integration time of 200 ms, this will be doubled to 7 counts, and with 800 ms 28 counts are shown. This also means that with this high integration time, together with the highest gain, even 0.007 lx will deliver 2 digital counts, resulting in a high resolution of 0.0036 lx/counts. Document Number: 84323 6 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Revision: 03-Jun-16 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application Fig. 5 - VEML7700 Highest Sensitivity The lowest possible detectable illuminance is 0.007 lx, because with a needed gain of “2” only 2 counts are shown as the lowest result above “0.” Every next step (2, 3, 4, ...) is possible, so the resolution of 0.0036 lx/counts is valid. Document Number: 84323 7 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Revision: 03-Jun-16 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application LUX LEVEL MATCHING FOR DIFFERENT LIGHT SOURCES The VEML7700 shows very good matching for all kinds of light sources. LED light, fluorescent light, and normal daylight show about the same results in a close tolerance range of just ± 10 %. Only a halogen lamp with strong infrared content may show higher values. Lux Error Referenced to Standard White LED Average Result Title Transient Thermal Impedance Lux Error (%) ALS standard white LED ALS halogen ALS cold white LED ALS warm white LED 20 15 1000 10 5 100 0 -5 -10 Transient Thermal Impedance Transient Thermal Impedance 10000 25 10 1 2 3 4 5 6 7 8 9 10 Sample Number 2nd line Fig. 6 - Tolerances for Different Light Sources LINEARITY OF THE ALS RESULTS For light levels from 0.0036 lx up to > 1000 lx, the output data is strictly linear for “gain 1/4” and “gain 1/8”. Lux Result with White LED (Gain = 1) 10000 1000 1000 100 100 10 10 100 1000 Transient Thermal Impedance Transient Thermal Impedance Transient Thermal Impedance VEML7700 (lx) 10 000 10 10 000 Fig. 7 - Linearity for Gain 1: VEML7700 Lux Value vs. Optometer Lux Value “gain 1” and “gain 2” will show non-linearity for very high illuminations, so here only “gain 1/4” and “gain 1/8” should be used. Comparison measurements with a calibrated optometer show the same results as the read-out from the VEML7700. With a standard integration time of 100 ms, the actual ambient lux level exactly follows the digital counts multiplied by a responsivity factor of 0.0576, so, 0.0036 x 2 x 2 x 2 x 2, factor 8 because of 100 ms instead of 800 ms and again factor 2 because of “gain 1” instead of “gain 2”, so, factor 16 higher value = lower responsivity. Revision: 03-Jun-16 Document Number: 84323 8 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Optometer (lx) 2nd line Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application APPLICATION-DEPENDENT LUX CALCULATION If the application uses a darkened / tinted cover glass, just 10 % - or even just 1 % - of the ambient light will reach the sensor. For a tinted cover glass where there is 1 lx up to 100 klx of light outside, just 0.01 lx to 1 klx is reaching the sensor, and the application software may always stay with gain x 2. If the application uses a clear cover glass, nearly all ambient light will reach the sensor. This means even 100 klx may be possible. For this clear cover where < 1 lx to ≥ 100 klx is possible, the application software will need to adapt the gain steps according to light conditions. As explained before, with “gain 2” and IT = 100 ms, a maximum 1887 lx will be possible before saturation occurs; and with “gain 1” 3775 lx is maximum, but as already explained these high gain modes should only be used for low illuminations < 100 lx. For unknown brightness conditions, the application should always start with the lowest gain: 1/8 or 1/4. This avoids possible overload / saturation if, for example, strong sunlight suddenly reaches the sensor. To show this high value, an even lower integration time than 100 ms may be needed. Only for lower illumination levels with too low digital counts should the gain be increased. One possible decision level could be 100 counts (= 368 lx with “gain x 1/8”). After a change to gain = 1/4, this would show then 400 counts. 400 counts x 4 x 0.2304 will result in the same lux value of 368 lx. 10000 100 1000 10 100 1 1 10 100 Transient Thermal Impedance Transient Thermal Impedance Transient Thermal Impedance VEML7700 (lx) Lux Result with White LED (Gain = 1/4) 1000 10 1000 Optometer (lx) 2nd line Fig. 8 - Linearity for Gain 1/4: VEML7700 Lux Value vs. Optometer Lux Value The VEML7700 shows good linear behavior for lux levels from 0.0036 lx to about 1 klx. A software flow may look like the flow chart diagram at the end of this note: • Starting with the lowest gain (gain x 1/8), check the ALS counts. If ≤ 100 counts, increase the gain to 1/4. • Check the ALS counts again. If they are still ≤ 100 counts, increase the gain to 1. • Check the ALS counts again. If they are still ≤ 100 counts, increase the gain to 2. If the illumination value is > 100 counts (started with gain x 1/8), a correction formula may be applied to get rid of small non-linearity for very high light levels. Revision: 03-Jun-16 Document Number: 84323 9 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE • Check the ALS counts again. If they are still ≤ 100 counts, increase the integration time from 100 ms to 200 ms, and continue the procedure up to the longest integration time of 800 ms. Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application Lux Result with White LED (Gain = 1/4) 10000 10 000 1000 1000 100 100 10 10 100 1000 10 000 Transient Thermal Impedance Transient Thermal Impedance Transient Thermal Impedance VEML7700 (lx) 100 000 10 100 000 Optometer (lx) 2nd line Fig. 9 - Linearity for Gain 1/4 and Gain 1/8 up to 100 klx The VEML7700 shows good linear behavior for lux levels from 0.007 lx to about 1 klx. Illumination values higher than 1000 lx show non-linearity. This non-linearity is the same for all sensors, so a compensation formula can be applied if this light level is exceeded. Lux Result with White LED (Gain = 1/4) 1 000 000 10000 VEML7700 (lx) 2nd line 100 000 1000 10 000 Average gain 1/4 Poly. (Average gain 1/4) 1000 100 100 10 10 100 1000 10 000 Transient Thermal Impedance Transient Thermal Impedance y = 6.0135E-13x4 - 9.3924E-09x3 + 8.1488E-05x2 + 1.0023E+00x 10 100 000 Optometer (lx) 2nd line Fig. 10 - Correction Formula for Gain 1/4 and Gain 1/8 for Higher Light Levels than 100 lx Revision: 03-Jun-16 Document Number: 84323 10 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE With the help of this correction formula, the VEML7700 shows good linear results up to its maximum of 120 klx. Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application Lux Calculation Result with Gain = 1/4 1 000 000 VEML7700 (lx) 100 000 10 000 1000 100 10 10 100 1000 10 000 100 000 Optometer (lx) Fig. 11 - Linearity for Gain 1/4 and Gain 1/8 with Applied Correction Formula For most single photodetectors / ambient light sensor devices, there is a certain discrepancy in the output value for the different light sources. They either do not follow the exact v(λ) curve due to wider sensitivity within the blue area - being not that exact within the red region - or they do not stay at zero for near infrared wavelengths. The VEML7700 follows a very exact v(λ) curve in all areas. This is the reason that it reproduces the exact same output values under any kind of lighting condition, including fluorescent light, sunlight, halogen light, or LED light. The maximum deviation to nominal value (as measured with an accurate optometer) is within ± 10 %. Spectral Response 110 10000 90 80 1000 70 60 50 40 100 VEML7700 V(λ) 30 20 Transient Thermal Impedance Transient Thermal Impedance Transient Thermal Impedance Relative Responsivity (%) 100 10 0 400 450 500 550 650 650 700 750 800 850 900 950 10 1000 Fig. 12 - Spectral Response ALS Channel Revision: 03-Jun-16 Document Number: 84323 11 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Wavelength (nm) 2nd line Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application WHITE CHANNEL In addition to the ALS channel that follows the so-called human eye curve very well, there is also a second channel available called the white channel, which offers a much higher responsivity for a much wider wavelength spectrum. This white channel could be used to eliminate the last few tolerance percentages that light sources with strong infrared content are showing at a bit higher values due to this small bump around 750 nm to 800 nm. Average Gain 1/4 and Gain 1/8 10000 100 80 1000 60 40 100 20 0 250 300 350 400 450 500 550 600 650 700 750 800 850 900 950 Transient Thermal Impedance Transient Thermal Impedance Transient Thermal Impedance Normalized Responsivity 120 10 1000 1050 1100 λ - Wavelength (nm) 2nd line Fig. 13 - Spectral Response White Channel COMMAND REGISTER FORMAT COMMAND CODE 05 REGISTER NAME WHITE BIT FUNCTION / DESCRIPTION R/W 15 : 8 MSB 8 bits data of whole white 16 bits R 7:0 LSB 8 bits data of whole white 16 bits R The data for this channel is available within the command code 05. Several measurements with many different light sources show that the output data of this channel will lead to higher data, up to 2 times that read from the ALS channel. All kind of LEDs, as well as fluorescent lights, will deliver output data within a small tolerance window of just ± 10 %. Average Gain 1/4 and Gain 1/8 100 000 1000 80 000 60 000 nominal + 10 % nominal nominal - 10 % 40 000 100 20 000 0 10 0 20 000 40 000 60 000 80 000 100 000 120 000 140 000 Brightness According Calibrated Luxmeter (lx) 2nd line Fig. 14 - ALS Measurement Deviation Between Different Light Sources: ≤ 10 % Only strong light from incandescent or halogen lamps and strong sunlight may show higher tolerances within the ALS channel (see Fig. 6). Revision: 03-Jun-16 Document Number: 84323 12 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Reading of ALS (lx) Optometer (lx) 120 000 Transient Thermal Impedance Transient Thermal Impedance 10000 140 000 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application White Channel Counts with Setup 100 ms Gain x 1, All Light Sourdes = 100 lx ALS standard white LED ALS halogen 6800 ALS cold white LED ALS warm white LED 5800 10000 1000 4800 3800 100 2800 1800 800 Transient Thermal Impedance Transient Thermal Impedance Transient Thermal Impedance White Channel Counts 7800 10 1 2 3 4 5 6 7 8 9 10 Sample Number 2nd line Fig. 15 - White Channel Counts for Different Light Sources Remark: standard white LED: 5600K, cold white LED: 7500K, warm white LED: 3500K Nearly all light sources will show a factor of < 2 between ALS and white channel Revision: 03-Jun-16 Document Number: 84323 13 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Fig. 16 - White Channel and ALS Channel for Fluorescent and Daylight Spectra Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application Light sources containing strong infrared content will show a factor of > 2 between ALS and white channel Fig. 17 - White Channel and ALS Channel for Incandescent Lamp Spectra Knowing that light sources with strong infrared content deliver about > 2 times higher output data at the white channel than all other light sources, which show a maximum factor of about 2, one may use it to optimize the lux conversion now. ALS Counts with Setup 100 ms Gain x 1, All Light Sourdes = 100 lx White standard white LED White halogen 6800 White cold white LED White warm white LED 5800 10000 1000 4800 3800 100 2800 1800 10 1 2 3 4 5 6 7 8 9 10 Sample Number 2nd line Fig. 18 Revision: 03-Jun-16 Document Number: 84323 14 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE 800 Transient Thermal Impedance Transient Thermal Impedance Transient Thermal Impedance White Channel Counts 7800 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application POWER-SAVING MODES The device stays in shutdown mode as long as no measurements need to be done. Once activated with ALS_SD = 0, measurements are executed. COMMAND REGISTER FORMAT COMMAND CODE 00 REGISTER NAME ALS_SD BIT 0 FUNCTION / DESCRIPTION R/W ALS shutdown setting 0 = ALS power on 1 = ALS shutdown W Without using the power-saving feature (PSM_EN = 0), the controller has to wait before reading out measurement results, at least for the programmed integration time. For example, for ALS_IT = 100 ms a wait time of ≥ 100 ms is needed. A more simple way of continuous measurements can be realized by activating the PSM feature, setting PSM_EN = 1. COMMAND REGISTER FORMAT COMMAND CODE REGISTER NAME BIT FUNCTION / DESCRIPTION Power-saving mode; see table “Refresh Time” 00 = mode 1 01 = mode 2 10 = mode 3 11 = mode 4 W Power-saving mode enable setting 0 = disable 1 = enable W 00 PSM 2:1 00 PSM_EN 0 R/W The default this comes up with is mode 1 = 00 for the bits 2 and 1 within the command code. Depending on the chosen integration time (ALS_IT), this leads to a certain measurement speed / repetition rate. For ALS_IT = 100 ms (0000 for bits 9 : 6 within command register) this is about 600 ms. For 200 ms (0001) it will be 700 ms, for 400 ms (0010) 900 ms, and for 800 ms (0011) about 1300 ms. PSM ALS_IT REFRESH TIME (ms) 00 0000 600 00 0001 700 00 0010 900 00 0011 1300 The higher the PSM value and the longer the integration time, the lower the current consumption will be. The possible sensitivity also depends on integration time, where the longest (800 ms) will lead to 0.0036 lx/counts, together with the highest gain: ALS_GAIN = 01 (ALS gain x 2). All refresh times, corresponding current consumptions, and possible sensitivities are shown in the table on the next page. Revision: 03-Jun-16 Document Number: 84323 15 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Other PSM modes will lead to even lower repetition rates. This will also lead to a lower power consumption (see the table on the next page). Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application REFRESH TIME, IDD, AND RESOLUTION RELATION ALS_GAIN PSM ALS_IT 01 00 0000 01 01 0000 01 10 0000 01 11 0000 01 00 01 01 REFRESH TIME (ms) IDD (μA) RESOLUTION (lx/bit) 600 8 0.0288 1100 5 0.0288 2100 3 0.0288 4100 2 0.0288 0001 700 13 0.0144 01 0001 1200 8 0.0144 10 0001 2200 5 0.0144 01 11 0001 4200 3 0.0144 01 00 0010 900 20 0.0072 01 01 0010 1400 13 0.0072 01 10 0010 2400 8 0.0072 01 11 0010 4400 5 0.0072 01 00 0011 1300 28 0.0036 01 01 0011 1800 20 0.0036 01 10 0011 2800 13 0.0036 01 11 0011 4800 8 0.0036 INTERRUPT HANDLING To avoid too many interactions with the microcontroller, the interrupt feature may be used. This is activated with ALS_INT_EN = 1. Only when the programmed threshold is exceeded and a programmed number of measurements (ALS_PERS) stay above / below this threshold will the corresponding interrupt bit (ALS_IF_L or ALS_IF_H) be set. COMMAND REGISTER FORMAT COMMAND CODE REGISTER NAME BIT 00 ALS_INT_EN 1 ALS_PERS 01 ALS_WH 02 06 Revision: 03-Jun-16 R/W ALS interrupt enable setting 0 = ALS INT disable 1 = ALS INT enable W 5:4 ALS persistence protect number setting 00 = 1 01 = 2 10 = 4 11 = 8 W 15 : 8 ALS high threshold window setting (MSB) W 7:0 ALS high threshold window setting (LSB) W 15 : 8 ALS low threshold window setting (MSB) W 7:0 ALS low threshold window setting (LSB) W ALS_WL ALS_IF_L 15 ALS crossing low threshold INT trigger event R ALS_IF_H 14 ALS crossing high threshold INT trigger event R reserved 13 : 0 Document Number: 84323 16 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE 00 FUNCTION / DESCRIPTION Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application MECHANICAL CONSIDERATIONS AND WINDOW CALCULATION FOR THE VEML7700 The ambient light sensor will be placed behind a window or cover. The window material should be completely transmissive to visible light (400 nm to 700 nm). For optimal performance the window size should be large enough to maximize the light irradiating the sensor. In calculating the window size, the only dimensions that the design engineer needs to consider are the distance from the top surface of the sensor to the outside surface of the window and the size of the window. These dimensions will determine the size of the detection zone. First, the center of the sensor and center of the window should be aligned. The VEML7700 has an angle of half sensitivity of about ± 55°, as shown in the figure below. 20° 1.0 0.9 40° 0.8 0.7 60° 0.6 ϕ - Angular Displacement Srel - Relative Sensitivity 0° 80° 0.5 0.4 0.3 0.2 0.1 0 22308 Fig. 19 - Relative Radiant Sensitivity vs. Angular Displacement Fig. 20 - Angle of Half Sensitivity: Cone Remark: This wide angle and the placement of the sensor as close as possible to the cover is needed, if it should show comparable results to an optometer, which also detects light reflections from the complete surroundings. Sensitive area 1.95 Fig. 21 - Windows Above Sensitive Area Revision: 03-Jun-16 Document Number: 84323 17 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE It is possible to place the VEML7700 horizontally and vertically. Please see within the “package drawing” that the center of the sensitive area is not in the center position of the package. Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application The size of the window is simply calculated according to triangular rules. The dimensions of the device are shown within the datasheet; the known distance below the window’s upper surface and the specified angle below the given window diameter (w) leads to best results. VEML7700 Sensitive area 5 47 1.95 0. 0.3362 Dimensions (L x W x H in mm): 6.8 x 2.35 x 3 w x 0.5 . D d tan 55° = 1.43 = x / d x = 1.43 x d α 2.35 here in drawing α = 55° dimensions in mm Fig. 22 - Window Area for an Opening Angle of ± 55° The calculation is then: tan α = x / d → with α = 55° and tan 55° 1.43 = x / d → x = 1.43 x d Then the total width is w = 0.5 mm + 2 x x. d = 1.0 mm → x = 1.43 mm → w = 0.5 mm + 2.86 mm = 3.36 mm d = 1.5 mm → x = 2.15 mm → w = 0.5 mm + 4.30 mm = 4.80 mm d = 2.0 mm → x = 2.86 mm → w = 0.5 mm + 5.72 mm = 6.22 mm d = 2.5 mm → x = 3.58 mm → w = 0.5 mm + 7.16 mm = 7.66 mm d = 3.0 mm → x = 4.29 mm → w = 0.5 mm + 8.58 mm = 9.08 mm Revision: 03-Jun-16 Document Number: 84323 18 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE d = 0.5 mm → x = 0.72 mm → w = 0.5 mm + 1.44 mm = 1.94 mm Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application A smaller window also will be sufficient if reference measurements can be done and / or output results need not follow that exact an optometer result. VEML7700 Sensitive area 1.95 0.3362 Dimensions (L x W x H in mm): 6.8 x 2.35 x 3 w x 0.5 . D d tan 40° = 0.84 = x / d x = 0.84 x d α 0.85 here in drawing α = 40° dimensions in mm Fig. 23 - Window Area for an Opening Angle of ± 40° The calculation is then: tan α = x / d → with α = 40° and tan 40° 0.84 = x / d → x = 0.84 x d Then the total width is w = 0.5 mm + 2 x x. d = 0.5 mm → x = 0.42 mm → w = 0.5 mm + 0.84 mm = 1.34 mm d = 1.5 mm → x = 1.28 mm → w = 0.5 mm + 2.56 mm = 3.06 mm d = 2.0 mm → x = 1.68 mm → w = 0.5 mm + 3.36 mm = 3.86 mm d = 2.5 mm → x = 2.10 mm → w = 0.5 mm + 4.20 mm = 4.70 mm d = 3.0 mm → x = 2.52 mm → w = 0.5 mm + 5.04 mm = 5.54 mm Revision: 03-Jun-16 Document Number: 84323 19 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE d = 1.0 mm → x = 0.84 mm → w = 0.5 mm + 1.68 mm = 2.18 mm Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application TYPICAL SOFTWARE FLOW CHART For a wide light detection range of more than seven decades (from 0.007 lx to 120 klx), it is necessary to adjust the sensor. This is done with the help of four gain steps and seven steps for the integration time. To deal with these steps, they are numbered as needed for the application software. The ALS gain modes are called G1 to G4 and the integration times are called IT: Sensitivity Mode Selection G ALS Integration Time Setting 00 = ALS gain x 1 →3 IT 1100 = 25 ms → -2 01 = ALS gain x 2 →4 1000 = 50 ms → -1 10 = ALS gain x (1/8) →1 0000 = 100 ms →0 11 = ALS gain x (1/4) →2 0001 = 200 ms →1 0010 = 400 ms →2 0011 = 800 ms →3 Whereas the programmed gain begins with the lowest possible value, in order to avoid any saturation effect the integration time starts with 100 ms: IT = 0. With this just about 30 klx is possible. If this is not enough due to a wide and clear cover, and the sensor is being exposed to direct bright sunlight, one may also begin with the shortest integration time. Read-out ALS data Counts too low? Y Increase gain Still too low? Y Fig. 24 - Simple Flow Chart View Revision: 03-Jun-16 Document Number: 84323 20 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Decrease integration time Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application TYPICAL SOFTWARE FLOW CHART WITH CORRECTION FORMULA (1) Initialize μC ALS_SD = 0 wait ALS_IT Set gain: G = 1 (ALS_GAIN: 1/8) Read-out ALS data ALS power on, wait ≥ 2.5 ms Integration time (ALS_IT = 0): 100 ms ALS gain setting ALS integration time setting 1100 = 25 ms 1000 = 50 ms 0000 = 100 ms 0001 = 200 ms 0010 = 400 ms 0011 = 800 ms → → → → → → IT: -2 -1 0 1 2 3 Gain selection 00 = ALS gain x 1 01 = ALS gain x 2 10 = ALS gain x (1/8) 11 = ALS gain x (1/4) → → → → G: 3 4 1 2 ALS command code #4 Correction formula: Lux calc. = 6.0135E-13x4 - 9.3924E-09x3 + 8.1488E-05x2 + 1.0023E+00x ALS ≤ 100 cts? Y ALS_SD = 1 G=G+1 ALS_SD = 0 N ALS between 100 and 65 535 counts → G = 1 = ALS gain 1/8 (with x = Lux_VEML) If ALS counts ≤ 100 cts set higher gain ALS > 10 000 cts? N ALS between 100 and 10 000 counts → G = 1 = ALS gain 1/8 Calculation of Lux_calc set ALS_SD to 1 = stand_by! Y IT = IT - 1 N Decrease of integration time G = 4? Y N ALS_SD = 0 IT = IT + 1 Increase of integration time IT = -2? Y N Ambient light really ≥ 200 klx? IT = 4? ALS_IT = 3 (800 ms) Y Output = LUX_VEML Lux_VEML = output data (dec.)/(ALS gain x responsivity) Fig. 25 - Flow Chart with Correction Formula from ≥ 100 lx Revision: 03-Jun-16 Document Number: 84323 21 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Calculation of Lux_calc ALS_IT = -2 (25 ms) Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application TYPICAL LUMINANCE VALUES Luminance 10-5 lx 10-4 lx 0.002 lx 0.01 lx 1 lx 3.4 lx 50 lx 80 lx 100 lx 320 lx to 500 lx 400 lx 1000 lx 10 000 lx to 25 000 lx 32 000 lx to 130 000 lx Example Light from Sirius, the brightest star in the night sky Total starlight, overcast sky Moonless clear night sky with airglow Quarter moon, 0.27 lx; full moon on a clear night Full moon overhead at tropical latitudes Dark limit of civil twilight under a clear sky Family living room Hallway / bathroom Very dark overcast day Office lighting Sunrise or sunset on a clear day Overcast day; typical TV studio lighting Full daylight (not direct sun) Direct sunlight VEML7700 SENSOR BOARD AND DEMO SOFTWARE The small blue VEML7700 sensor board is compatible with the SensorStarterKit. Please also see www.vishay.com/moreinfo/vcnldemokit/ Document Number: 84323 22 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Revision: 03-Jun-16 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application After plugging in the VEML7700 sensor board to the USB dongle (both up or down are possible) and activating with the “VEML6030X01.exe” file, the “Ambient Light” menu appears. Halogen lamp as light source contains strong infrared content and shows a factor of > 3 between ALS and white channel The ALS sensitivity mode is preprogrammed to “gain x 1/8” and integration time to “100 ms.” Self-timed measurements are started by clicking the measure button. Both the ALS and the white channel are shown. A channel can be deactivated by clicking within the small white box on top of the graph and clicked again to make visible. In addition, decimal, binary, or hex formats can be selected in the small white boxes on the right side, where the small letters “d” and “b” are shown. The lux level is calculated according to the rules mentioned above, and the chosen gain and integration time are displayed in the lowest white box “Lux.” Document Number: 84323 23 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Revision: 03-Jun-16 Application Note www.vishay.com Vishay Semiconductors Designing the VEML7700 into an Application The screen shots below appear when programming the upper and lower thresholds within the “Settings” menu. Selecting “ALS INT Enable” and “Show” within the measurement menu will then show the high and low thresholds as blue and green lines, respectively. If the light source changes to that higher or lower value, the below appears. Remark: The VEML7700 offers the interrupt feature, but no dedicated pin. Document Number: 84323 24 For technical questions, contact: [email protected] THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE. THE PRODUCTS DESCRIBED HEREIN AND THIS DOCUMENT ARE SUBJECT TO SPECIFIC DISCLAIMERS, SET FORTH AT www.vishay.com/doc?91000 APPLICATION NOTE Revision: 03-Jun-16