# Question about AS7331 UV sensor units and UVI conversion is high!

**URL:** <https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208>\
**Category:** Environmental\
**Tags:** carrier\
**Created:** [December 9, 2024, 5:09am UTC](https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208 "2024-12-09T05:09:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cathylin](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Cathylin](https://community.sparkfun.com/u/Cathylin)\
**Post date:** [December 9, 2024, 5:09am UTC](https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208/1 "2024-12-09T05:09:06Z")

</div>

Hi everyone,

I’m using the [AS7331 UV sensor](https://www.sparkfun.com/products/23518) 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](https://blog.otthydromet.com/en/what-is-the-uv-index-and-how-to-calculate-it/), the resulting UVI value was **much higher** than expected.

## My Conversion Process:

1. **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²

2. **Convert Units to W/m²:**  
Using the conversion `1 μW/cm² = 10⁻² W/m²`:  
142.1 μW/cm² = 1.421 W/m²

3. **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?

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![jremington](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/jremington/32/6595_2.png) [@jremington](https://community.sparkfun.com/u/jremington)\
**Post date:** [December 9, 2024, 3:47pm UTC](https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208/2 "2024-12-09T15:47:00Z")

</div>

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.

> **[Learn About the UV Index | US EPA](https://www.epa.gov/sunsafety/learn-about-uv-index)**
>
> Explanation of the UV index and how it is calculated by the U.S. National Weather Service

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?

---

<div class="post-metadata">

**Author:** ![Cathylin](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Cathylin](https://community.sparkfun.com/u/Cathylin)\
**Post date:** [December 9, 2024, 5:26pm UTC](https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208/3 "2024-12-09T17:26:49Z")

</div>

Hi @jremington,

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?

---

<div class="post-metadata">

**Author:** ![jremington](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/jremington/32/6595_2.png) [@jremington](https://community.sparkfun.com/u/jremington)\
**Post date:** [December 9, 2024, 5:39pm UTC](https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208/4 "2024-12-09T17:39:56Z")

</div>

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.

> which outputs UVI directly

By which definition of UVI? There are several.

---

<div class="post-metadata">

**Author:** ![farzadb](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/farzadb/32/8634_2.png) [@farzadb](https://community.sparkfun.com/u/farzadb)\
**Post date:** [February 17, 2025, 11:02pm UTC](https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208/5 "2025-02-17T23:02:52Z")

</div>

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](https://github.com/kriswiner/AS7331/blob/c15f21c7eb5766d8ed4b36ae3240d29e69f747ea/AS7331_DataReady_Ladybug/AS7331_DataReady_Ladybug.ino#L175) 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.

---

<div class="post-metadata">

**Author:** ![Matthias\_Birkicht](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/matthias_birkicht/32/8938_2.png) [@Matthias\_Birkicht](https://community.sparkfun.com/u/Matthias_Birkicht)\
**Post date:** [March 12, 2025, 8:42am UTC](https://community.sparkfun.com/t/question-about-as7331-uv-sensor-units-and-uvi-conversion-is-high/62208/6 "2025-03-12T08:42:58Z")

</div>

to convert from μW/cm² to W/m², multiply by 0.0001!
