Categories

Follow Us

VEML6070 ultraviolet light sensor and Arduino example

In this example we look at an VEML6070 UV sensor and connect it to an Arduino UNO

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. 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.

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.

You can find out about the UV index at the following link – https://en.wikipedia.org/wiki/Ultraviolet_index

This is the key chart from this site and one of the reasons that a UV index meter is so important

UV Index Media graphic color Risk of harm from unprotected sun exposure, for the average adult Recommended protection
0.0–2.9 Green “Low” A UV Index reading of 0 to 2 means low danger from the sun’s UV rays for the average person.Wear sunglasses on bright days. If you burn easily, cover up and use broad spectrum SPF 30+ sunscreen. Bright surfaces, such as sand, water and snow, will increase UV exposure.
3.0–5.9 Yellow “Moderate” A UV Index reading of 3 to 5 means moderate risk of harm from unprotected sun exposure.Stay in shade near midday when the sun is strongest. If outdoors, wear sun protective clothing, a wide-brimmed hat, and UV-blocking sunglasses. Generously apply broad spectrum SPF 30+ sunscreen every 2 hours, even on cloudy days, and after swimming or sweating. Bright surfaces, such as sand, water and snow, will increase UV exposure.
6.0–7.9 Orange “High” A UV Index reading of 6 to 7 means high risk of harm from unprotected sun exposure. Protection against skin and eye damage is needed.Reduce time in the sun between 10 a.m. and 4 p.m. If outdoors, seek shade and wear sun protective clothing, a wide-brimmed hat, and UV-blocking sunglasses. Generously apply broad spectrum SPF 30+ sunscreen every 2 hours, even on cloudy days, and after swimming or sweating. Bright surfaces, such as sand, water and snow, will increase UV exposure.
8.0–10.9 Red “Very high” A UV Index reading of 8 to 10 means very high risk of harm from unprotected sun exposure. Take extra precautions because unprotected skin and eyes will be damaged and can burn quickly.Minimize sun exposure between 10 a.m. and 4 p.m. If outdoors, seek shade and wear sun protective clothing, a wide-brimmed hat, and UV-blocking sunglasses. Generously apply broad spectrum SPF 30+ sunscreen every 2 hours, even on cloudy days, and after swimming or sweating. Bright surfaces, such as sand, water and snow, will increase UV exposure.
11.0+ Violet “Extreme” A UV Index reading of 11 or more means extreme risk of harm from unprotected sun exposure. Take all precautions because unprotected skin and eyes can burn in minutes.Try to avoid sun exposure between 10 a.m. and 4 p.m. If outdoors, seek shade and wear sun protective clothing, a wide-brimmed hat, and UV-blocking sunglasses. Generously apply broad spectrum SPF 30+ sunscreen every 2 hours, even on cloudy days, and after swimming or sweating. Bright surfaces, such as sand, water and snow, will increase UV exposure.

The easiest way to work with this sensor is to buy a module – this is a picture of the module that I bought

Connection

An I2C device so easy to get connected to an Arduino

arduino and veml6070

arduino and veml6070

Code

I used the Adafruit library – https://github.com/adafruit/Adafruit_VEML6070

#include <Wire.h>
#include "Adafruit_VEML6070.h"
 
Adafruit_VEML6070 uv = Adafruit_VEML6070();
 
void setup() 
{
  Serial.begin(9600);
  Serial.println("VEML6070 Test");
  uv.begin(VEML6070_1_T);  // pass in the integration time constant
}
 
 
void loop() 
{
  Serial.print("UV light level: "); 
  Serial.println(uv.readUV());
  delay(1000);
}

Output

Open the serial monitor – just as a note in my example I was indoors – hence the UV value was 0

VEML6070 Test
UV light level: 0
UV light level: 0
UV light level: 0
UV light level: 0

 

Link

You can pick up one of these sensors for about $2.50

UV sensor module VEML6070 UV Sensitivity Detection Sensor for Arduino

Share

Arduino and TEMT6000 light sensor

TEMT6000X01 ambient light sensor is a silicon NPN epitaxial planar phototransistor in a miniature transparent 1206 package for surface mounting. It is sensitive to visible light much like the human eye and has peak sensitivity at 570 nm.

Here is a picture of a module

 

Here is a schematic of the module

APPLICATIONS

Ambient light sensor for control of display backlight dimming in LCD displays and keypad backlighting of mobile devices and in industrial on/off-lighting operation.

• Automotive sensors
• Mobile phones
• Notebook computers
• PDA’s
• Cameras
• Dashboards

 

Connection

 

arduino and TEMT6000

arduino and TEMT6000

 

Code

 

#define LIGHTSENSORPIN A1 //Ambient light sensor reading
 
void setup() 
{
pinMode(LIGHTSENSORPIN, INPUT); 
Serial.begin(9600);
}
 
void loop() 
{
float reading = analogRead(LIGHTSENSORPIN); //Read light level
float square_ratio = reading / 1023.0; //Get percent of maximum value (1023)
square_ratio = pow(square_ratio, 2.0); 
Serial.println(reading); 
delay(1000); 
}

 

Output

Open the serial monitor and you should see something like this

41.00
42.00
4.00
1.00
21.00
38.00
41.00
41.00
40.00

 

Links

TEMT6000 Light Sensor

https://www.vishay.com/docs/81579/temt6000.pdf

Share

GA1A12S202 light sensor example

In this example we will connect a GA1A12S202 Log-Scale Analog Light Sensor to an Arduino.

The features of this sensor are as follows

Output voltage increases with light on the sensor
Logarithmic response not only gives more sensitivity in low light, its also almost impossible to “max-out” the sensor
Dynamic range of 3 to 55,000 Lux
Use indoors and outdoors without needing to recalibrate!

Again these are typically best used in breakout/module form. Here is a picture of the module

You connect the sensor as follows

Vcc – 5v
Gnd – Gnd
Out – A0 (or you can use another analog in pin but you would need to change the code example)

Code

This uses a library – https://github.com/arduinolearning/Arduino-Libraries/tree/master/GA1A12S202

#include "GA1A12S202.h"
 
GA1A12S202 luxValue(A0);
 
void setup() 
{
    Serial.begin(9600);
    delay(2000);
}
 
void loop() 
{
    Serial.print("Raw value = ");
    Serial.print(luxValue.getRaw());
	Serial.println();
    Serial.print("Lux value = ");
    Serial.println(luxValue.getLux());
	Serial.println();
    delay(1000);
}

 

Results

Open the Serial monitor and you should something like this

Raw value = 315
Lux value = 2.42

Raw value = 314
Lux value = 2.42

Raw value = 27
Lux value = 1.09

Raw value = 28
Lux value = 1.08

Raw value = 339
Lux value = 2.61

Raw value = 338
Lux value = 2.59

 

Links
Adafruit GA1A12S202 Log-scale Analog Light Sensor [ADA1384]

Share