CircuitPython library to support VEML6070 UV Index sensor.

  • Author(s): Limor Fried & Michael Schroeder

Implementation Notes


Software and Dependencies:


  1. Datasheet:

class adafruit_veml6070.VEML6070(i2c_bus: I2C, _veml6070_it: str = 'VEML6070_1_T', ack: bool = False)[source]

Driver base for the VEML6070 UV Light Sensor

  • i2c_bus (I2C) – The I2C bus the device is connected to

  • _veml6070_it (str) – The integration time you’d like to set initially. Available options: VEML6070_HALF_T, VEML6070_1_T, VEML6070_2_T, and VEML6070_4_T. The higher the ‘_x_’ value, the more accurate the reading is (at the cost of less samples per reading). Defaults to VEML6070_1_T if parameter not passed. To change setting after initialization, VEML6070.set_integration_time(new_it).

  • ack (bool) – The initial setting of ACKnowledge on alert. Defaults to False if parameter not passed. To change setting after initialization, use VEML6070.set_ack(new_ack).

Quickstart: Importing and using the device VEML6070

Here is an example of using the VEML6070 class. First you will need to import the libraries to use the sensor

import board
import adafruit_veml6070

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
uv = adafruit_veml6070.VEML6070(i2c)

Now you have access to the uv_raw attribute and the calculate the risk level

uv_raw = uv.uv_raw
risk_level = uv.get_index(uv_raw)
property ack: int

Turns on or off the ACKnowledge function of the sensor. The ACK function will send a signal to the host when the value of the sensed UV light changes beyond the programmed threshold.

property ack_threshold: int

The ACKnowledge Threshold, which alerts the host controller to value changes greater than the threshold. Available settings are: 0 = 102 steps; 1 = 145 steps. 0 is the default setting.

get_index(_raw: int) str[source]

Calculates the UV Risk Level based on the captured UV reading. Requires the _raw argument (from veml6070.uv_raw()). Risk level is available for Integration Times (IT) 1, 2, & 4. The result is automatically scaled to the current IT setting.


UV Index











property integration_time: str

The Integration Time of the sensor, which is the refresh interval of the sensor. The higher the refresh interval, the more accurate the reading is (at the cost of less sampling). The available settings are: VEML6070_HALF_T, VEML6070_1_T, VEML6070_2_T, VEML6070_4_T.

sleep() None[source]

Puts the VEML6070 into sleep (‘shutdown’) mode. Datasheet claims a current draw of 1uA while in shutdown.

property uv_raw: int

Reads and returns the value of the UV intensity.

wake() None[source]

Wakes the VEML6070 from sleep. VEML6070.uv_raw will also wake from sleep.