**Ultraviolet (UV)**is an electromagnetic radiation with a wavelength from 10 nm to 400 nm.

The

**ML8511 is an ultraviolet sensor**that output an analog signal correlated to the amount of UV light detected. By datasheet the sensor detects wavelength

**from 280nm to 560nm**.

Here I've implemented a driver for

**AVR Atmega**,

**portable to other microcontrollers**, that correlates the sensor output to

**light intensity**, it also computes the

**UV index**based on the sensor input.

The ultraviolet index or

**UV index**is an international standard measurement of the strength of sunburn-producing ultraviolet (UV) radiation at a particular place and time. It is a linear scale, with higher values representing a greater risk of sunburn. The purpose of the UV Index is to help people effectively protect themselves from UV radiation.

Not all the energy of the UV spectrum has the same "damage" power, due to this the power spectrum is multiplied by a weighting curve known as the

**erythemal action spectrum**, and the result integrated over the whole spectrum.

The correlation function I propose here is derived by the datasheet graph of "

*Output Voltage over UV intensity*".

From this graph we can get the correlation function. This graph is clearly a linear function. We have Output voltage on the y axis and UV intensity on the x axis.

Because we want to obtain the UV intensity using the voltage that we can read from the sensor, we are going to flip the graph.

Once we have flipped the graph we can now get the point from the graph using a tool like

**WebPlotDigitizer**.

We can now use

**liner regression**technique to obtain the function we need to convert voltage output to UV intensity.

Also notice that this graph has four functions for 75degree, 25degree, -5degree, -25degree temperature condition.

If we perform linear regression on points of that function we get 4 correlation functions.

@75deg UV mW/cm2 = 8.158154634V -7.77772054

@25deg UV mW/cm2 = 7.9816914V - 7.921745308

@-5deg UV mW/cm2 = 7.853758854V - 7.934095316

@-25deg UV mW/cm2 = 7.743732684V - 7.978602568

Note thate the accuracy of this method depends on the accuracy of your point extraction.

More in general we can say that the correlation function looks like this:

If we are going to use this sensor under different thermal condition we can simply interpolate beween those function to get the correlation function slope "s" and intercept "i".

Also, that graph is for a wavelength of 365nm.

We may find the responsivity function of this sensor on the datasheet.

**Responsivity**measures the input–output gain of a detector system. We can use again the WebPlotDigitizer to find points from the "

*Responsivity Characteristics*" curve.

We may notice that for the 365nm light the responsivity is 1. It means that on that light condition the sensor correlation function we have seen before has a gain of 1.

If we

__suppose to apply a filter__over the sensor UV detector that passes only just a single wavelength we can adjust the correlation function according to the gain of the sensor responsivity. That function is inversally proportional, so if our sensor has responsivity 0.3 on a 400nm wavelength, the correlation function have to be multiplied by 1/0.3, cause the voltage output measured is 0.3 times less than the voltage output at 365nm.

We are

*not going to use this most of the time*, because we are going to use our sensor to measure the

**total UV intensity**.

Now let's take a look at the

**UV index**.

The UV index is defined as:

The function that defines the susceptibility of the human skin to sunburn (erythema) and of generalised DNA damage due to UV radiation is called

**erythema function**, you can find it below.

Given the

**erythema function**w(lambda)

And the irradiance spectrum I(lambda), we may note that the 1/25 coefficients makes the UVI dimensionless.

We have tell that the sensor we are using measures ultraviolet intensity between a range.

We are going to consider just:

- Ultraviolet A (
**UVA**): wavelength between 315nm and 400nm - Ultraviolet B (
**UVB**): wavelength between 280nm and 315nm

*assume a fixed ratio between UVA and UVB*because we know that more than 95% of the ultraviolet radiation that reaches the Earth's surface is the UVA. So we can say

And, because this sensor measure just UVA and UVB, we can also say

and

Our sensor gives us a voltage output.

To make math simpler we can average the erythemal function w(lambda) for UVA and UVB as follows:

Now, we can take a look to the UV index function, we notice it as a mW/m2 index, so we have to covert the correlation function to mW/m2

Then we can substitute things in there:

We finally get

As example, if we consider a fixed temperature of 25degree, we get:

If you have a calibrated UV index meter you can correlate that function with the meter and adjust the offset of this equation.

Where o is the offset calculated using the equation

Reference:

*"Ultraviolet Sensor IC with Voltage Output by ROHM and LAPIS semiconductor"*. Note that on that paper they use a different method of correlation to find out the correlation curve.

In conclusion we have take a look at this UV sensor, trying to correlate the sensor output to the UV intensity, eventually considering also the environment temperature.

We have then looked at the UV index function, which is fairly usefull as an index for UV impact on health.

This library have been developed on an ATmega8 running at 1Mhz.

**Updates**

*Robles Pedro*makes me notice a typo error in the*UVI=10.463V-10.4076*, the previous blog post has a typo error on that formula. So thank you Pedro.

**Code**

**Notes**

- read risk disclaimer
- excuse my bad english