Introduction

This is a UV sensor module based on Vishay VEML6075 sensor, adopting individual UVA and UVB channel solution with 16-bit resolution. It can convert solar UV light intensity to digital data to provide an accurate measure of the signal strength.

VEML6075 UV sensor can give a reliable performance of UV radiation measurement under long time solar UV exposure. Furthermore, the sensor provides excellent temperature compensation capability within -40℃ to +85℃. VEML6075 features, low power consumption, and its minimum power can be as low as 800nA in shut-down mode. The operating voltage of the sensor ranges from 3.3V to 5V. It adopts IIC protocol, which can work well with any microcontroller that supports IIC.

Compatible with Arduino and Raspberry Pi, this sensor can be used in portable electronic product, wearable device, weather station, flame detecting and so on. We have related Arduino and Python library for your reference, and provide you with a Gravity connector to enable you to use the sensor without soldering.

Application

Ultraviolet tester, outdoor UV detector, bactericidal lamp

Specification

warning_yellow.png NOTE: to get more accurate measurement, the sensor should direct to ultraviolet light source.

Pinout

Pinout

Num Label Description
1 SDA Serial Data Line
2 SCL Serial Clock Line
3 GND Ground
4 VCC DC 3.3V~5.5V

Tutorial (Arduino)

Connect the sensor with Arduino UNO via I2C interface as shown below:

Connection Arduino

Arduino Example Code

Click to download DFRobot_VEML6075 Library file, about how to install the library?

/*!
 *  file VEML6075SimpleTest.ino
 *  simple test for VEML6075
 *  Print UVA index, UVB index and UV index on the serial monitor
 *
 *  Copyright    [DFRobot](https://www.dfrobot.com), 2018
 *  Copyright    GNU Lesser General Public License
 *  version  V1.0
 *  date  2018-12-18
 */

#include <Wire.h>
#include <DFRobot_VEML6075.h>

#define VEML6075_ADDR   0x10

DFRobot_VEML6075_IIC VEML6075(&Wire, VEML6075_ADDR);  // create object

void setup()
{
  Serial.begin(115200);
  delay(2000);
  while(!Serial);

  Serial.println();
  while(VEML6075.begin() != true) {
    Serial.println("VEML6075 begin faild");
    delay(2000);
  }
  Serial.println("VEML6075 begin successed");
}

void loop()
{
  uint16_t    UvaRaw = VEML6075.readUvaRaw();         // read UVA raw
  uint16_t    UvbRaw = VEML6075.readUvbRaw();         // read UVB raw
  uint16_t    comp1Raw = VEML6075.readUvComp1Raw();   // read COMP1 raw
  uint16_t    comp2Raw = VEML6075.readUvComp2Raw();   // read COMP2 raw

  float       Uva = VEML6075.getUva();                // get UVA
  float       Uvb = VEML6075.getUvb();                // get UVB
  float       Uvi = VEML6075.getUvi(Uva, Uvb);        // get UV index

  Serial.println();
  Serial.println("======== start print ========");
  Serial.print("UVA raw:    ");
  Serial.println(UvaRaw);
  Serial.print("UVB raw:    ");
  Serial.println(UvbRaw);
  Serial.print("COMP1 raw:  ");
  Serial.println(comp1Raw);
  Serial.print("COMP2 raw:  ");
  Serial.println(comp2Raw);
  Serial.print("UVA:        ");
  Serial.println(Uva, 2);
  Serial.print("UVB:        ");
  Serial.println(Uvb, 2);
  Serial.print("UVIndex:    ");
  Serial.print(Uvi, 2);
  if(Uvi < UVI_LOW)
    Serial.println("  UVI low");
  else if(Uvi < UVI_MODERATE)
    Serial.println("  UVI moderate");
  else if(Uvi < UVI_HIGH)
    Serial.println("  UVI high");
  else if(Uvi < UVI_VERY_HIGH)
    Serial.println("  UVI very high");
  else
    Serial.println("  UVI extreme");
  Serial.print("mw/cm^2:    ");
  Serial.println(Uvi2mwpcm2(Uvi), 2);
  Serial.println("======== end print ========");
  delay(1000);
}

Result

Hold the UV sensor towards the ultraviolet light source, open Arduino serial port monitor, band rate 115200.

Serial port monitor

Tutorial (Raspberry Pi)

Connect the sensor to Raspberry Pi 3B+ as shown below.

Connection Raspberry Pi

Run example codes on Raspberry Pi

Click to download DFRobot_VEML6075 Library file to your Raspberry Pi, and run the code with the reference of following commands. Please confirm that the I2C of Raspberry Pi is enabled.

Enter the directory of Raspberry Pi example codes

cd /DFRobot_VEML6075-master/raspberry/examples

Run Raspberry Pi example codes

 python DFRobot_VEML6075_demo.py

DFRobot_VEML6075_demo.py Sample Code

# -*- coding: utf-8 -*-

'''
 *  file DFRobot_VEML6075_demo.py
 *  normal test for VEML6075
 *  UVA index, UVB index and UV index will print on terminal
 *
 *  Copyright    [DFRobot](https://www.dfrobot.com), 2018
 *  Copyright    GNU Lesser General Public License
 *  version  V1.0
 *  date  2018-12-18
'''

import time
import sys
sys.path.append("..")

from DFRobot_VEML6075 import DFRobot_VEML6075

if __name__ == '__main__':

  VEML6075 = DFRobot_VEML6075(1, 0x10)  # use i2c bus 1, module address is 0x10

  while VEML6075.begin() != True:
    print("VEML6075 begin faild")
    time.sleep(2)
  print("VEML6075 begin succeed")

  while True:
    Uva = VEML6075.getUva()          # get UVA
    Uvb = VEML6075.getUvb()          # get UVB
    Uvi = VEML6075.getUvi(Uva, Uvb)  # get UVI
    print("")
    print("======== start print ========")
    print("UVA:     %.2f" %(Uva))
    print("UVB:     %.2f" %(Uvb))
    print("UVA:     %.2f" %(Uvi))
    print("mw/cm^2: %.2f" %(VEML6075.Uvi2mwpcm2(Uvi)))
    print("======== end print =========")
    time.sleep(1)

Read UV data on Raspberry Pi

Result on Raspberry Pi

Product Size

Dimension

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum

More Documents

DFshopping_car1.png Get Gravity_VEML6075_UV_Sensor_Module from DFRobot Store or DFRobot Distributor.

Turn to the Top