[HELP] GUVA S12SD UV sensor - analog reading problem?


I have a CJMCU GUVA S12SD UV sensor and I used the attached code to verify it’s output in order to compare it to the ML8511 sensor.

The problem is that the analog reading is at 1020, mV reading is in high 4800’s and the weather forecast for my town rates the UV today at max 8 or 9, so I would say the sensor is a bit “pessimistic”… I don’t know whether I am doing anything wrong or is the sensor faulty?

P.S.: The analog reading when I place my finger on the sensor (complete darkness) is 55, I thought it was supposed to be 0?

EDIT: Forgot to mention, VCC is connected at 5V. I also measured the voltage on the output with a multimeter, it matches (more or less) the one I get from the code…

Any input is very appreciated. Thank you!

double sum, Vsen;

void setup() {

void loop() {
  sum = 0;
  for (int i = 0; i < 100; i++) {
    sum += analogRead(0);
  sum = sum / 100;

  Vsen = (sum / 1023.0) * 5.0 * 1000;

  sum = mapfloat(sum, 55, 1023, 0, 15);

  Serial.print("Avg: ");
  Serial.print(", Sensor voltage: ");
  Serial.println(" mV");


float mapfloat(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;