UV Sensor ML8511 with Arduino for Ultra Violet Light Meter (UV Meter)

UV Sensor ML8511 with Arduino for Ultra Violet Light Meter (UV Meter) (Last Updated On: December 1, 2018)

Introduction:

In this post we are interfacing UV Sensor ML8511 with Arduino for Ultra Violet Light Meter. UV – Ultraviolet light radiation occurs from 10nm to 400nm wavelength in electromagnetic spectrum, to get effective output in accordance with UV light the ML8511 sensor from lapis semiconductor helps a lot. This sensor comes in surface mount type package hence better to use in breakout board.




The ML8511 UV sensor detects 280nm – 390nm light in a better way, this wavelength is categorized as part of the UVB-burning rays spectrum and most of the UVA-tanning rays spectrum.


UV Sensor ML8511:

Introduction:

The ML8511 UV sensor is an easy to use ultraviolet light sensor. The MP8511 UV (ultraviolet) Sensor works by outputing an analog signal in relation to the amount of UV light that’s detected. This breakout can be very handy in creating devices that warn the user of sunburn or detect the UV index as it relates to weather conditions.

This sensor detects 280-390nm light most effectively. This is categorized as part of the UVB (burning rays) spectrum and most of the UVA (tanning rays) spectrum. It outputs a analog voltage that is linearly related to the measured UV intensity (mW/cm2). If your microcontroller can do an analog to digital signal conversion then you can detect the level of UV!

Block Diagram:

UV Sensor ML8511 with Arduino for Ultra Violet Light Meter (UV Meter)

The sensor ML8511 has a UV photodiode and Internal Amplifier which will converts photo current to voltage output depending on the UV light intensity.

Through the voltage output it is easy to interface with external micro controllers and ADC.

UV Characteristics:

UV Sensor ML8511 with Arduino for Ultra Violet Light Meter (UV Meter)

The characteristics drawn between output Voltage from the sensor with respect to UV intensity (mW/cm²) at constant VDD supply. The curves in different color represents sensor operation in different temperature range.




UV Sensor ML8511 with Arduino for Ultra Violet Light Meter:

Components Required:

1. Arduino Uno Board
2. ML8511 UV Sensor - (Buy Online from Amazon)
3. 16*2 LCD
4. Breadboard
5.Connecting Wires

Circuit Diagram & Connection:

UV Sensor ML8511 with Arduino for Ultra Violet Light Meter (UV Meter)


Program/Source Code:

Copy the code from below for interfacing UV Sensor ML8511 with Arduino for Ultra Violet Light Meter. Upload this code to Arduino Uno Board

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
int UVOUT = A0; //Output from the sensor
int REF_3V3 = A1; //3.3V power on the Arduino board

void setup()
{
Serial.begin(9600);
lcd.begin(16,2);

pinMode(UVOUT, INPUT);
pinMode(REF_3V3, INPUT);
}

void loop()
{
int uvLevel = averageAnalogRead(UVOUT);
int refLevel = averageAnalogRead(REF_3V3);

//Use the 3.3V power pin as a reference to get a very accurate output value from sensor
float outputVoltage = 3.3 / refLevel * uvLevel;

float uvIntensity = mapfloat(outputVoltage, 0.99, 2.9, 0.0, 15.0);

Serial.print("MP8511 output: ");
Serial.print(uvLevel);

Serial.print(" MP8511 voltage: ");
Serial.print(outputVoltage);

lcd.setCursor(0, 0);
lcd.print("UV Ray Intensity");

Serial.print(uvIntensity);
lcd.setCursor(1, 1);
lcd.print(uvIntensity);

Serial.print(" UV Intensity (mW/cm^2): ");
lcd.setCursor(7, 1);
lcd.print("mW/cm^2");

Serial.println();

delay(300);
lcd.clear();
}

//Takes an average of readings on a given pin
//Returns the average
int averageAnalogRead(int pinToRead)
{
byte numberOfReadings = 8;
unsigned int runningValue = 0;

for(int x = 0 ; x < numberOfReadings ; x++)
runningValue += analogRead(pinToRead);
runningValue /= numberOfReadings;

return(runningValue);
}

float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}





Video Tutorial:

Recommended For You

Ask A Question .......

Close