Skip to content
GUVA-S12SD: Ultraviolet Light Intensity

icon picker
GUVA-S12SD Setup Guide

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
Copy 2 of Wiring / Connections
Arduino
UV Detection Sensor
5V
VCC
GND
GND
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!

Original Sources & Works Cited :
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.