UV Sensor output oscillating beyond a reasonable range

Hi there,

I have the GUVA-S12SD UV Sensor, along with an Arduino Uno Rev3 board, and have this code running:

void setup() 
{
  Serial.begin(9600);
}
 
void loop() 
{
  float sensorVoltage; 
  float sensorValue;
 
  sensorValue = analogRead(A0);
  sensorVoltage = (sensorValue/1024)*3;
  Serial.print(sensorVoltage);
  Serial.println(" V");
  delay(100);
}

I can confirm that the light sources above the sensor is stable, but the returned values on analog pin 0 are oscillating between 0-3 somewhat periodically (report interval is 1000ms):

1.86 V
2.02 V
2.17 V
2.29 V
2.31 V
2.33 V
2.33 V
2.34 V
2.34 V
2.29 V
2.24 V
2.20 V
2.14 V
2.08 V
2.01 V
1.94 V
1.83 V
1.57 V
1.27 V
1.04 V
0.85 V
0.69 V
0.54 V
0.42 V
0.37 V
0.33 V
0.30 V
0.28 V
0.32 V
0.42 V
0.47 V
0.53 V
0.59 V
0.65 V
0.73 V
0.80 V
0.88 V
1.14 V
1.44 V
1.68 V
1.87 V
2.03 V
2.19 V
etc...

I have tried this sketch at 5V as well to see if there is an issue with the board's power stability, and yet the result is the same. As a sanity check I disconnected analog 0 and can confirm that the reported voltage is 0.0.

Does this suggest something wrong with the sensor itself? Anything else I can try?

Thanks sincerely for your time.

And the circuit / connections?

Do you have the Adafruit module ? Analog UV Light Sensor Breakout - GUVA-S12SD : ID 1918 : $6.50 : Adafruit Industries, Unique & fun DIY electronics and kits.

The sensor uses very low currents, about 1µA. It is therefor very sensitive for the 50Hz/60Hz of the mains other from other devices.

What happens if your update time is 97ms instead of 100?

void setup()
{
  Serial.begin(9600);
}
 
void loop()
{
  float sensorVoltage;
  float sensorValue;
 
  sensorValue = analogRead(A0);
  sensorVoltage = (sensorValue/1024)*3;
  Serial.print(sensorVoltage);
  Serial.println(" V");
  delay(97); // <<<<<<<<<<<<<<<<<
}

Well acording to your code the report interval is just over 100msec.

delay(100);

The module DOES use very low currents - but is buffered by an op amp so the output impedance is low and it will not be significantlty affected by interference if the leads are reasonably short.

The obvious first step in fault finding is to remove the sensor and put a potentiometer across the supply rails with the slider to the analog input - and a capacitor to ground.

Also you are sampling near a subharmonic of mains frequency, so a different update time may help - you may have to experiment with that.

I can confirm that the light sources above the sensor is stable

not if its a mains driven uv lamp!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.