Comments: ML8511 UV Sensor Hookup Guide


Comments 10 comments

  • Hi, very good and easy project. I did it with an Arduino Nano and it is perfect. I just brought the interval to 200 mS, to avoid too much flickering on the output. Now I am going to add a LCD display, but you know which is my main problem?? The case! The UV sensor cannot be mounted behind a transparent glass or plastic, otherwise it will filter UV rays, so it should be exposed to the light without any protection. Suggestions?

    Thanks Fabio

  • Hi all, I am running this code but I think I have a problem. My value UV Intensity (mWcm2) is a negative value. Shouldn’t it be positive?

  • “Radiant exposure (H), is dose, and is described in joules (unit of energy) per square meter (J m2) or joules per square centimeter (J cm2). Note that a watt is a joule per second thus the dose rate (W cm2) multiplied by the exposure duration (seconds) equals dose (J cm2).”

    So what do I have to enter for the code to get the dose?

  • Hi, I read that you were having problems with the unit conversion. I was wondering why you decided to use mW/cm2 rather than mW/m2. If you are mapping the values as the UV index, then 1 UV index unit equals 25 mW/m2. Is this the reason you had problems with the units?

  • Hello, I’d like to let you know that me and my team tried to use this sensor along with an Arduino uno to measure the UV index from the sun rays emitted by the sun, however, we’re getting strange readings of an output voltage of “3.8” which results into a UV index around “22” INDOORS which is strange. Also, adding to that, whether or not the sensor is exposed to sunlight, the results do not change dramatically, only by a few small decimal points, can someone help clarify what we might be doing wrong?

    • I had the same problem and it was a result of having another shield mounted on the Arduino Uno (in this case, the SparkFun Weather Shield). On the Weather Shield, all the analog pins are in use, no matter what you do in the code. So if you try connecting the UV sensor output to one of these analog pins, there will be interfering voltage from another source resulting in a higher than expected reading. Try a board with more analog pins, such as an Arduino Mega.

  • I want to use this sensor with a LiPo battery pack as well as an TSL2561 and DHT22 sensor set. Can the EN lead of the ML8511 UV sensor be set to another Analogue pin than A0?

    Thank you Matadormac

  • Hey. In the code “ VCC / 1023 = 3.3V / 669 ”, where did you get the value 669 from? Based on the ratio and my knowledge, I would assume that in a 5V reference, the voltage would be mapped from the value 0 to 1023. So in a 3.3V reference, how are the values mapped?

    • 699 is an example reading that you would obtain from the ADC when doing an analogRead of the 3.3V pin.

      The ADC will indeed return values from 0 to 1023. If you power an Arduino from a USB port it is often not really 5V for VCC, it’s often more like 4.7V. But when the board is powered with 4.7V or 5V or 5.2V the 3.3V pin will always be a very accurate 3.3V. So to really know what VCC is we do an ADC on the 3.3V pin and back out what VCC actually is.

      In this example:

      VCC / 1023 = 3.3V / 669

      VCC would be 5.05V. Pretty close to 5V.

If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!