I’m using the AS7331 UV sensor to collect UV data. According to the datasheet, the sensor outputs values in microwatts per square centimeter. I collected some data and tried to convert it to the UV Index (UVI), but the results seem unreasonably high. I could really use some guidance on this!
Here’s an example of the data I collected:
Timestamp: 2024-12-03 11:47:11
UVA: 778.28
UVB: 11.81
UVC: 20.75
At that time, the weather API indicated a UVI of approximately 1.5. However, when I performed the conversion using the method described in this post, the resulting UVI value was much higher than expected.
My Conversion Process:
Calculate Erythemal Irradiance (UVE):
According to the blog, 17% of UVA and 83% of UVB contribute to the UVI:
UVE = 0.17 × UVA + 0.83 × UVB
Substituting the values:
UVE = 0.17 × 778.28 + 0.83 × 11.81 = 142.1 μW/cm²
Convert Units to W/m²:
Using the conversion 1 μW/cm² = 10⁻² W/m²:
142.1 μW/cm² = 1.421 W/m²
Calculate UVI:
From the blog, UVI is calculated as:
UVI = Erythemal Radiation [W/m²] × 40 m²/W
Substituting the value:
UVI = 1.421 × 40 = 56.84
The Problem:
The calculated UVI, 56.84, is absurdly high compared to the expected value of 1.5 from the weather API. I’ve double-checked my calculations and looked through the AS7331 datasheet, but I can’t figure out why the value is so off.
Does anyone have experience with this sensor or insights into why the data might be wrong? Could it be an issue with the sensor, the conversion formula, or something else?
The UV Index is poorly and unscientifically defined, and is intended by organizations such as WHO to be used only as a very rough guide.
For example, if you take a look at this page from the U.S. Environmental Protection Agency website, they don’t even bother to define “strength” or identify any units of measurement, then they apply arbitrarily selected weights to the “strength” of each UV band to arrive at a rather meaningless number.
I wouldn’t take the blog article you linked very seriously, as your results suggest. Nor would I take the National Weather Service estimates seriously, especially for comparison.
Besides, if it is cloudy in your area and sunny where the NWS made their measurements, or vice versa, what is the point?
Thank you for sharing your insights! The reason I’m looking to convert UV values to UVI is to enable an accurate comparison with another device (martin allen UV sensor), which outputs UVI directly. This is one of the key reasons for pursuing the conversion.
However, I’m wondering if the output values for the AS7331 sensor seem accurate to you. From my observations, the UV readings appear to be higher than expected. What’s your perspective on this?
Consumer grade sensors like the AS7331 are not calibrated. The sensor data sheet gives specifications for the response of a typical example, along with the statistically expected range of responses for a given input.
The only way to know whether the readings from your UV detector are usable is to compare those readings with readings from a commercial, NIST-traceable calibrated instrument, taken at the same time and location. This method can also be used to calibrate the AS7331.
I think your issue is that you’re using the raw readings from the sensor which are not in μW/cm² units. You need to convert the raw readings to μW/cm² which depend on gain and integration time. There’s some sample code here which does the calculation to go from raw readings to μW/cm² and then you can use that to calculate UV Index per the blog post.