Light UV Ultraviolet Ray Detection Sensor Module GY-8511

AED 53.55

Low stock


The ML8511 UV sensor is an ultraviolet light sensor that works by outputting an analog signal in relation to the amount of UV light that detected. This Module can be very helpful in creating devices that warn the user of sunburn or detect the UV index as it relates to weather conditions.


Its outputs are linear analog voltage related to the measured UV intensity (mW/cm2) and it detects light with a spectrum of 280-390nm most effectively. any Microcontroller like Arduino with ADC can detect the level of UV. It has Low supply current of 300uA and a low standby current of 0.1A. It comes with Small and thin surface-mount package (4.0mm x 3.7mm x 0.73mm(0.16″ x 0.15″ x 0.03″), 12-pin ceramic QFN).

How does it work:

The UV Sensor ML8511 has Photodiode sensitive to UV-A and UV-B. Then it has an internal Embedded operational amplifier which will convert photocurrent to voltage output depending on the UV light intensity. and then it will output it as Analog voltage. Through the voltage output.

GY-8511 Sensor Wiring With Arduino:

GY-8511 UV Sensor Wiring With Arduino

The circuit diagram for interfacing UV sensor ML8511 with Arduino and LCD Display is given Above. The 16x2 LCD RS, EN, D4, D5, D6, D7 is connected to Arduino 12, 11, 5, 4, 3, 2 pins. LCD is supplied with 5V. It has 10K POT attached to LCD pin 3 to adjust the contrast.

The UV Sensor has 5 pins Vin, 3V3, GND, OUT, EN.  The EN pin and 3V3 pin are connected to the 3.3V pin of Arduino. The same 3V3 Pin is connected to Analog pin A1 which is used as a reference voltage. The out pin is connected to A0 of Arduino and GND to GND.

Arduino Code for GY-8511 UV Sensor :

The ML8511 Arduino Source Code is given below. upload it to the Arduino Board.

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//Hardware pin definitions
int UVOUT = A0; //Output from the sensor
int REF_3V3 = A1; //3.3V power on the Arduino board
void setup()
  lcd.begin(16, 2);
  pinMode(UVOUT, INPUT);
  pinMode(REF_3V3, INPUT);
  Serial.println("ML8511 example");
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.8, 0.0, 15.0); //Convert the voltage to a UV intensity level
  Serial.print("output: ");
  Serial.print("ML8511 output: ");
  Serial.print(" / ML8511 voltage: ");
  Serial.print(" / UV Intensity (mW/cm^2): ");
  lcd.print("UV Ray Intensity");
  lcd.setCursor(0, 1);
  lcd.print(" mW/cm^2");
//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;
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;