ESP32 KY-018 Photoresistor Module

KY-018 Photoresistor Module image

KY-018

Protocol: Analog

Overview

The KY-018 is a photoresistor module that detects ambient light levels. It outputs an analog signal corresponding to the light intensity, making it suitable for projects that require light sensing capabilities.

About KY-018 Photoresistor Module

The KY-018 Photoresistor Module is a light-sensitive sensor that varies its resistance based on the ambient light intensity. It contains a light-dependent resistor (LDR) and a fixed 10 kΩ resistor, forming a voltage divider circuit. As the surrounding light increases, the LDR’s resistance decreases, resulting in a higher output voltage. This module operates at a voltage range of 3.3V to 5V and provides an analog output signal. It’s commonly used in applications such as ambient light detection, automatic lighting control, and light intensity measurement.

Where to Buy

KY-018 Photoresistor Module

Starting from

1$ per unit

Amazon com
Amazon.com Ships worldwide
View Price
Amazon de
Amazon.de Ships to EU
View Price
Aliexpress
AliExpress Best value
View Price

Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

Technical Specifications

Operating Voltage 3.3V - 5V
Output Type Analog
Fixed Resistor Value 10 kΩ
Dimensions 21 x 15 x 6 mm

Pinout Configuration

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

  • Pin (-): Connects to ground (GND).
  • Pin (middle): Connects to VCC (3.3V to 5V).
  • Pin (S): Outputs the analog signal; connect to an analog input on your microcontroller.

Wiring with ESP32

  • KY-018 Pin (-): Connect to ESP32 GND.
  • KY-018 Pin (middle): Connect to ESP32 3.3V or 5V.
  • KY-018 Pin (S): Connect to an analog GPIO pin on ESP32 (e.g., GPIO36).

Troubleshooting Guide

Common Issues

❌ No Response from Sensor

⚠️ Incorrect or Fluctuating Readings

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++
🐍

MicroPython Example

Python

Conclusion

The ESP32 KY-018 Photoresistor Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.