Application Note

VISHAY SEMICONDUCTORS
www.vishay.com
Optical Sensors
Application Note
Designing the VEML6070 UV Light Sensor
into Applications
By Reinhard Schaar
UV LIGHT SENSOR WITH I2C INTERFACE
The VEML6070 is an advanced ultraviolet (UVA) light sensor designed with a CMOS process and featuring an I2C protocol
interface.
VEML6070
GND
1
Temperature
sensor
6
VDD
5
SCL
4
RSET
Low-pass
filter
ACK
2
Timing
controller
SDA
Output buffer
I2C interface
UV-PD
3
Oscillator
Fig. 1 - Block Diagram of the VEML6070
The VEML6070 is easily operated via a simple I2C command. The active acknowledge (ACK) feature with threshold window
settings allows the UV sensor to send out an UVI alert message. Under a strong solar UVI condition, the smart ACK signal can
be easily implemented by the software programming. The VEML6070 incorporates a photodiode, amplifiers, and analog / digital
circuits into a single chip. The VEML6070’s adoption of FiltronTM UV technology provides the best spectral sensitivity to cover
UV spectrum sensing. It has an excellent temperature compensation and a robust refresh rate setting that does not use an
external RC low-pass filter. The VEML6070 shows linear sensitivity to solar UV light, which can easily be adjusted by selecting
the proper external resistor.
The VEML6070 comes within a very small surface-mount package with dimensions of just 2.35 x 1.8 x 1.0 (L x W x H in mm).
The VEML6070 operates within a supply voltage range of 2.7 V to 5.5 V. The necessary pull-up resistors at the I2C and ACK
lines can be connected to the same supply as the microcontroller, between 1.7 V and 5.5 V.
Revision: 07-Jan-16
Document Number: 84310
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
The device can be used as a solar UV indicator for handheld cosmetic / outdoor sports products or any kind of consumer
products.
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
1.7 V to 5.5 V
R1 R2
R3
Host
Micro Controller
GND (1)
2.7 V to 5.5 V
VDD (6)
C1
100 nF
VEML6070
R5
RSET (4)
SDA (3)
I2C bus data SDA
SCL (5)
I2C bus clock SCL
ACK (2)
GPIO (INT)
270 kΩ
Fig. 2 - Application Circuit
The value for the pull-up resistors should be 2.2 kΩ.
The supply current of this device is also dependent on the RSET value. When activated for measuring it is typically 100 μA; in
shut-down mode (SD = 1) it is typically just 1 μA.
The resistor RSET value at pin 4 of the VEML6070 needs to be selected depending on the application and required sensitivity.
The table below shows how this value also affects the integration time that is programmed within the command register with
bits 2 and 3 (IT0 and IT1).
EXAMPLE OF RELATION BETWEEN INTEGRATION TIME AND RSET VALUE
REGISTER
(IT1 : IT0)
REFRESH TIME
SETTING
RSET = 300 kΩ
RSET = 600 kΩ
RSET = 1.2 MΩ
(0 : 0) = 1/2T
62.5 ms
125 ms
250 ms
(0 : 1) = 1T
125 ms
250 ms
500 ms
(1 : 0) = 2T
250 ms
500 ms
1000 ms
(1 : 1) = 4T
500 ms
1000 ms
2000 ms
The VEML6070 shows its peak sensitivity at 355 nm. Bandwidth (λ0.5) is achieved for a range of about 335 nm to 375 nm.
Axis Title
100
10000
80
70
1000
1st line
2nd line
60
50
40
100
30
20
10
0
10
300
350
400
450
500
550
600
λ - Wavelength (nm)
2nd line
Fig. 3 - Relative Responsivity vs. Wavelength
Revision: 07-Jan-16
Document Number: 84310
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
2nd line
Normalized Output (%)
90
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
What does this wavelength mean? To understand this, the diagram below shows that it is in the middle of the so-called
UVA region.
Ultraviolet
UVC
100
UVB
280
Visible
Infrared
UVA
320
400
700
Wavelength (nm)
Fig. 4 - Light Spectrum
Visible light has wavelengths between 400 nm and 750 nm.
UV light has shorter wavelengths, from 200 nm to 400 nm.
UV type A has light with wavelengths between 320 nm and 400 nm.
UV type B has wavelengths between 280 and 320 nm.
UV type C is between 200 nm and 280 nm.
While UVA and UVB reach earth, UVC is blocked by our atmosphere, so it does not cause harm.
Cosmic- Gamma- XRays
Rays Rays
UVC
UVB
UVA
Visible
Infrared
Microwave
Ozone Layer
4.9 %
56 %
39 %
Fig. 5 - Radiation that Reaches the Earth’s Surface
Revision: 07-Jan-16
Document Number: 84310
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
0.1 %
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
UVB rays - wavelengths ranging from 280 nm to 320 nm - are extremely energetic and harmful to the skin; they are responsible
for 65 % of skin tumors. Thankfully, only 0.1 % of the solar energy that arrives on the earth’s surface is in the form of UVB
radiation.
UVA rays - wavelengths ranging from 320 nm to 400 nm - are less powerful than UVB rays, but are highly penetrating. They are
capable of reaching the skin and are responsible for photoaging and the onset of different forms of skin cancer. 4.9 % of solar
energy is made up of UVA rays.
In order to estimate the energy behind UV radiation and the risk level associated with it, the UV-index was established.
It is a quite complex calculation, weighted according to a curve and integrated over the whole spectrum. So, it cannot simply
be related to the irradiance (measured in W/m2).
The calculated index value appears on a scale of 0 to ≥ 11. This index scale is linear and its relation to irradiance strength is
shown below.
Ee (W/m2)
Strength of Irradiance
0.3
UV-Index
12
Extreme
11
10
Very High
9
8
0.2
High
7
6
5
0.1
Moderate
4
3
2
Low
0.0
1
0
Fig. 6 - Strength of Irradiance and the UV-Index
In order to estimate the energy behind UV radiation and the risk level associated with it, the VEML6070 simply reads out the
irradiance value and compares it with pre-defined values.
These given values are estimated, taking care to weigh the irradiance strength according to the wavelength and response
performance of the VEML6070 (fig. 3).
Setting up and programming the VEML6070 is easily handled with just three I2C-bus addresses: 0x70, 0x71, and 0x73.
TABLE 1 - VEML6070 SLAVE ADDRESS AND FUNCTION DESCRIPTION
SLAVE ADDRESS
OPERATION
Write command to VEML6070
0x72
Reserved
0x71
Read LSB 8 bits of VEML6070 ultraviolet light data
0x73
Read MSB 8 bits of VEML6070 ultraviolet light data
Revision: 07-Jan-16
Document Number: 84310
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
0x70
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
0x70 is the only command register where shut-down, integration time, and acknowledge activity settings are handled.
TABLE 2 - COMMAND REGISTER BITS DESCRIPTION
COMMAND FORMAT
Reserved
ACK
ACK_THD
Reserved
SD
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
IT
Bit 2
Bit 1
Bit 0
0
0
ACK
THD
IT1
IT0
1
SD
DESCRIPTION
Reserved
ACK
ACK_THD
Reserved
Acknowledge activity setting
Acknowledge threshold window setting for byte mode usage
IT
Integration time setting
SD
Shutdown mode setting
As previously discussed, integration time also depends on the external resistor at pin 4. Together with a RSET value of 270 kΩ,
the table below shows UV light data values that lead to the UVI values shown on the left side.
UVI
RSET = 270 kΩ; IT = 1T
RSET = 270 kΩ; IT = 2T
RSET = 270 kΩ; IT = 4T
UV-INDEX
≥ 11
≥ 2055
≥ 4109
≥ 8217
Extreme
8 to 10
1494 to 2054
2989 to 4108
5977 to 8216
Very High
6, 7
1121 to 1494
2242 to 2988
4483 to 5976
High
3 to 5
561 to 1120
1121 to 2241
2241 to 4482
Moderate
0 to 2
0 to 560
0 to 1120
0 to 2240
Low
As previously mentioned, other resistor values lead to other integration times with different output data. At 540 kΩ, the 270 kΩ
output data values are doubled, and the 540 kΩ values are doubled at 1 MΩ, which means that the sensitivity is also doubled.
UVI
RSET = 540 kΩ; IT = 1T
RSET = 540 kΩ; IT = 2T
RSET = 540 kΩ; IT = 4T
0 to 2
0 to 1120
0 to 2240
0 to 4480
UV-INDEX
Low
3 to 5
1121 to 2241
2241 to 4482
4481 to 8964
Moderate
6, 7
2242 to 2988
4483 to 5976
8965 to 11 952
High
8 to 10
2989 to 4108
5977 to 8216
11 953 to 16 432
Very High
≥ 11
≥ 4109
≥ 8217
≥ 16 433
Extreme
UVI
RSET = 1 MΩ; IT = 1T
RSET = 1 MΩ; IT = 2T
RSET = 1 MΩ; IT = 4T
UV-INDEX
0 to 2
0 to 2241
0 to 4482
0 to 8964
Low
3 to 5
2242 to 4482
4483 to 8964
8965 to 17 928
Moderate
4483 to 5976
8965 to 11 952
17 929 to 23 904
High
5977 to 8217
11 953 to 16434
23 905 to 32 868
Very High
≥ 11
≥ 8218
≥ 16 435
≥ 32 869
Extreme
VEML6070 light data is available at 0x71 (LSB) and 0x73 (MSB). Together they show the whole 16-bit value and report the
present UV light conditions. This 16-bit value is transferred into decimal form and becomes the base for calculating the
corresponding UVI.
As already stated, the above values are evaluated taking care to weigh the wavelength and response performance of the
VEML6070. Factoring in the RSET value and integration time leads to the UVI values.
Revision: 07-Jan-16
Document Number: 84310
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
6, 7
8 to 10
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
WHAT VALUES MAY BE SEEN WITH THE VEML6070?
If no exact UV light source is available to check the performance of the VEML6070, and only “normal” daylight is being used to
study the VEML6070’s response, please note that the UV power is dependent on the time of day, season, and location where
the measurements will be performed. During the winter, the total skin-affecting irradiance may be so low that even within full
sunshine no remarkable values will be seen.
Axis Title
10000
Summer
160
140
120
1000
1st line
2nd line
2nd line
Skin-Affective Irradiance (mW/m2)
180
100
80
Autumn
60
100
40
Spring
20
Winter
0
10
2
4
6
8
10
12
14
16
18
20
22
Time (MEZ)
2nd line
Fig. 7 - Skin Affecting Irradiance Level vs. Time Seen at the Beginning of the Four Seasons
MECHANICAL CONSIDERATIONS AND WINDOW CALCULATIONS FOR THE VEML6070
The UV sensor will be placed behind a window or cover. The window material should not only be completely transmissive to
visible light (400 nm to 700 nm), but also at least to UVA wavelengths of 320 nm to 400 nm.
Axis Title
100
10000
0.100" thick
0.125" thick
0.150" thick
0.170" thick
0.187" thick
0.220" thick
80
70
60
1000
1st line
2nd line
2nd line
Light Transmission (%)
90
50
40
100
30
20
10
10
240 260 280 300 320 340 360 380 400
λ - Wavelength (nm)
2nd line
Fig. 8 - Light Transmission of ACRYLITE OP-4 Sheet
(www.aetnaplastics.com/site_media/media/documents/Acrylite_OP-4_Material_Data_Sheet.pdf)
Revision: 07-Jan-16
Document Number: 84310
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
0
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
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 VEML6070 has an angle of half sensitivity of
about ± 55°, as shown in the figure below.
10000
1.0
0.9
40°
1000
0.8
0.7
100
60°
0.6
2nd line
20°
1stDisplacement
line
ϕ - Angular
2nd line
Transmission
(%)
SLight
Sensitivity
rel - Relative
Axis Title
0°
80°
10
0.5 0.4 0.3 0.2 0.1 0
λ - Wavelength (nm)
2nd line
Fig. 9 - Relative Radiant Sensitivity vs. Angular Displacement
Fig. 10 - Angle of Half Sensitivity: Cone
Fig. 11 - Window Above Sensitive Area
Remark:
This wide angle and the placement of the sensor as close as possible to the cover is needed to show good responsivity.
Document Number: 84310
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: 07-Jan-16
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
The size of the window is simply calculated according to triangular rules. The dimensions of the device, as well as the sensitive
area, are shown within the datasheet. For best results, the distance below the window’s upper surface and the specified angle
below the given window diameter (w) are known.
0.1
Pin 1 marking
1
6
0.28
3
4
Dimensions (L x W x H in mm): 2 x 2 x 0.85
w
x
0.5
.
D
d
tan 55° = 1.43 = x/d
x = 1.43 x d
α
0.85
Here in drawing, α = 55°
Dimensions in mm
Fig. 12 - 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: 07-Jan-16
Document Number: 84310
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
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 VEML6070 UV Light Sensor
into Applications
A smaller window will also be sufficient, although it will reduce the total sensitivity of the sensor.
0.1
Pin 1 marking
1
6
0.28
3
4
Dimensions (L x W x H in mm): 2 x 2 x 0.85
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. 13 - 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: 07-Jan-16
Document Number: 84310
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
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 VEML6070 UV Light Sensor
into Applications
VEML6070 SENSOR BOARD AND DEMO SOFTWARE
The small blue VEML6070 sensor board fits to the sensor starter kit.
Please also see: www.vishay.com/moreinfo/vcnldemokit/.
Document Number: 84310
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
Revision: 07-Jan-16
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
With the help of the VEML6070 sensor board and the demo software, one can easily test the UV sensor. Four possible
integration times are selectable. Associated result counts are strictly linear, meaning a factor of 2 in integration time results in
a factor of 2 in output data counts.
Fig. 14 - Linearity of Integration Times for Small and High Data Values
In addition to the raw data read out of registers 0x71 and 0x73, the corresponding UV-index is shown, as well as the risk level
indicated with the changing color (fig. 6).
Revision: 07-Jan-16
Document Number: 84310
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
Fig. 15 - View of the VEML6070 Demo Software Showing Raw Data, UVI, and Risk Level
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
VEML6070 REFERENCE SOFTWARE CODE
#define
#define
#define
#define
VEML6070_ADDR_ARA
VEML6070_ADDR_CMD
VEML6070_ADDR_DATA_LSB
VEML6070_ADDR_DATA_MSB
// VEML6070 command register bits
#define VEML6070_CMD_SD
#define VEML6070_CMD_WDM
#define VEML6070_CMD_IT_0_5T
#define VEML6070_CMD_IT_1T
#define VEML6070_CMD_IT_2T
#define VEML6070_CMD_IT_4T
#define VEML6070_CMD_DEFAULT
VEML6070_CMD_IT_1T)
(0x18 >> 1)
(0x70 >> 1)
(0x71 >> 1)
(0x73 >> 1)
0x01
0x02
0x00
0x04
0x08
0x0C
(VEML6070_CMD_WDM |
type enum {LOW, MODERATE, HIGH, VERY_HIGH, EXTREME} RISK_LEVEL;
BYTE cmd = VEML6070_CMD_DEFAULT;
WORD uvs_step;
RISK_LEVEL risk_level;
struct i2c_msg {
WORD addr;
WORD flags;
#define I2C_M_TEN
#define I2C_M_RD
#define I2C_M_NOSTART
#define I2C_M_REV_DIR_ADDR
#define I2C_M_IGNORE_NAK
#define I2C_M_NO_RD_ACK
#define I2C_M_RECV_LEN
WORD len;
BYTE *buf;
};
0x0010
0x0001
0x4000
0x2000
0x1000
0x0800
0x0400
extern int i2c_transfer(struct i2c_msg *msgs, int num);
// Loop for polling VEML6070 data
while (1)
Revision: 07-Jan-16
Document Number: 84310
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
//---------------------------------------------------------------------------// C main function
//---------------------------------------------------------------------------void main(void)
{
initialize_VEML6070();
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
{
uvs_step = read_uvs_step();
risk_level = convert_to_risk_level(uvs_step);
delay(1000);
}
}
void initialize_VEML6070(void)
{
// Read ARA to clear interrupt
BYTE address;
VEML6070_read_byte(VEML6070_ADDR_ARA, &address);
// Initialize command register
VEML6070_write_byte(VEML6070_ADDR_CMD, cmd);
delay(200);
}
void enable_sensor(void)
{
cmd &= ~VEML6070_CMD_SD;
VEML6070_write_byte(VEML6070_ADDR_CMD, cmd);
}
void disable_sensor(void)
{
cmd |= VEML6070_CMD_SD;
VEML6070_write_byte(VEML6070_ADDR_CMD, cmd);
}
WORD read_uvs_step(void)
{
BYTE lsb, msb;
WORD data;
VEML6070_read_byte(VEML6070_ADDR_DATA_MSB, &msb);
VEML6070_read_byte(VEML6070_ADDR_DATA_LSB, &lsb);
return data;
}
RISK_LEVEL convert_to_risk_level(WORD uvs_step)
{
WORD risk_level_mapping_table[4] = {2241, 4482, 5976, 8217};
Revision: 07-Jan-16
Document Number: 84310
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
data = ((WORD)msb << 8) | (WORD)lsb;
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
WORD i;
for (i = 0; i < 4; i++)
{
if (uvs_step <= risk_level_mapping_table[i])
{
break;
}
}
return (RISK_LEVEL)i;
}
int VEML6070_read_byte(WORD addr, BYTE *data)
{
int err = 0;
int retry = 3;
struct i2c_msg msg;
// Read byte data
msg.addr = addr;
msg.flags = I2C_M_RD;
msg.len = 1;
msg.buf = data;
while (retry--)
{
}
err = i2c_transfer(msg, 1);
if (err >= 0)
return err;
return err;
}
int VEML6070_write_byte(WORD addr, BYTE data)
{
int err = 0;
int retry = 3;
struct i2c_msg msg;
// Send slave address & command
msg.addr = addr;
msg.flags = I2C_M_WR;
msg.len = 1;
msg.buf = &data;
err = i2c_transfer(msg, 1);
if (err >= 0)
return 0;}
return err;
}
Revision: 07-Jan-16
Document Number: 84310
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
while (retry--)
{
Application Note
www.vishay.com
Vishay Semiconductors
Designing the VEML6070 UV Light Sensor
into Applications
THE VEML6070’S ACK SIGNAL
The VEML6070 features a function for sending an acknowledge signal (ACK) to the microcontroller when the UV value changes
are bigger than one of two pre-programmable step sizes: ACK_THD. The purpose of the ACK signal is similar to an interrupt
feature, which informs the μC once the sensed data level goes below or beyond the interrupt threshold setting. The ACK
threshold values are 102 steps and 145 steps.
0x70, bit 5
ACK
0: disabled
1: enabled
0x70, bit 4
ACK_THD
0: 102 steps
1: 145 steps
There are two methods for driving acknowledge conditions and read / write commands to the VEML6070:
1. If the host implements the INT function, it performs a modified received byte operation to disengage the VEML6070’s
acknowledge signal and acknowledge alert response address (ARA), 0x18 (hex). A command format for responses to an
ARA looks like this:
S
ARA (0x18)
Rd
A
UVS Slave Address
A
P
2. If the host does not implement this feature, it should periodically access the ARA or read ARA before setting each
read / write command.
For the hardware circuit design, this pin should be connected to an INT pin or GPIO pin of the MCU. The threshold ACK_THD
definition is based on the sensitivity setting of the VEML6070.
The ACK or UVI interrupt function allows the UVI sensing system to perform data polling based on the interrupt event. The
system sensor manager does not need to do continual data polling and this significantly reduces the MCU loading. The ACK
signal can also be used as a trigger event for popping up a warning UVI message.
Document Number: 84310
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
Revision: 07-Jan-16
Similar pages