Electronics

Light UV Ultraviolet Ray Detection Sensor GY-VEML6070

AED 54.60

Low stock
1

Description

The VEML6070 is an advanced ultraviolet (UV) light sensor with an I2C protocol interface and designed by the CMOS process. It is easily operated via a simple I2C command. The active acknowledge (ACK) feature with a 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 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.

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

Layout

Let's look at how you connect the sensor to your Raspberry Pi this pinout of the Adafruit version just Look out for this version pinout.

An I2C device that just needs 3.3v and GND as well, so its pretty simple to connect to your Raspberry PI, the layout below shows a Raspberry PI 3 but you can use others as well



Parts List

Here is a parts list generated from the fritzing layout above. The sensor costs about $3

AmountPart TypeProperties
1VEML6070GY-VEML6070 UV UV light sensor VEML6070
1Raspberry Pi 3Raspberry Pi 3 Model B Board 1GB LPDDR2 BCM2837 Quad-Core

Code Example

This is a python example

# Distributed with a free-will license.
# Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
# VEML6070
# This code is designed to work with the VEML6070_I2CS I2C Mini Module available from ControlEverything.com.
# https://www.controleverything.com/products
 
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 VEML6070_CMD_READ_MSB(0x73) and VEML6070_CMD_READ_LSB(0x71), uvlight MSB, uvlight LSB"""
data0 = bus.read_byte(VEML6070_CMD_READ_MSB)
data1 = bus.read_byte(VEML6070_CMD_READ_LSB)
 
# Convert the data
uvlight = data0 * 256 + data1
 
return {'u' : uvlight}
 
from VEML6070 import VEML6070
veml6070 = VEML6070()
 
while True:
light = veml6070.read_uvlight()
print "UV Light Level : %d" %(light['u'])
print " *********************************** "
time.sleep(0.5)

copy it to your Raspberry PI, open a terminal and run

sudo python VEML6070.py

Output

You should see something like this, I tested this indoors