In this example we connect a VEML6075 ultraviolet light sensor to an Adafruit Feather M0 running Circuitpython
First lets look at some information about the sensor from the manufacturers datasheet
The VEML6075 senses UVA and UVB light and incorporates photodiode, amplifiers, and analog / digital circuits into a single chip using a CMOS process.
When the UV sensor is applied, it is able to detect UVA and UVB intensity to provide a measure of the signal strength as well as allowing for UVI measurement.
The VEML6075 provides excellent temperature compensation capability for keeping the output stable under changing temperature. VEML6075’s functionality is easily operated via the simple command format of I2C (SMBus compatible) interface protocol. VEML6075’s operating voltage ranges from 1.7 V to 3.6 V.
Integrated modules: ultraviolet sensor (UV), and signal conditioning IC
Converts solar UV light intensity to digital data
Excellent UVA and UVB sensitivity
Reliable performance of UV radiation measurement under long time solar UV exposure
16-bit resolution per channel
UVA and UVB individual channel solution
Low power consumption I2C protocol (SMBus compatible) interface
Temperature compensation: -40 °C to +85 °C
Output type: I2C bus
Operation voltage: 1.7 V to 3.6 V
This is the sensor I bought
|Adafruit Feather M0 Express||Adafruit (PID 3403) Feather M0 Express – Designed for CircuitPython – ATSAMD21 Cortex M0|
|VEML6075||VEML6075 UVA UVB Solar Ultraviolet Light Intensity Sensor|
|Connecting cables||Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire|
I used Mu for development
The following is based on a library , I copied the VEML6075 library to the lib folder on my Feather M0 Express – https://circuitpython.org/libraries
import time import board import busio import adafruit_veml6075 i2c = busio.I2C(board.SCL, board.SDA) veml = adafruit_veml6075.VEML6075(i2c, integration_time=100) print("Integration time: %d ms" % veml.integration_time) while True: print(veml.uv_index) time.sleep(1)
Here is what I saw in Mu REPL window, being indoors its tricky get a change in reading but I did put in near a window to get different readings
Integration time: 100 ms