15-11-2018, 00:03
Hi,
In the debug output (and that is what is transmitted to the RX) the avg UV is the raw reading of ADC0, which is from 0 to 1023, for an input voltage of 0V to 1.1V (the ADC ref voltage is set to 1.1V before each reading).
With this formula we calculate the UV index directly from the raw ADC reading.
Supposing UV_Transmission = 100 and, with the maximum ADC raw reading of 1023 which should correspond to the maximum voltage output of the sensor (1.1V), we will get and UV Index of 11.98 (11+ on the data sheet)
What seems to be happening is that your sensor is outputting a higher voltage than indicated on the specs.
If you change the value of 12 to 9, what happens is that you will never get an UV index greater that 1023 * 9 /1024 = 8.99, as the raw reading of the ADC will never be great than 1023.
(14-11-2018, 22:25)41south Wrote: I assume that the debug output avg UV is an average millivolt output of the sensor over the period? If that is the case this lines up nicely with my expected UV of 5 to 6 when you look at the output graph for the UVM30A sensor.
Unfortunately the Indice UV value does not agree - as per my original observation it is very high
Sending ID4...
ACD0 - SolarRad :428 SolarRad :585
ADC1 - avg UV : 699 Indice UV : 8.2
Sending ID4...
ACD0 - SolarRad :428 SolarRad :585
ADC1 - avg UV : 690 Indice UV : 8.1
...
In the debug output (and that is what is transmitted to the RX) the avg UV is the raw reading of ADC0, which is from 0 to 1023, for an input voltage of 0V to 1.1V (the ADC ref voltage is set to 1.1V before each reading).
(14-11-2018, 23:25)41south Wrote: This is the existing calculation - I hope (used in both debug on the TX and in the RX) which appears to read high
// --- ADC1 is data from my UV sensor UVM-30A
const byte UV_Transmission = 100;
IndiceUV = ((avg_IndiceUV * 12.0 * (100.0 / UV_Transmission)) / 1024.0) ;
With this formula we calculate the UV index directly from the raw ADC reading.
Supposing UV_Transmission = 100 and, with the maximum ADC raw reading of 1023 which should correspond to the maximum voltage output of the sensor (1.1V), we will get and UV Index of 11.98 (11+ on the data sheet)
What seems to be happening is that your sensor is outputting a higher voltage than indicated on the specs.
If you change the value of 12 to 9, what happens is that you will never get an UV index greater that 1023 * 9 /1024 = 8.99, as the raw reading of the ADC will never be great than 1023.

