Light
Interfacing LDR (Photoresistor) Light with Arduino Uno
What is the LDR (Photoresistor)?
The LDR (Light Dependent Resistor), also called a photoresistor or photocell, is a passive component whose resistance drops sharply as light increases — typically from over 1MΩ in darkness down to a few hundred ohms in bright light. It has no polarity and no active circuitry, so it cannot be read directly by a microcontroller: you build a voltage divider with a fixed resistor (commonly 10kΩ) so the changing resistance becomes a changing voltage an ADC pin can measure.
It is the go-to sensor for automatic night lights, streetlight controllers, light-following robots, camera exposure triggers, and simple ambient-light dimmers. The catch that trips up beginners is response time: cheap CdS-based LDRs are slow (tens of milliseconds to react) and non-linear, so they suit on/off or slow-trend lighting decisions but not fast or precise lux measurements — for that, use a digital light sensor like BH1750 instead.
Specifications
| Type | Cadmium Sulfide (CdS) photoresistor |
| Package size | 5mm (also 4mm, 7mm, 12mm) |
| Dark resistance | ~1MΩ (typical, 0 lux) |
| Light resistance | ~200Ω–1kΩ (typical, 10 lux) |
| Spectral peak response | ~540nm (green, close to human eye) |
| Response time | ~20–30ms rise, ~30ms+ fall (slow, non-linear) |
| Max power rating | 100mW (typical 5mm package) |
| Max voltage | 150V DC (passive, not logic-level restricted) |
| Interface | Analog only — needs a voltage divider and ADC pin, no library |
LDR (Photoresistor) Pinout
| Pin | Name | Description |
|---|---|---|
| 1 | Leg A | No polarity — connect to VCC or the divider midpoint, either leg works |
| 2 | Leg B | No polarity — connect to the fixed resistor / ground side of the divider |
Two-leg passive component, no polarity. Standard circuit: LDR from VCC to a sense node, fixed 10kΩ resistor from that sense node to GND, sense node to your ADC pin. Swap the LDR and resistor positions to invert whether brighter light reads higher or lower.
Setting Up LDR (Photoresistor) with Arduino Uno
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| Leg A | 5V | — |
| Leg B | A0 + 10kΩ to GND | — |
Example code
Straightforward 5V divider, no library or level-shifting needed.
Related Guides & Projects

Arduino Uno R3 Pinout: Every Pin Explained (Digital, Analog, PWM, Power)
Complete Arduino Uno R3 pinout reference: all 14 digital pins, 6 analog inputs, PWM, UART, SPI, I2C, AREF, and power rails explained with wiring tips and common mistakes.

Ultimate Arduino Mega 2560 Pinout Guide: Complete Power & I/O Reference
Master the Arduino Mega 2560 pinout. Detailed reference for all 54 digital pins, 16 analog inputs, PWM, UARTs, SPI, I2C, interrupts, and power. Includes a printable table and practical wiring tips.

Interfacing HC-SR04 Ultrasonic Sensor with Arduino
Measure distance accurately using ultrasonic sound waves and an Arduino Uno — no complex math, no expensive hardware.
HC‑SR04 Ultrasound Distance Measurement with Arduino – Parking Alert (LCD & Buzzer)
Learn HC‑SR04 ultrasound distance measurement with Arduino Uno. Build a parking alert system with 16x2 LCD and buzzer – shows distance and beeps faster as you approach.