In this tutorial, we are going to build a UV Index meter using Arduino. 

Hardware Required

Software Required

The Sun is the closest star located to us about 150 million kilometers from the earth. It provides both heat and light which are essential to all human survival on the earth. 

The Sun emits a broad spectrum of light. The lower end of the spectrum includes infrared light, the middle includes the visible light which we can see with the naked eye and the higher end of the spectrum includes ultraviolet light. 

But the Ultraviolet light is blocked by the ozone layer which covers the earth but it is not blocked fully. The Human skin can withstand low exposure to UV rays just fine and it will darken the pigmentation in skin. But long exposure to UV rays is very harmful for the skin. It can cause various health problems like burns on the skin to skin cancer. 

The above chart shows the electromagnetic spectrum of waves. The waves with the highest wavelengths are the radio waves followed by micro waves. The waves just above the visible light spectrum is the infrared waves. They emit a frequency lower than that of red light. The oxidizing rays are the ultraviolet rays. UV rays have a frequency higher than that of violet color. 

Furthermore, the UV rays can also be divided into smaller groups as shown below. 

The UV rays extend from 400 nm to 100 nm in wavelength. These are divided into 3 more groups. 



  • UVA range: This range lasts from 400 nm to 315 nm. These lights are called black lights and they are used during light effects. The waves in these wavelengths are not absorbed by the ozone layer. 
  • UVB range: This range lasts from 315 nm to 280 nm. These are the lights which are used in applications like tanning booths. These wavelength rays are mostly absorbed by the ozone layer but some still get through. 
  • UVC range: This range lasts from 280 nm to 100 nm. This is used in cleaning and sterilization processes. It is very high energy so it will kill the bacteria. It is completely absorbed by the ozone layer and none of it passed through the layer

UV Index

The UV Index was adopted and standardized by the World Health Organization in the 1994. The scale of the Index is a linear scale. In most of the world, the scale exists from 1 to 10 as there is not much UV radiation. But in the tropical areas, the UV Index can exceed values of 12. And on top of certain mountains, the values of UV index can easily reach to 20. 

UV Sensor GY-1145



  • The Sensor GY-1145 is a calibrated UV Sensor which can calculate and output the UV index. It uses I2C communication protocol for interfacing so it can easily be used with Arduino devices. This sensor can detect just about any light and can also be used as a proximity sensor just in case. 

  • This sensor does not detect UV light but it rather sense the visible and IR light and then uses a formula to calculate the UV index. It provides precision upto two decimal points. 

  • It has 4 pins. VCC and GND for power supply and SCL and SDA for data transfer via the I2C bus. 


  • Let us now interface it with Arduino board. As you can see in the image below there are not much connections to do here. 

Arduino Code

  • Install the Adafruit_SI1145 library from the manage libraries section in the Arduino IDE.
  • Upload the following test code to the Arduino board. 

#include "Adafruit_SI1145.h"
Adafruit_SI1145 uv = Adafruit_SI1145();
void setup() {
  Serial.println("Adafruit SI1145 test");
  if (! uv.begin()) {
    Serial.println("Didn't find Si1145");
    while (1);
void loop() {
  Serial.print("Vis: "); Serial.println(uv.readVisible());
  Serial.print("IR: "); Serial.println(uv.readIR());
  float UVindex = uv.readUV();
  UVindex /= 100.0;  
  Serial.print("UV: ");  Serial.println(UVindex);