In this example we look at an VEML6070 UV sensor and connect it to an Arduino Due
Lets take a look at the sensor first
The VEML6070 is an advanced ultraviolet (UV) light sensor with I2C protocol interface and designed by the CMOS process. It is easily operated via a simple I2C command. The active acknowledge (ACK) feature with threshold windows setting allows the UV sensor to send out a UVI alert message. Under a strong solar UVI condition, the smart ACK signal can be easily implemented by the software programming. VEML6070 incorporates a photodiode, amplifiers, and analog / digital circuits into a single chip. 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.
VEML6070 has linear sensitivity to solar UV light and is easily adjusted by an external resistor. Software shutdown mode is provided, which reduces power consumption to be less than 1 μA. VEML6070’s operating voltage ranges from 2.7 V to 5.5 V.
You can find out about the UV index at the following link – https://en.wikipedia.org/wiki/Ultraviolet_index
The easiest way to work with this sensor is to buy a module – this is a picture of the module that I bought
Layout
Code
I used the Adafruit library – https://github.com/adafruit/Adafruit_VEML6070
[codesyntax lang=”cpp”]
#include <Wire.h> #include "Adafruit_VEML6070.h" Adafruit_VEML6070 uv = Adafruit_VEML6070(); void setup() { Serial.begin(9600); Serial.println("VEML6070 Test"); uv.begin(VEML6070_1_T); // pass in the integration time constant } void loop() { Serial.print("UV light level: "); Serial.println(uv.readUV()); delay(1000); }
[/codesyntax]
Output
Open the serial monitor – just as a note in my example I was indoors
VEML6070 Test
UV light level: 0
UV light level: 0
UV light level: 0
UV light level: 0
UV light level: 0
UV light level: 0
Link
You can pick up one of these sensors for about $2.50
UV sensor module VEML6070 UV Sensitivity Detection Sensor for Arduino