UV sensor breakout board

Breakout boards

1) Normally, the circuit of the sensors are not as simple as a photoresistor. Each sensor may have its own integrated circuits.

2) Breakout boards are another IC attached to the arduino. The word breakout implies, they are not specific to arduino boards (unlike shields)

3) For usage of breakoutboards, we have to read for instructions from the manufacturer

NOTE : Check the operating voltage before connecting any breakout boards

UV sensor - GUVA S12D breakout

Product page :

It contains 3 pins, 1 to 5V supply, 1 to GND and the other to A0

We have to divide the output voltage (got by multiplying A0 with 5/1023.) by 0.1 to get UV index

The datasheet shows the wavelent to which the device responds

Sketch

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:

  // read the value from sensor
  int sensorValue = analogRead(A0);

  //convert the sensor value to voltage
  // 0 - 5V is divided into 1023 segmets
  float voltage = sensorValue*(5.0/1023.0);

  // as per the sensor datasheet, output voltage should be divided by 0.1
  // to get UV index
  float uv_index = voltage/0.1;

  Serial.print(sensorValue);
  Serial.print(", ");
  Serial.println(uv_index);

  //delay inbetween reads for stability
  delay(100);
}