Home Circuitpython Adafruit Feather M0 and VEML6070 ultraviolet light sensor circuitpython example

Adafruit Feather M0 and VEML6070 ultraviolet light sensor circuitpython example

by shedboy71

In this example we connect a VEML6070 ultraviolet light sensor to an Adafruit Feather M0 running Circuitpython

First lets look at some information about the sensor from the manufacturers datasheet

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.

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 anexcellent temperature compensation and a robust refresh rate setting that does not use an external RC low pass filter.

The 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 beless than 1 μA. VEML6070’s operating voltage ranges from 2.7 V to 5.5 V


Integrated modules: ultraviolet sensor (UV), andsignal conditioning IC
Converts solar UV light intensity to digital data
Excellent UV sensitivity and linearity via FiltronTM technology
Excellent performance of UV radiation measurement under long time solar UV exposure
Excellent temperature compensation
High dynamic detection resolution
Standard I2C protocol interface
Support acknowledge feature (ACK)
Immunity on fluorescent light flicker software shutdown mode control
Temperature compensation: -40 °C to +85 °C
Output type: I2C bus
Operation voltage: 2.7 V to 5.5 V

Note : according to the manufacturer this is not recommended for new designs but no issues for hobbyists as it is a very capable sensor

This is the sensor I bought

Parts Required


Name Link
Adafruit Feather M0 Express Adafruit (PID 3403) Feather M0 Express – Designed for CircuitPython – ATSAMD21 Cortex M0
VEML6070 VEML6070 UV UV light sensor
Connecting cables Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire



feather and veml6070 layout

feather and veml6070 layout

Code Example

I used Mu for development

The following is based on a library , I copied the VEML6070 library to the lib folder on my Feather M0 Express – https://circuitpython.org/libraries

# VEML6070 Driver Example Code
import time
import busio
import board
import adafruit_veml6070
with busio.I2C(board.SCL, board.SDA) as i2c:
    uv = adafruit_veml6070.VEML6070(i2c)
    # Alternative constructors with parameters
    # uv = adafruit_veml6070.VEML6070(i2c, 'VEML6070_1_T')
    # uv = adafruit_veml6070.VEML6070(i2c, 'VEML6070_HALF_T', True)
    # take 10 readings
    for j in range(10):
        uv_raw = uv.uv_raw
        risk_level = uv.get_index(uv_raw)
        print("Reading: {0} | Risk Level: {1}".format(uv_raw, risk_level))


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

Reading: 0 | Risk Level: LOW
Reading: 0 | Risk Level: LOW
Reading: 3 | Risk Level: LOW
Reading: 2 | Risk Level: LOW
Reading: 2 | Risk Level: LOW







You may also like

1 comment

Leave a Comment