Using Arduino Uno and a GUVA-S12SD sensor (https://www.adafruit.com/product/1918).
Here's my circuit. 5V into sensor+, GND into sensor-, A0 to sensor out.
Here's my code:
void setup()
{
Serial.begin(9600);
}
void loop()
{
float sensorVoltage;
float sensorValue;
float uvIndex;
sensorValue = analogRead(A0);
Serial.print("Analog out: ");
Serial.println(sensorValue);
// 5 because 5V
sensorVoltage = sensorValue * (5.0 / 1023.0);
Serial.print("Output voltage: ");
Serial.println(sensorVoltage);
uvIndex = sensorVoltage / 0.1;
Serial.print("UV Index: ");
Serial.println(uvIndex);
Serial.println();
delay(1000);
}
Here's a sample from the serial monitor. The values stay about the same regardless of where I am in my house (in a sunny room, in the dark bathroom, etc.).
Analog out: 853.00
Output voltage: 4.17
UV Index: 41.69
Analog out: 853.00
Output voltage: 4.17
UV Index: 41.69
Analog out: 853.00
Output voltage: 4.17
UV Index: 41.69
Analog out: 853.00
Output voltage: 4.17
UV Index: 41.69
Output voltage is supposed to be very low. The UV index maxes out at around 11 - so 41 is too high. I checked what it is in my city right now, and it's 3. So this is super wrong. I don't have a multimeter to test with right now.
Any ideas about what could be going on? Did I order a bad sensor?
- Out +
+
hole ... insert the other two jumpers into the other two holes ... tie the three jumpers to the back of the board using the mounting hole next to the adafruit logo ... use a cable tie, or twist tie, or string, or rubber band ... pull on the jumper wire so that the ends are at an angle in the holes and are pressed tight against the side og the holes .... hopefuly that will work