ohmio

Circuits / Sensors

Light comparator with a photoresistor

The photoresistor's divider is compared with a reference you set: below it (dark) the output pulls down and the LED lights; above it (light) the output is released. With the reference at half the supply it switches at about 18 lx for the model's photoresistor (a real one varies)

Light comparator with a photoresistor, simulated on a breadboard

Tap a part to see its voltages and currents. It is a model, not a measurement.

What do you need?

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 comparator tell light from dark?

A comparator has two inputs and makes one decision: is the first higher than the second? Here the photoresistor and R1 (10 kΩ) form a divider that feeds the IN+ input of an LM393, and the potentiometer sets the reference on IN−, half the supply, 2.50 V. At 300 lx the divider gives 4.39 V, above the reference, so the output is released and the LED stays off. At 5 lx it gives 1.48 V, below the reference, so the output pulls down to 0.22 V and the LED lights through R3 (1 kΩ) with 3.1 mA. In the model the switch happens between 17 and 18 lx, where the photoresistor equals R1. Turn the potentiometer and that light level moves. A real photoresistor switches at another level, and the circuit has no hysteresis, so a flickering lamp can make the LED flicker near the switching point.

Values from the Protoboard ISO simulation: a model, not a bench measurement.