Using a ML8511 UV sensor and an Arduino Nano to test UV-filtering properties of sunglasses

Do cheap freebie sunglasses really block UV light or are they mostly just toys, which pose a serious health risk to your eyes? That’s the question I asked myself when coming across one of my wife’s cheesy glasses. I always warned her, but never could proof the potential risk of increased UV exposure caused by non-blocking tinted glasses. Until now…

After buying one of those cheap Arduino Nano clones (oh the irony), I started experimenting with all kind of sensors. One of them was the ML8511. This sensor detects 280 – 390 nm light most effectively. This wavelength is categorized as part of the UVB spectrum and most of the UVA spectrum. Overexposure to UVA radiation has been linked to the development of certain types of cataracts, and research suggests UVA rays may play a role in development of macular degeneration.

The setup was straight forward: I hung an UV LED torch over the sensor using my helping hand. The emitted 395 nm light is slightly out of range, but the torch has proven to be a reliable source of detectable UV light. Pointing the beam directly at the photo resistor was crucial as the amount of measurable UV light decreases rapidly on the beam’s edges. I used a sketch from Sparkfun to read the sensor’s output. The unit measure wasn’t really necessary as I was mainly interested in the relative amount of absorbed UV light. But having the Milliwatts per square Centimeter came in handy. The problem was that the script outputted -1 mW/cm² when being in an UV-free environment. The solution was unexpected: The voltage of the “supposed to be 1% accurate” 3v3 Nano output was in fact only 10% accurate and came out as being 3.61 volts. Seems like testing cheap sunglasses using even cheaper tools isn’t the best idea. However, the sketch’s output can be calibrated by adjusting the hard-coded reference variable in the script to the actual reference voltage.

All tested sunglasses absorbed a fair amount of UV light. The best pairs filtered the UV light nearly completely (meaning below a level that can be detected by an ML8511 in this particular setup and ignoring the minor UV halo around the frame due to the sensor not being fully covered by the glass). The rest ranged between letting 1 – 10% of UV irradiation to pass through – proving that all sunglasses had UV-filtering properties. Given that a good UV protection can be bought for less than 10 Euros (the best pair tested), it is probably a good idea to not use freebie sunglasses if you have a bad gut feeling. As general advice, make sure that you buy your glasses from trusted retailers (optician, pharmacy, supermarket, etc.) or let them be tested.

Seeing is believing. 😉


UV test setup with ML8511 and Arduino Nano R3
Serial monitor output of the sketch used



Reference and further reading:

Leave a Reply

Your email address will not be published. Required fields are marked *