Connection Layout
Below is the pinout layout of the Adafruit VEML6070 module connected to a Raspberry Pi (shown with Raspberry Pi 3, but compatible with other models). The sensor requires only 3.3V and GND connections along with the I2C lines, making it simple to integrate.

Parts List
Amount |
Part Type |
Properties |
1 |
VEML6070 |
GY-VEML6070 UV light sensor module |
1 |
Raspberry Pi 3 |
Raspberry Pi 3 Model B Board 1GB LPDDR2 BCM2837 Quad-Core |
Python Code Example
This example code reads UV light values from the VEML6070 sensor over I2C and prints the readings to the terminal. It is designed to work with the VEML6070_I2CS I2C Mini Module.
import smbus
import time
# Get I2C bus
bus = smbus.SMBus(1)
# I2C address of the device
VEML6070_DEFAULT_ADDRESS = 0x38
# VEML6070 Command Set
VEML6070_CMD_ACK_DISABLE = 0x00 # Acknowledge Disable
VEML6070_CMD_ACK_ENABLE = 0x20 # Acknowledge Enable
VEML6070_CMD_ACK_THD_102 = 0x00 # Acknowledge threshold 102 Steps
VEML6070_CMD_ACK_THD_145 = 0x10 # Acknowledge threshold 145 Steps
VEML6070_CMD_IT_1_2T = 0x00 # Integration time = 1/2T
VEML6070_CMD_IT_1T = 0x04 # Integration time = 1T
VEML6070_CMD_IT_2T = 0x08 # Integration time = 2T
VEML6070_CMD_IT_4T = 0x0C # Integration time = 4T
VEML6070_CMD_RESERVED = 0x02 # Reserved, Set to 1
VEML6070_CMD_SD_DISABLE = 0x00 # Shut-down Disable
VEML6070_CMD_SD_ENABLE = 0x01 # Shut-down Enable
VEML6070_CMD_READ_LSB = 0x38 # Read LSB of the data
VEML6070_CMD_READ_MSB = 0x39 # Read MSB of the data
class VEML6070():
def __init__(self):
self.write_command()
def write_command(self):
"""Select the UV light command from the given provided values"""
COMMAND_CONFIG = (VEML6070_CMD_ACK_DISABLE | VEML6070_CMD_IT_1_2T | VEML6070_CMD_SD_DISABLE | VEML6070_CMD_RESERVED)
bus.write_byte(VEML6070_DEFAULT_ADDRESS, COMMAND_CONFIG)
def read_uvlight(self):
"""Read data back from the sensor MSB and LSB"""
data0 = bus.read_byte(VEML6070_CMD_READ_MSB)
data1 = bus.read_byte(VEML6070_CMD_READ_LSB)
uvlight = data0 * 256 + data1
return {'u': uvlight}
veml6070 = VEML6070()
while True:
light = veml6070.read_uvlight()
print("UV Light Level : %d" % (light['u']))
print("***********************************")
time.sleep(0.5)
To run this code on your Raspberry Pi, save it as VEML6070.py
, then open a terminal and run:
sudo python VEML6070.py
Sample Output
Here is an example output captured indoors:

Connection Layout
Below is the pinout layout of the Adafruit VEML6070 module connected to a Raspberry Pi (shown with Raspberry Pi 3, but compatible with other models). The sensor requires only 3.3V and GND connections along with the I2C lines, making it simple to integrate.

Parts List
Amount |
Part Type |
Properties |
1 |
VEML6070 |
GY-VEML6070 UV light sensor module |
1 |
Raspberry Pi 3 |
Raspberry Pi 3 Model B Board 1GB LPDDR2 BCM2837 Quad-Core |
Python Code Example
This example code reads UV light values from the VEML6070 sensor over I2C and prints the readings to the terminal. It is designed to work with the VEML6070_I2CS I2C Mini Module.
import smbus
import time
# Get I2C bus
bus = smbus.SMBus(1)
# I2C address of the device
VEML6070_DEFAULT_ADDRESS = 0x38
# VEML6070 Command Set
VEML6070_CMD_ACK_DISABLE = 0x00 # Acknowledge Disable
VEML6070_CMD_ACK_ENABLE = 0x20 # Acknowledge Enable
VEML6070_CMD_ACK_THD_102 = 0x00 # Acknowledge threshold 102 Steps
VEML6070_CMD_ACK_THD_145 = 0x10 # Acknowledge threshold 145 Steps
VEML6070_CMD_IT_1_2T = 0x00 # Integration time = 1/2T
VEML6070_CMD_IT_1T = 0x04 # Integration time = 1T
VEML6070_CMD_IT_2T = 0x08 # Integration time = 2T
VEML6070_CMD_IT_4T = 0x0C # Integration time = 4T
VEML6070_CMD_RESERVED = 0x02 # Reserved, Set to 1
VEML6070_CMD_SD_DISABLE = 0x00 # Shut-down Disable
VEML6070_CMD_SD_ENABLE = 0x01 # Shut-down Enable
VEML6070_CMD_READ_LSB = 0x38 # Read LSB of the data
VEML6070_CMD_READ_MSB = 0x39 # Read MSB of the data
class VEML6070():
def __init__(self):
self.write_command()
def write_command(self):
"""Select the UV light command from the given provided values"""
COMMAND_CONFIG = (VEML6070_CMD_ACK_DISABLE | VEML6070_CMD_IT_1_2T | VEML6070_CMD_SD_DISABLE | VEML6070_CMD_RESERVED)
bus.write_byte(VEML6070_DEFAULT_ADDRESS, COMMAND_CONFIG)
def read_uvlight(self):
"""Read data back from the sensor MSB and LSB"""
data0 = bus.read_byte(VEML6070_CMD_READ_MSB)
data1 = bus.read_byte(VEML6070_CMD_READ_LSB)
uvlight = data0 * 256 + data1
return {'u': uvlight}
veml6070 = VEML6070()
while True:
light = veml6070.read_uvlight()
print("UV Light Level : %d" % (light['u']))
print("***********************************")
time.sleep(0.5)
To run this code on your Raspberry Pi, save it as VEML6070.py
, then open a terminal and run:
sudo python VEML6070.py
Sample Output
Here is an example output captured indoors:
