DIY - UV Light Sensor
Requirements
Aims of the station
In this station, we use a UV light sensor to measure the intensity of UV light in microwatts per square centimeter (μW / cm²). Then we want to convert the value into the UV index.
Materials
- UV-light sensor
VEML6070
Basics
Ultraviolet (UV) light is invisible electromagnetic radiation to humans with a wavelength shorter than visible light but longer than that of X-rays. UV light covers the wavelengths from 100 nm to 380 nm. Because of the absorption in the earth's atmosphere - especially in the ozone layer - only little UV-B radiation (100 - 300 nm) penetrates to the earth's surface. UV-A radiation (300 - 380 nm), which is less harmful to human skin, is less absorbed by the atmosphere.t. UV light intensity is measured in microwatts per square centimeter (μW / cm²). Our sensor measures in the range of approx. 300 - 400 nm, so it absorbs only UV-A radiation (for more details see the Datasheet)).Ultraviolet light
Construction
Connect the sensor to the senseBoxMCU as shown in the graphic.
Programming
#include "SenseBoxMCU.h"
VEML6070 vml;
In the setup()-function
setup()
-function the sensor now should be started:void setup(){
vml.begin();
}
In the loop()-function
loop()
-function, we can use the getIlluminance()
command to get the current measured light intensity:void loop(){
vml.getUvIntensity();
}
Since the UV-Index is often used in everyday life, we now want to write a method that converts the measured value into a UV index:Transformation to UV-Index
/*
* getUVI()
* expects the knife of the UV sensor as an input parameter
* and returns the corresponding value on the UV index
*/
float getUVI(int uv) {
float refVal = 0.4; // Reference value: 0.01 W / m 2 is equivalent to 0.4 as UV index
float uvi = refVal * (uv * 5.625) / 1000;
return uvi;
}
Exercise
In the serial monitor, try using the Exercise 1
getUVI ()
-function to print out the UV index.