KY-018 Photoresistor Module


Warning: Creating default object from empty value in /home/customer/www/arduinomodules.info/public_html/wp-content/plugins/auto-affiliate-links-block/auto-affiliate-links-block.php on line 384

The KY-018 Photoresistor module is used to measure light intensity. The resistance will decrease in the presence of light and increase in the absence of it. The output is analog and determines the intensity of light.

Compatible with many popular microcontrollers like Arduino, ESP32 and others.

KY-018 photoresistor Fritzing part image
Arduino KY-018 Photoresistor Module

KY-018 Specifications

This module consists of a photoresistor, a 10 kΩ in-line resistor and 3 male header pins.

Operating Voltage3.3V ~ 5V
Output TypeAnalog

Connection Diagram

Connect the Power line (middle) and ground (-) to +5 and GND respectively. Connect signal (S) to pin A2 on the Arduino.

KY-018Arduino
SPin A2
middle+5V
GND
Arduino KY-018 Keyes photo resistor connection diagram

KY-018 Arduino Code

The following Arduino sketch will output readings from the photoresistor, cover the module with your hand to prevent light on it and the output values will be low, point a light to the sensor and the values will be high.

int sensorPin = 2; //define analog pin 2
int value = 0; 
void setup() {
	Serial.begin(9600); 
} 
void loop() {
	value = analogRead(sensorPin); 
	Serial.println(value, DEC); // light intensity
								// high values for bright environment
								// low values for dark environment
	delay(100); 
}

Downloads

KY-018 Related Products

Hot Deals from AliExpress

Leave a Comment


9 thoughts on “KY-018 Photoresistor Module”

  1. In my serial monitor, I am getting the high values for lights absence and the low values for light presence… (using arduino uno, and all is pluged correctly)

    Reply
  2. Hello, I got high values for dark environments and viceversa. I’m using NodeMCU and KY-018 wired on A0 analog PIN.

    Any idea of why?

    Reply
  3. There is no information on what photoresistor that is used. There are several types with different characteristics as resistance per lux input.
    Example: GL5516, GL5528, GL5539 etc.
    Would be much appreciated.

    Reply
      • Awesome, thanks for the info! I took the description from the documentation provided by the manufacturer in Chinese, sadly it doesn’t provide specific information on the photoresistor itself. I’ll look around to see if I can get more the right specs.

        Reply
    • Hi, sorry about that. I checked the link and it should be working now, please let me know if you have any problems.

      Reply
      • @ArduinoModules. Sorry sir, but the download button after solving the Captcha is not downloading..

        Reply