Overview

The KY-018 is a classic photoresistor (Light Dependent Resistor / LDR) module from the Keyes 37-in-1 sensor kit series. Built around a 5mm Cadmium Sulfide (CdS) photoconductive cell, its internal electrical resistance decreases continuously as ambient light exposure increases.

The module pairs the LDR in series with an onboard 10 kΩ10\ \text{k}\Omega fixed pull-down resistor to form a simple voltage divider circuit. It outputs a continuous analog voltage (AO) that rises under bright illumination and drops in dark environments, making it ideal for automatic nightlights, solar panel trackers, and light level monitors.

Quick reference

Operating voltage (VCC)3.3 V to 5.5 V DC (5.0 V nominal)
Sensor type5mm CdS Photoconductive LDR Cell
Dark resistance (RdarkR_{dark})>1.0 MΩ> 1.0\ \text{M}\Omega (in pitch darkness)
Light resistance (R10luxR_{10lux})10 kΩ20 kΩ10\ \text{k}\Omega \dots 20\ \text{k}\Omega (at 10 Lux ambient light)
Peak spectral response540 nm540\text{ nm} (closely matches human eye visual response)
Output signalAnalog voltage (0VVCC0\text{V} \dots V_{CC})
Fixed resistor10 kΩ10\ \text{k}\Omega onboard pull-down resistor

Pinout

Standard 3-pin 0.1" (2.54 mm) module header:

text
        ┌───────────────────┐
        │  [CdS LDR Sensor] │
        └─┬───────┬───────┬─┘
          S      VCC     GND
          1       2       3
PinNameTypeDescription
1 (S)AO / SIGNALAnalog OutputVoltage divider output pin (high voltage = bright, low voltage = dark)
2 (middle)VCCPowerSupply power input (+3.3 V to +5.5 V DC)
3 (-)GNDPowerGround reference (0 V)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVCCV_{CC}3.35.05.5VDC
Dark ResistanceRdarkR_{dark}1.05.010.010 seconds after light removal
Light Resistance (10 Lux)R10R_{10}10152010 Lux illumination (2854K)
Response Time (Rise)triset_{rise}2030msDark to light step
Response Time (Fall)tfallt_{fall}3040msLight to dark step
Spectral Peakλpeak\lambda_{peak}540nmGreen/yellow light sensitivity

Voltage Divider Circuit Math

VAO=VCC×(10kΩRLDR+10kΩ)V_{AO} = V_{CC} \times \left( \frac{10\text{k}\Omega}{R_{LDR} + 10\text{k}\Omega} \right)

  • Bright Room (RLDR2 kΩR_{LDR} \approx 2\ \text{k}\Omega):

VAO=5.0V×(10k2k+10k)4.16V(ADC850)V_{AO} = 5.0\text{V} \times \left( \frac{10\text{k}}{2\text{k} + 10\text{k}} \right) \approx 4.16\text{V} \quad (ADC \approx 850)

  • Pitch Darkness (RLDR2 MΩR_{LDR} \approx 2\ \text{M}\Omega):

VAO=5.0V×(10k2000k+10k)0.02V(ADC5)V_{AO} = 5.0\text{V} \times \left( \frac{10\text{k}}{2000\text{k} + 10\text{k}} \right) \approx 0.02\text{V} \quad (ADC \approx 5)

Wiring

KY-018 PinArduino UnoESP32Notes
VCC (Middle)5V / 3.3V3.3VPower rail
GND (-)GNDGNDSystem ground
S (SIGNAL)Analog Pin A0VP / GPIO36Analog light level voltage

Example

cpp
const int ldrPin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int rawADC = analogRead(ldrPin);
  float voltage = (rawADC / 1023.0) * 5.0;

  Serial.print("Raw ADC: "); Serial.print(rawADC);
  Serial.print(" | Voltage: "); Serial.print(voltage); Serial.print(" V | Status: ");

  if (rawADC > 700) {
    Serial.println("Bright Daylight");
  } else if (rawADC > 300) {
    Serial.println("Indoor Lighting");
  } else {
    Serial.println("Dark Environment");
  }

  delay(300);
}

Common mistakes

  • Expecting calibrated Lux values: CdS photoresistors have high batch tolerances (±40%\pm 40\%) and non-linear logarithmic response curves. They are qualitative ambient light indicators rather than precision Lux meters (use BH1750 or TSL2591 for calibrated Lux).
  • Inverting power and ground pins: Connecting VCC to Pin 3 (-) short-circuits the supply rail through the 10 kΩ10\ \text{k}\Omega resistor when the LDR becomes bright.

Notes

  • KY-018 vs TEMT6000 vs BH1750: KY-018 uses a simple CdS photoresistor; TEMT6000 uses an NPN phototransistor; BH1750 uses a calibrated digital I2CI^2C sensor.

Assets & downloads