Monday, June 3, 2019

AVR ATmega UV meter using ML8511

This device is a UV meter built on top of an ATmega8 microcontroller and a ML8511 UV sensor.
It measures UV light intensity and the UV index.

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.

It features an LCD display that shows you all the measurements, a temperature sensor to correlate the output against temperature too, the UV led is attached to this meter makes this device particularly suitable to test glass UV lens. It also works with a 9V battery.
The LCD displays UV light intensity in mW/cm2, UV index, current temperatore, a light intensity offset, that this the difference from two values of UV, and the UV wavelength measured.
The light intensity offset is usefull to measure the real UV intensity reduction of a lens for example.
In my case the UV led mounted is a 3W@365nm, so I set the wavelength to 365, but one can change it using the menu that is accessible by long pressing the Select button.

For further information on the sensor library please take a look at my blog post here:


  • read risk disclaimer
  • excuse my bad english


  1. Hi, do you know how to convert intensity (mW/cm^2) to UV index in arduino?

    1. Hello, this is not Arduino code, but it still convert light intensity to UV index.

    2. I see...but do you know whether it is possible to directly convert UV intensity to UV index?

      For example, to date, the highest intensity reading I've got is about 6.53mW/cm^2 at around noon until 2 PM. But because I'm not sure how to use your code in Arduino, do you have any idea on how I should do the conversion? Do I have to compare with 25mW/m^2 (UV = 1)?

      p.s: Thanks for replying. :')

    3. It's not a comparison. By definition UV index depends on irradiance and wavelenght. Take a look here:
      You should find it... If not came back here ;)

    4. Hi, I'm trying to convert UV intensity to UV index in Arduino IDE, could you please me a bit?

    5. Hello Sweet&Flavor, take a look at the ml8511_getuvindex function. You can easly port this function. Take in mind that you should understaind how this conversion works, for that reason please read my comment above.