Home Code Arduino and GUVA-S12SD UV Sensor

Arduino and GUVA-S12SD UV Sensor

by shedboy71

The GUVA-S12SD UV Sensor chip is suitable for detecting the UV radiation in sunlight. It can be used in any application where you want monitor for the amount of UV light and is simple to connect to any microcontroller. I recently noticed that some sellers had little modules for this sensor at a reasonable price so decided to purchase one

s12sd

The module, with a typical UV detection wavelength of 200 – 370nm, outputs a calibrated analog voltage which varies with the UV light intensity so basically all you need to do is connect this to an ADC input and read in the value.

This value ties in with the UV index, this looks something like this

uv_index

 

Connection

The connections are straightforward and described below, I used 3.3v from my Arduino. This was mainly for compatibility with other development boards but the module works with 5v.

1. GND: 0V (Ground)
2. VCC: 3.3V to 5.5V
3. OUT: 0V to 1V ( 0 to 10 UV Index)

Layout

As said its a simple layout but here you go

 

arduino-and-guvas12sd_bb

Code

Simple code example that reads the value at A0 and outputs the results via the serial monitor, if you use 5v rather than 3.3v then you will need to change the 3.3 in the following line

sensorVoltage = sensorValue/1024*3.3;

[codesyntax lang=”cpp”]

void setup() 
{
  Serial.begin(9600);
}
 
void loop() 
{
  float sensorVoltage; 
  float sensorValue;
 
  sensorValue = analogRead(A0);
  sensorVoltage = sensorValue/1024*3.3;
  Serial.print("sensor reading = ");
  Serial.print(sensorValue);
  Serial.println("");
  Serial.print("sensor voltage = ");
  Serial.print(sensorVoltage);
  Serial.println(" V");
  delay(1000);
}

[/codesyntax]

Testing

Open the serial monitor and look at the readings

sensor reading = 46.00
sensor voltage = 0.15 V
sensor reading = 46.00
sensor voltage = 0.15 V
sensor reading = 46.00
sensor voltage = 0.15 V
sensor reading = 46.00
sensor voltage = 0.15 V
sensor reading = 46.00
sensor voltage = 0.15 V

If you look at the image earlier that corresponds to UV index of 0 which is a relief because I tested this indoors

 

Links

 

Share

You may also like

3 comments

ماژول تشخیص شدت اشعه uv خورشید guva-s12sd محصول cjmcu 17th January 2017 - 7:37 am

[…] نتایج خروجی : TestingOpen the serial monitor and look at the readingssensor reading = 46.00 sensor voltage = 0.15 V sensor reading = 46.00 sensor voltage = 0.15 V sensor reading = 46.00 sensor voltage = 0.15 V sensor reading = 46.00 sensor voltage = 0.15 V sensor reading = 46.00 sensor voltage = 0.15 Vرفرنس: Arduino and GUVA-S12SD UV Sensor – Arduino Learning […]

Ultra Violet Sunburns: ESP8266 / UV Sensor – thisisyetanotherblog 2nd August 2020 - 9:22 am

[…] software measures the UV value via the analogue pin and calculates the UV index based on the table on this website.The measurements and calculations can be used to send notifications to an interested user or to […]

Leave a Comment