Circuits / Sensors
Light switch with an LDR-LM393 module
The module turns light into yes or no: DO goes low past about 18 lx with the trimmer in the middle (the figure is the model's photoresistor; a real one varies), and the LED lights; the trimmer moves that point

Tap a part to see its voltages and currents. It is a model, not a measurement.
What do you need?
- Sensor module (LM393) LDR-LM393AliExpress Amazon
- Resistor 470 ΩAliExpress Amazon
- Yellow LEDAliExpress Amazon
- Jumper wires × 4AliExpress Amazon
- BreadboardAliExpress Amazon
The AliExpress links are affiliate links: if you buy through them ohmio.dev gets a commission, at no extra cost to you. Affiliate links
This page is a guide: the numbers come from a simulation, and real parts vary. Check your parts before you power the circuit. Safety and responsibility
How does a light sensor module switch an LED?
The LDR-LM393 module puts a photoresistor, a comparator and a trimmer on one small board. With more light the photoresistor's resistance falls, and the comparator's output, DO, goes low. Here DO works as the LED's ground: R1 (470 Ω) and the yellow LED go from 5 V to DO. In the dark DO sits at 5.00 V and the LED is off. When the light passes about 18 lx, DO falls to 0.51 V and the LED takes 5.5 mA. With the trimmer at 0.3 it switches near 60 lx, and at 0.7 near 5 lx. These lux figures are the model's photoresistor; a real one varies from unit to unit. The pins are not in the same order on every module, so read the labels printed on yours before wiring, and check the board's own LED in the dark and in the light.
Values from the Protoboard ISO simulation: a model, not a bench measurement.
Hear about the next circuit
One email when a new circuit is out, about twice a month. Nothing else.