Skip to content
Gallery
Oasis-Knowledge
Share
Explore
Sensors

icon picker
GUVA-S12SD: Ultraviolet Light Intensity

Interfacing GUVA-S12SD UV Sensor Module with Arduino


Introduction

The GUVA-S12SD UV sensor module can measure the intensity of UV radiation in real-time. An analog UV light to voltage converter, it is a realistic UV detector that measures wavelengths between 240 nm and 370 nm. This tutorial will help you set up the device to employ that capability and write code to control other devices based on the UV light intensity.

Hardware Components

You will require the following hardware for Interfacing GUVA-S12SD UV Sensor Module with Arduino.
GUVA-S12SD Sensor Module
Breadboard
Jumper Wires

GUVA-S12SD UV Sensor with Arduino


Schematic

We’ll need to connect the sensor to the Arduino. Make connections according to the circuit diagram given below.
GUVA-S12SD UV Sensor Module Arduino Circuit
Wiring / Connections
Arduino
UV Detection Sensor
1
5V
VCC
2
GND
GND
3
A0
SIG
There are no rows in this table

Installing Arduino IDE

First, you need to install the Arduino IDE from its official website: .
Arduino has a simple step-by-step guide: ““.

Code

Next, copy the following code and paste it into the Arduino IDE Software.
void setup()
{
Serial.begin(9600);
}
void loop()
{
float sensorVoltage;
float sensorValue;
sensorValue = analogRead(A0);
sensorVoltage = sensorValue/1024*5.0;
Serial.print("sensor reading = ");
Serial.print(sensorValue);
Serial.print(" sensor voltage = ");
Serial.print(sensorVoltage);
Serial.println(" V");
delay(1000);
}


Working Explanation

Let’s dive into the code to understand how it works:
The code starts by initializing the serial communication in the void setup.
In the void loop, the code starts by declaring a variable for the sensor reading.
The code then reads the value from the analog input 0 and converts it to a voltage using the formula V=sensorValue/1024*5.0.
The following line of code prints out “sensor reading =” followed by whatever was read from A0.
Then it prints out “sensor voltage =” followed by what was calculated earlier.
Finally, it prints out “V” to represent the voltage.
The sensorValue variable stores the result of the conversion, which is then printed out on the Serial Monitor.

Testing

To test the circuit once you upload the code, power the Arduino on. The code will cause the Arduino to continuously read the voltage on analog pin 0 and print it out in V.
If you have any questions, leave us a comment below!
Sources:
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.