Component guide · Beginner · 4 min read
LDR Photoresistor and Light Sensor Modules

5mm LDR, LM393 Digital LDR Boards, Keyestudio, ACEBOTT, Grove GL5528, Crowtail GL5516 and APDS-9002, DFRobot PT550 and HS-S20 Brightness Modules
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
An LDR is a resistor whose value drops as light increases: about 10 to 20 kilohms in room light and over a megaohm in darkness. Put it in a voltage divider with a 10k resistor and read the voltage on an analog pin. LM393 modules add a comparator and a pot so you also get a digital dark or bright output. APDS-9002 and PT550 modules give a more linear, eye-like response.
Key specs at a glance
- Element
- CdS LDR (GL5516, GL5528) or phototransistor (APDS-9002, PT550)
- Outputs
- Analog (AO), digital (DO) on LM393 boards
- Supply
- 3.3V to 5V
- Response
- LDR is slow (tens of ms); phototransistors are faster
- Range
- Relative brightness, not calibrated lux
- Connectors
- Pins, PH2.0, Grove or Crowtail
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 15 mm LDR Light Dependent Resistor₹8
Option 2Digital LDR Light Sensor Module for Arduino – LM393 Comparator, Adjustable Sensitivity₹31
Option 3LM393 Light-Dependent Resistor Sensor Module – Digital/Analog Output₹29
Option 4Photosensitive Resistor Sensor Module for Arduino – Light Dependent Resistor (LDR)₹28
Option 5Keyestudio Photoresistor Light Dependent Resistor Sensor Module – 5V DC₹189
Option 6ACEBOTT QB068 Photosensitive Sensor Module – Analog Output, Easy-Plug₹175
What the LDR photoresistor and analog light sensor modules is
LDR photoresistor light sensor modules change resistance with light, giving an analog voltage or a digital output from a comparator, for night lights and light-following robots.
Use these for night lights, day/night switching, line-of-sight trip beams and simple brightness feedback. Read the analog value and pick a threshold for your room; for real lux values use a digital lux sensor like the BH1750.
On LM393 boards turn the pot until the DO LED changes at the light level you want. Most boards pull DO LOW when it is bright, but check yours.
LDR photoresistor and analog light sensor modules pinout
The pins on the LDR photoresistor and analog light sensor modules and what each one does.
| Pin | Function |
|---|---|
| VCC | 3.3-5V |
| GND | Ground |
| AO | Analog output |
| DO | Digital output (LM393 boards) |
| Pot | Sets the DO threshold |
- VCC
- 3.3-5V
- GND
- Ground
- AO
- Analog output
- DO
- Digital output (LM393 boards)
- Pot
- Sets the DO threshold
Wiring the LDR photoresistor and analog light sensor modules
For a bare LDR: LDR from 5V to A0, 10k resistor from A0 to GND.
| LDR photoresistor and analog light sensor modules pin | Connection | Note |
|---|---|---|
| VCC | 5V | Or 3.3V |
| GND | GND | Common |
| AO | A0 | Analog read |
| DO | D2 | Optional |
- VCC
- Connection:
- 5V
- Note:
- Or 3.3V
- GND
- Connection:
- GND
- Note:
- Common
- AO
- Connection:
- A0
- Note:
- Analog read
- DO
- Connection:
- D2
- Note:
- Optional
Example code
If you put the LDR on the GND side of the divider, the reading goes the other way; flip the comparison.
const int LDR = A0;
const int LED = 9;
const int DARK = 300; // tune for your room
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop() {
int light = analogRead(LDR); // higher = brighter with LDR on the 5V side
Serial.println(light);
digitalWrite(LED, light < DARK ? HIGH : LOW);
delay(200);
}Setup and tuning
VCC to 3.3 or 5 V, GND, AO to an analog pin and DO to a digital pin.
use a 10 kΩ resistor in a divider and read the middle point.
turn the trimmer to set when DO switches.
many modules go LOW in bright light and HIGH in the dark.
LDRs react slowly (tens of ms), fine for light levels but not data.
What you need
Shop this list18 of 19 found in our store · ₹2,579
5 mm LDR Light Dependent Resistor: the part this guide covers5 mm LDR Light Dependent Resistor₹8
Digital LDR Light Sensor Module for Arduino – LM393 Comparator, Adjustable Sensitivity: another version this guide coversDigital LDR Light Sensor Module for Arduino – LM393 Comparator, Adjustable Sensitivity₹31
LM393 Light-Dependent Resistor Sensor Module – Digital/Analog Output: another version this guide coversLM393 Light-Dependent Resistor Sensor Module – Digital/Analog Output₹29
Generic Photosensitive Resistor Sensor Module for Arduino – Light Dependent Resistor (LDR): another version this guide coversPhotosensitive Resistor Sensor Module for Arduino – Light Dependent Resistor (LDR)₹28
Keyestudio Photoresistor Light Dependent Resistor Sensor Module – 5V DC: another version this guide coversKeyestudio Photoresistor Light Dependent Resistor Sensor Module – 5V DC₹189
ACEBOTT QB068 Photosensitive Sensor Module – Analog Output, Easy-Plug: another version this guide coversACEBOTT QB068 Photosensitive Sensor Module – Analog Output, Easy-Plug₹175
DFRobot Gravity Analog Ambient Light Sensor for Arduino – PT550 Photodiode, 1-6000 Lux: another version this guide coversDFRobot Gravity Analog Ambient Light Sensor for Arduino₹347
Elecrow Crowtail Light Sensor 2.0 Module w/ GL5516 Photoresistor & LMV358 Chip – Analog Output: another version this guide coversElecrow Crowtail Light Sensor 2.0 Module w/ GL5516 Photoresistor & LMV358 Chip – Analog Output₹147
Seeed Studio Studio Grove Light Sensor v1.2 – GL5528 Phototriode, Analog Output: another version this guide coversSeeed Studio Grove Light Sensor v1.2 – GL5528 Phototriode, Analog Output₹279
HS-S20-L Ambient Brightness Sensor Module – PH2.0 3P Terminal: another version this guide coversHS-S20-L Ambient Brightness Sensor Module – PH2.0 3P Terminal₹59
HS-S20B Ambient Brightness Sensor Module – PH2.0 Terminal: another version this guide coversHS-S20B Ambient Brightness Sensor Module – PH2.0 Terminal₹68
HS-S20L-B Ambient Brightness Sensor – PH2.0 3P Interface: another version this guide coversHS-S20L-B Ambient Brightness Sensor – PH2.0 3P Interface₹109
HS-S20P Ambient Brightness Sensor Module – PH2.0 Terminal: another version this guide coversHS-S20P Ambient Brightness Sensor Module – PH2.0 Terminal₹59
HS-S20P-B Ambient Brightness Sensor Module – PH2.0 Terminal Wire: another version this guide coversHS-S20P-B Ambient Brightness Sensor Module – PH2.0 Terminal Wire₹79
Elecrow Crowtail Luminance Sensor 2.0 Module w/ APDS-9002 – 3.3V/5V: another version this guide coversElecrow Crowtail Luminance Sensor 2.0 Module w/ APDS-9002 – 3.3V/5V₹196
Seeed Studio Studio Grove Luminance Sensor Module – APDS-9002 Analog Output: another version this guide coversSeeed Studio Grove Luminance Sensor Module – APDS-9002 Analog Output₹660Closest match, check the specs- Uno R3 development board: the controller used in the wiring tableFind this part
Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
Solderless breadboard: to build without solderingSolderless Breadboard₹68
Alternatives and when to choose them
- BH1750 light sensor: real lux readings.
- TEMT6000 light sensor: phototransistor module.
- Photocell street light switches: ready mains switches.
Common mistakes to avoid
- Expecting lux values.
- Reading AO on a digital pin.
- Powering at 5 V into ESP32.
- Placing the LDR where the lamp shines on it.
Frequently asked questions
Can an LDR measure lux?
Only roughly, because LDRs vary a lot; use a BH1750 or VEML7700 when you need real lux values.
Why is the digital output reversed?
Most modules pull DO LOW in bright light and HIGH in the dark, so invert the logic in your code.
Which resistor goes with a bare LDR?
A 10 kΩ fixed resistor in a divider suits most LDRs; use a larger value for dim rooms.
Why does it react slowly?
LDRs take tens of milliseconds to settle, so they suit light levels, not fast signals.
Can I use it with ESP32?
Yes. Power the module from 3.3 V so the outputs never exceed the ESP32 pin voltage.
Parts for this guide
Projects that use it
Put this into practice: 34 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.


