Arduino - GUVA-S12SD UV Sensor
In this tutorial, we are going to learn:
- What the GUVA-S12SD UV sensor module measures, and why it shows almost zero inside a room
- How to connect the UV sensor module to Arduino Uno with three wires
- How to program Arduino to print the ADC count and the SIG voltage of the sensor
- How to program Arduino to estimate the UV index and name the risk level, from Low to Extreme

Hardware Required
Or you can buy the following kits:
| 1 | × | DIYables STEM V3 Starter Kit (Arduino included) | |
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some links direct to products from our own brand, DIYables .
About GUVA-S12SD UV Sensor
Your eyes cannot see ultraviolet light, but your skin feels it later as a sunburn. The GUVA-S12SD module lets Arduino "see" it. The board is small and purple, about 11mm x 27mm, with two mounting holes. On it you find two main parts: the GUVA-S12SD photodiode (the tiny white square) and a VLM358 op-amp chip.
How does it work? When UV light lands on the photodiode, it lets a very small current flow. This current is far too small for Arduino to read. The op-amp turns it into a voltage on the SIG pin, and Arduino reads that voltage with analogRead(). More UV gives a higher voltage.
The sensor only reacts to UV-A and UV-B light (240nm to 370nm). A desk lamp or a ceiling light gives almost no UV, so inside the house the reading stays close to 0V. To see real numbers, take the setup next to an open window in the sun, or go outside. A UV flashlight also works well for a quick test. The module is sold as a pack of two.
| GUVA-S12SD UV Sensor Module | |
|---|---|
| Sensor Chip | GUVA-S12SD UV photodiode |
| Amplifier | VLM358 op-amp |
| Spectral Range | 240nm to 370nm (UV-A and UV-B) |
| Viewing Angle | 130 degrees |
| Supply Voltage | 2.5V to 5V DC |
| Output | analog voltage, about 0V (no UV) to 1V or more (strong sun) |
| Header | 3-pin (SIG, GND, VCC), presoldered |
| Board Size | about 11mm x 27mm |

The header has three pins, labeled SIG, GND, VCC in that order:
- SIG pin: needs to be connected to an Arduino analog input pin (A0 to A5). Its voltage rises as the UV gets stronger.
- GND pin: needs to be connected to GND (0V)
- VCC pin: needs to be connected to the 3.3V pin of the Arduino Uno (the 5V pin also works)
From Voltage to UV Index
The UV index is the number you see in the weather app. A simple rule that most makers use for this module is: UV index ≈ SIG voltage / 0.1. In other words, every 0.1V on SIG is about one UV index point. So 0.35V means a UV index of about 3.5.
| UV Index | Level | What it means |
|---|---|---|
| 0 to 2 | Low | little risk for most people |
| 3 to 5 | Moderate | use a hat and sunscreen at noon |
| 6 to 7 | High | cover up, look for shade |
| 8 to 10 | Very High | skin can burn quickly |
| 11 and above | Extreme | stay out of the midday sun |
This rule gives a good estimate for hobby projects, such as a sunscreen reminder. It is not a calibrated meter, so do not use it for medical or safety decisions.
Wiring Diagram
Connect the SIG pin of the module to A0, the GND pin to GND, and the VCC pin to the 3.3V pin of the Arduino Uno (or to 5V; both are fine).

This image is created using Fritzing. Click to enlarge image
Use longer jumper wires if you can. Then the Arduino can stay on the table in the shade while the sensor sits in the sun.
How To Program For GUVA-S12SD UV Sensor
- No library is needed. Name the analog pin that SIG goes to:
- Read the ADC count. The Uno has a 10-bit ADC, so the result is between 0 and 1023:
- Change the count into volts. The ADC reference of the Uno is 5V. This stays true even when the sensor gets its power from the 3.3V pin:
- Estimate the UV index from the voltage:
Arduino Code - Read GUVA-S12SD UV Sensor Voltage
Start with the plain numbers. Once per second, this sketch prints the raw ADC count from A0 and the matching SIG voltage. Use it to check the wiring and to get a feel for how small the signal is.
Quick Steps
- Connect Arduino to PC via USB cable.
- Wire the UV sensor module to Arduino as shown in the wiring diagram.
- Open Arduino IDE, select the right board and port.
- Copy the above code and paste it to Arduino IDE.
- Click Upload button on Arduino IDE to upload code to Arduino.
- Open the Serial Monitor and set the baud rate to 9600.
- Watch the values at your desk for a few seconds, then carry the board (still on the USB cable of a laptop) into direct sunlight.
The first four lines were taken indoors: almost nothing. The jump to about 0.45V came when the sensor faced the sun. Notice that even in sun the ADC count stays under about 200. This is normal, because the signal only uses the bottom part of the 0V to 5V range.
Arduino Code - GUVA-S12SD UV Index and Risk Level
This sketch turns the reading into something people understand. It takes 16 quick samples and averages them, so the last digit does not jump around. Then it divides the voltage by 0.1 to get the UV index, and prints the level name from the table above.
Quick Steps
- Keep the same wiring.
- Copy the above code and paste it to Arduino IDE.
- Click Upload button on Arduino IDE to upload code to Arduino.
- Open the Serial Monitor (baud rate 9600).
- Move the sensor from the room, to the shade outside, and then into full sun around midday.
※ NOTE THAT:
If the value stays near 0 even in the sun, check that the white photodiode faces the sky and is not behind a glass window. Normal window glass blocks most UV-B light, so readings behind glass are lower than outside.
Ideas for what to build next:
- A sunscreen reminder that beeps with a piezo buzzer when the UV index reaches 3.
- A small UV station that shows the index on an LCD next to the door.
- A tester to check if a UV lamp or a UV LED still gives real UV light.
- A smart blind that closes with a servo motor when the sun gets too strong.
Video Tutorial
We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.