KY-018 Photoresistor module with Arduino


KY-018 Photoresistor module is a type of light sensor that measures the amount of light in an environment. It is composed of a photoresistor and a resistor that form a voltage divider circuit. The resistance of the photoresistor changes depending on the amount of light it receives, which changes the voltage output of the circuit. This voltage output can be read by an Arduino microcontroller board to detect changes in light levels and trigger different actions.

The KY-018 module is easy to use and can be connected to an Arduino board or any microcontroller with analog input capabilities. The module is composed of a photoresistor and a fixed resistor that form a voltage divider circuit. The photoresistor’s resistance changes based on the amount of light it receives, which causes the voltage output of the circuit to vary. This voltage output can be measured by an Arduino board, which can then trigger different actions based on the measured light levels.

Hardware Required

You will require the following Hardware Components for the Interfacing of the KY-018 Photoresistor module with arduino.

Components#Buy From Amazon
Arduino UNO1Buy Link
KY-018 Photoresistor module1Buy Link
Jumper WiresBuy Link
Breadboard1Buy Link

What is the KY-018 module?

KY-018 Photoresistor module is a simple yet versatile sensor that can be used in a wide range of applications that require light sensing. It is an essential component of many DIY projects, such as automatic lighting control, plant growth monitoring, light intensity measurement, security systems, and interactive art installations.

KY-018 Photoresistor module is a great sensor for hobbyists, makers, and engineers who want to experiment with light sensing in their projects. Its low cost, simplicity, and versatility make it a popular choice for various applications, from basic sensing to more complex control systems. With its easy-to-use interface, the KY-018 module allows you to quickly and easily integrate light-sensing capabilities into your projects and experiments.



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

Operating Voltage3.3V ~ 5V
Output TypeAnalog



Pin Configuration

Pin NamePin Type
SSignal Pin
MiddlePower Pin
( – )Ground Pin

Circuit Diagram

The following circuit shows you the connection of the KY-018 Photoresistor module with Arduino Please make the connection carefully


Circuit Connections

Place the module on the Breadboard and connect the Power line (middle) and ground (-) of the module to +5 and GND of the arduino and then connect the signal (S) Pin to pin A2 on the arduino respectively

Pin A2S

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow


The given below Arduino code will output readings from the photoresistor, cover the module with your hand to stop the light on it and the output values will be low, point the light to the sensor and the values will be high.

//For more Projects:
int sensorPin = 2; //define analog pin 2
int value = 0; 
void setup() {
void loop() {
	value = analogRead(sensorPin); 
	Serial.println(value, DEC); // light intensity

// high values for bright environment
// low values for dark environment



  1. Automatic lighting control: With a KY-018 module and an Arduino, you can make an automatic lighting control system that turns on lights when the environment is dark and turns them off when there is enough light. This is a useful application for outdoor lighting, streetlights, and security lighting.
  2. Plant growth monitoring: KY-018 can be used to monitor the number of light plants receive, which is crucial for their growth. By connecting the KY-018 module to an Arduino board, you can measure the light levels and trigger actions such as turning on artificial lights or opening/closing curtains to ensure optimal growing conditions.
  3. Light intensity measurement: KY-018 can be used to measure the intensity of light in an environment, which is useful for scientific experiments, photography, and light-sensitive applications. By reading the voltage output of the module with an Arduino, you can measure the light intensity and trigger actions based on that measurement.
  4. Security system: KY-018 can be used as a component of a security system to detect intruders by measuring changes in light levels. For example, if someone walks by a window and blocks light from reaching the KY-018 module, the change in light levels can trigger an alarm or send a notification to a mobile device.
  5. Interactive art installations: KY-018 can be used in interactive art installations that respond to changes in light levels. By connecting the module to an Arduino, you can trigger actions such as turning on lights, activating motors, or playing sounds based on changes in light levels. This is a great way to create immersive and engaging art installations.

Leave a Comment