
Originally Posted by
visnja30
ADC is not a problem, measure & scale result (1v -> 0, 3v -> 1023, 10-bit ADC) ...... Yes it is problem
This is my problem I can measure voltage from sensor but how to scale it to UV intensity from datasheet.
In Lapis website, they have graph including UV-index.
1V = 0 UV-Index
3V = 15 UV-Index
Don't know how they have calculated that, but lets take it as it is.
Scaling ADRaw: 310 (1V) - 925 (3V) to UVIndex: 0 -15
Code:
If AD_Raw < 310 THEN AD_Raw = 310
UVIndex = (((AD_Raw * 4)/17)-71)/10

Above is approximation for accurate calculation formula. It should be close enough, but if it is not then alternate parameters...
Remember that intermediate results (step by ste) must remain as an integer value
Bookmarks