UV Index Sensing with the GUVA-S12SD

The GUVA-S12SD is a photodiode-based UV sensor that responds to light in the roughly 240-370nm band, which covers both UV-B (around 280-315nm) and UV-A (around 315-370nm). Incoming ultraviolet photons generate a small photocurrent in the diode, which the module's onboard circuitry converts and amplifies into an analog voltage that rises as UV intensity rises. Wired to a microcontroller's analog input, that voltage — typically in the 0-1V range for everyday outdoor sunlight — is the only signal the sensor produces; everything else, including any "UV index" number, is math a program does afterward.

How does the GUVA-S12SD measure UV light?

The sensing element is a photodiode built to be responsive specifically to ultraviolet wavelengths rather than the full visible spectrum a typical light sensor would pick up. When UV photons in its response band strike the diode, they knock loose a photocurrent proportional to the number of incident photons per second — in effect, proportional to UV intensity. That current is far too small and too noisy to feed straight into a microcontroller's ADC, so the GUVA-S12SD board carries signal-conditioning circuitry that amplifies it into a clean analog voltage on its OUT pin. The module runs on 3.0-5.5V, which comfortably covers a 5V Arduino Uno's logic level, and it draws a small enough current (well under 1mA) that it needs no dedicated power regulation beyond what the Uno's 5V rail already supplies.

Because it's a raw analog sensor with no onboard microcontroller or digital interface, the GUVA-S12SD does no interpretation of its own — it has no concept of "UV index," no calibration table, and no communication protocol. It reports one thing only: a voltage that goes up when UV light goes up. Every layer of meaning above that — index scales, warning thresholds, alarms — is software built on top of that single analog reading.

How do you convert the analog reading into a UV index number?

Converting the raw voltage into something resembling the UV index scale used by weather services is an approximation, not a measurement of the same rigor. The common conversion used in hobbyist firmware for this sensor — including the reference curve published for similar GUVA-family modules — treats roughly every 100mV of output as one step on the UV index scale, so a reading of 400mV corresponds to an approximate UV index of about 4. On an Arduino Uno's 10-bit ADC reading 0-1023 across a 0-5V range, that means converting the raw ADC count to millivolts first (multiplying by roughly 4.88mV per ADC step) and then dividing by 100 to get an index-like number.

That conversion is a rough mapping, not a calibrated instrument reading. It assumes a fixed voltage-to-index relationship that the manufacturer's datasheet presents as typical, but any individual sensor unit, temperature drift, or lighting condition can shift the actual relationship. Getting a genuinely accurate UV index out of this sensor requires comparing its output against a known reference UV source and building your own calibration curve — the module itself ships uncalibrated, and the "divide by 100" shortcut is a starting approximation, not a certified conversion.

How do you wire the GUVA-S12SD to an Arduino Uno?

The GUVA-S12SD breakout is one of the simplest analog sensors to wire — three pins, no bus, no addressing.

Arduino Uno pin GUVA-S12SD pin Signal
5V VCC Power (3.0-5.5V accepted)
GND GND Ground
A0 OUT Analog UV voltage output

Because the output is a plain analog voltage, reading it in code is a single analogRead() call on whichever analog pin OUT is connected to — no library, no initialization sequence, and no bus address to get wrong.

Can this replace checking a real UV index forecast?

No. This is an educational and DIY project for comparing relative UV exposure at your own location — noticing that midday sun reads much higher than an overcast afternoon, or that shade under a tree brings the reading down — not a dermatologically validated instrument. It has not been calibrated against a reference source, its voltage-to-index conversion is a documented approximation rather than a certified formula, and a single uncalibrated photodiode module is not a substitute for the multi-band, professionally calibrated instruments that national weather services use to publish an official UV index. Treat any number this build reports as a rough, relative indicator for a hobby project, and keep using an official weather-service UV forecast for actual sun-safety decisions.

Watch it built live

We typed this into Compoden's storefront assistant, Soldr, phrased around the outcome rather than a specific part number:

"I want to build a project that measures UV light exposure and warns about high UV index, using an Arduino Uno"

Compoden storefront AI assistant Soldr building a GUVA-S12SD UV index warning project parts tray with Arduino Uno

Soldr carded the real GUVA-S12SD directly, alongside a full parts tray for the alarm behavior implied by "warns about high UV index": an Arduino Uno, a buzzer, an LED pack, a breadboard, jumper wires, and a power adapter. In its own words: "This build measures the intensity of ultraviolet (UV) light. When the UV level goes above a set point, it will sound an alarm and light up an indicator. This helps you know when you are getting too much UV exposure." On the sensor specifically, Soldr wrote: "The GUVA-S12SD UV Sensor Module measures UV light intensity, specifically UV-A and UV-B. It sends out an analog signal, which is a continuously varying voltage that changes with the amount of UV light it detects. This sensor runs on 3.0V to 5.5V and uses 5V logic, matching the Arduino. It must be calibrated, meaning you need to compare its readings to a known standard before its numbers will accurately tell you the UV index." That last sentence — flagged unprompted by the assistant itself — matches exactly the calibration caveat above. Soldr also estimated total current draw at roughly 100mA across all active parts, comfortably inside what the bundled 5V 2A adapter supplies.

Watch the firmware get generated

We then took the same sensor to Compoden's VoltIQ/Soldr code assistant and asked for working firmware:

"I'm using a GUVA-S12SD analog UV sensor with an Arduino Uno. Write the full firmware to read the analog voltage, convert it to an approximate UV index, and print it to the serial monitor."

VoltIQ PWA generated Arduino firmware for the GUVA-S12SD UV sensor reading analog pin A0 and computing an approximate UV index

The generated sketch reads the sensor on analog pin A0 and uses exactly the 100mV-per-UV-index-step approximation described above — its own code comments spell out the math: "UV Index = voltage (mV) / 100 (mV/UVI). So, 1 UVI = 100mV, 2 UVI = 200mV, etc." and note the ADC scaling: "Arduino's analogRead returns 0-1023 for 0-5V... Voltage per analog unit = 5000mV / 1024 units = 4.88mV/unit (approx)." The assistant also caught and flagged a real mismatch on its own before we could flash anything: the wiring diagram it generated separately had assigned the UV sensor to digital pin 2, while the firmware itself reads analog pin A0. Its exact warning: "the firmware does not use the pin we assigned to GUVA-S12SD UV Sensor Module (2). The wiring diagram is generated from that assignment, so the schematic and the code will disagree — rewire to 2 or regenerate both together." That's worth knowing if you generate both a wiring diagram and firmware for this build: check that the pin the diagram shows matches the pin the code actually reads before wiring anything up. For this sensor, A0 (or another analog-capable pin) is correct — a UV sensor's OUT pin is an analog voltage, not a digital signal, so it cannot be read meaningfully from a plain digital pin.

Get everything in this build

These are the exact parts Soldr selected for the live storefront build above, with real prices and direct add-to-cart links.

Part Price Add to cart
Arduino Uno R3 CH340G ATmega328P Board Rs.230 Add to cart
GUVA-S12SD UV Sensor Module Rs.210 Add to cart
Active Buzzer Module 3-5V 85dB Rs.45 Add to cart
5mm LED Assorted Pack (Red, Green, Blue, Yellow, White) Rs.120 Add to cart
400-point solderless breadboard Rs.40 Add to cart
Male-to-Male Breadboard Jumper Wires (20 cm, 24 AWG) Rs.40 Add to cart
5V 2A Micro-USB Power Adapter Rs.140 Add to cart
Total Rs.825 Add all 7 to cart

Built and Backed by Compoden

Every part listed above ships from Compoden's own India stock, checked for compatibility before being carded together for a build like this one. Orders typically arrive in 3-7 days, with Cash on Delivery and UPI both supported at checkout, and Compoden's support team is available if you run into wiring or firmware questions while putting the project together.

Frequently asked questions

Does Compoden actually stock the GUVA-S12SD?
Yes. It's a real, currently in-stock part on Compoden (GUVA-S12SD UV Sensor Module, analog UV-A/UV-B detection), and it's the exact sensor Soldr carded when asked to build this project — no substitution was needed for this build.

Is the UV index number this project reports accurate?
It's an approximation. The conversion used — roughly 100mV of sensor output per UV index step — comes from a typical reference curve for this sensor family, not a calibration performed on your specific unit. Treat the number as a relative indicator for comparing conditions at your own location, not a certified reading.

Can I use this sensor with a board other than an Arduino Uno?
Yes. Since it's a simple analog output with no bus or addressing, any microcontroller with an analog input pin and a 3.0-5.5V-tolerant supply can read it, including ESP32 and ESP8266 boards, as long as you account for any difference in ADC resolution and reference voltage when converting the raw reading.

Why does the build include a buzzer and LEDs if the sensor only outputs a voltage?
The sensor itself only produces an analog voltage — the alarm behavior is entirely in the firmware, which compares the converted UV index against a threshold and drives the buzzer and LED once that threshold is crossed. Without that added logic and those two output parts, the sensor alone can report a UV reading but cannot warn you about anything on its own.

Back to blog