Medium

Op-Amp Comparator Night Light

An LM358 compares the voltage from a photoresistor against a reference voltage and switches an LED — the basic pattern behind every threshold sensor.

Circuit Diagram

+9V LM358 pin 8 VCC pin 4 GND LDR fixed R pin 3 (+) POT 10K threshold pin 2 (−) pin 1 OUT 220R LED LDR + pot form two dividers into the LM358 comparator

How to Build It

  1. Place the LM358 op-amp on the breadboard.
  2. Power it: pin 8 to the positive rail, pin 4 to GND.
  3. Build a voltage divider with the photoresistor and a fixed resistor, feeding the non-inverting input (pin 3).
  4. Build a second voltage divider with a potentiometer, feeding the inverting input (pin 2) — this sets the threshold.
  5. Connect the output (pin 1) through a resistor to an LED, then to GND.
  6. Power the circuit and cover the photoresistor with your hand — the LED should turn on.

Bill of Materials

ProductCodeQty
Potentiometer knob block 57 211 57212 1
Integrated circuit 1
Photoresistor LDR OKY0102 1
LED (3/5/10mm, SMD, power) l-934ID-12V 1
Resistor DR47K-8/9 1
← All kits  ·  Newsletter