Contents

Interfacing GUVA-S12SD UV Sensor Module with Arduino

GUVA-S12SD UV Sensor Module Features

Ultraviolet (UV) light is produced by sunlight. Gradual thinning of Earth’s ozone layer has increased the amount of UV radiation which can lead to sunburn and other problems. UV radiation is a form of electromagnetic radiation with wavelength from 200 nm to 370 nm, shorter than that of visible light, but longer than X-rays.

The GUVA-S12SD UV sensor module is used for detecting the intensity of ultraviolet radiation. This module has an analog output that changes with the intensity of UV light.

Note

The primary purpose of measuring UV radiation by such modules is to prevent damage to humans.

Download the datasheet of GUVA-S12S module here.

How to Calculate the UV Index

As mentioned, the module has an analog output and varies approximately between 0 and 1 volt. The output voltage of this module varies in accordance with the intensity of UV light according to the following diagram.

 

You can see the accurate value of UV intensity according to output voltage in the image below.

Each level of UV intensity represents the causative factor. The image below shows what each level includes:

GUVA-S12SD UV Sensor Module Pinout

This module has 3 pins:

  • VCC: Module power supply – 3V to 5V
  • GND: Ground
  • OUT (SIG): Output analog signal – varies from 0-1 V

You can see the pinout of this module here.

Required Materials

Hardware Components

Arduino UNO R3 × 1
GUVA-S12SD UV Detection Sensor Module × 1
Male to Female jumper wire × 1

Software Apps

Arduino IDE

Interfacing GUVA-S12SD UV Sensor Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to GUVA-S12SD sensor. Connect wires accordingly.

Step 2: Code

Upload the following code to your Arduino.

  /*
  GUVA-S12SD-UV-Module
  Made on 03 Feb 2020
  by Amir Mohammad Shojaee @ Electropeak
  
Home
*/ 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); }

We want to display the output in volts on the Serial Monitor. So, we first save the analog input and convert its range to 0 to 5 in volts.

By bringing the camera flashlight of your mobile phone close to the sensor, the output changes in volts as shown below.

Liked What You See?​
Get Updates And Learn From The Best​

Comments (10)

  • Mayur Reply

    What is the accuracy and is the data reliable enough to be publish in research article?

    May 6, 2024 at 4:53 am
    • Mohammad Damirchi Reply

      Hi Mayur,
      It’s advisable to consult the datasheet of the sensor for comprehensive information. Based on that, you can determine whether the sensor is suitable for your intended application or not.

      May 6, 2024 at 6:06 am
  • Boris Reply

    It would be useful to know the output stage of the device to apply it for measuring ultraviolet without using Arduino.

    September 6, 2024 at 12:50 pm
    • Mohammad Damirchi Reply

      Hello Boris,
      The sensor outputs an analog voltage that varies between 0 and 1 Volt. Based on the image in this article, each voltage level corresponds to a certain degree of change. If you want to use this module without an Arduino, you can use an operational amplifier, such as the LM358, to read the analog voltage. If the voltage exceeds a certain threshold, the op-amp can make the output switch to a high state (similar to a digital signal).

      September 7, 2024 at 5:25 am
  • Kyle Reply

    Where can I see the outputs of the sensor? I can’t find anything in Arduino IDE to see the UV data. Is there a specific place that I need to go?

    October 3, 2024 at 12:50 am
    • Mohammad Damirchi Reply

      Hi Kyle,

      In the Arduino IDE, there is an option called “Serial Monitor.” When you open the Serial Monitor window, you will be able to see the sensor output. You can access it by clicking the top right corner icon in the main page, or you can use the shortcut Ctrl+Shift+M. More details can be found here

      October 5, 2024 at 12:15 pm
  • Julian Keulerz Reply

    How does dividing by 1024 and then multiplying by 5.0 give us the output voltage of the UV-Sensor? Is there a link to the information you got this from?

    October 9, 2024 at 1:22 pm
    • Mohammad Damirchi Reply

      Hi Julian,
      Dividing by 1024 and then multiplying by 5.0 converts the raw sensor reading (which is a number between 0 and 1023) into the actual voltage that the sensor is detecting.
      The analog-to-digital converter (ADC) in the microcontroller reads the sensor value as a fraction of the 5V input range, so dividing by 1024 normalizes this reading, and multiplying by 5.0 scales it back to the real voltage (since the full range is 0 to 5V). This method is standard in converting analog sensor readings to voltage in electronics.

      October 16, 2024 at 8:20 am
  • Julian Keulerz Reply

    Where did you get the diagramm from that Plots Voltage and the UV-Index?

    October 9, 2024 at 1:24 pm
    • Mohammad Damirchi Reply

      It’s based on the datasheet.

      October 16, 2024 at 8:23 am

Leave a Reply

Your email address will not be published. Required fields are marked *