Counting output voltage from SENS-43UV on Uno without changing AnalogReference()

Hi guys, Arduino beginner here!

I have a SENS-43UV sensor, connected to A2 pin on my Arduino Uno. The Arduino reads the sensor (reporting very low values indoors, ~5-6, but outdoors in the sun it was higher, 13-15, so obviously it reacts to sunlight).

According to the guys over at Build an Arduino UV Index Meter | DroneBot Workshop,

If you are using an UV sensor that will never give out over a volt under normal conditions you are actually wasting a lot of accuracy with the above arrangement. A range of 0 to 1 volt will only use the digits between 0 and 204, leaving 820 unused digits.

To address this, they suggest changing analogReference() to somewhere around 1 volt:

That way the entire 1024 bits of resolution will be available for your sketch.

However I use other analog sensors as well and would not like to change analogReference(). My question to you is, how can I convert the analogOutput of the sensor to corresponding voltages/UV indexes, even though it will admittedly not be as accurate?

UV1 – 227 mV
UV2 – 318 mV
UV3 – 408 mV
UV4 – 503 mV
UV5 – 606 mV
UV6 – 696 mV
UV7 – 795 mV
UV8 – 881 mV
UV9 – 976 mV
UV10 – 1170 mV (1.17 volts)

Usually it is a matter of multiplying like so:

sensorvalue * 5 /1024

is it not?
Any help would be greatly appreciated!

What other analog sensors do You use, the range of their output?

Yes, if the outputs of your other sensor is say 5v , then you could use a potential divider on those and use the 1.1volt reference, which is the preferred route anyway .
Note if you don’t use this then the analog input uses the supply voltage ( ~5v ) as its reference and that is likely to vary a bit !

Thanks for your answers Railroader and hammy!

I removed the other analog sensors (easiest that way I think!) and then changed analogReference like so in setup() method:

  analogReference(INTERNAL);

Now I get sensor values of 45-70 indoors, so it seems to be working on the new 1024 resolution. My question to you is, how do I convert these readings to mV? Or is this actually mV?

Measure the voltage at ref pin. Tell us.

Measure AREF voltage with accurate DVM, let's say it is 1.08V.

float aRef = 1.08;
float mV = ADC_value * aRef / 1024.0 * 1000;
Serial.println(mV);

Say your ADC reading was 450, then, 450 * 1.08 / 1024 * 1000 = 474.6mV.

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