IntermediateSensors & Indicators

Adjustable Dark-Threshold Indicator

Set a light threshold with a potentiometer and use an LM393 comparator to light an LED when a photoresistor sees darkness.

Estimated time: 45–60 minutes · Skills: Comparator inputs, divider voltage, open-collector outputs

Parts from the database

Other supplies

Amazon links may be affiliate links. As an Amazon Associate, Electronics Hobby Hub earns from qualifying purchases.

Connections

  1. DIP-8 pin 8 +5 V, pin 4 ground; bypass. Comparator A: +IN pin 3, −IN pin 2, open-collector OUT pin 1.
  2. Photoresistor from +3.3 V to sensor node; 10 kΩ from node to ground; connect node to pin 3.
  3. Pot ends to +3.3 V/ground and wiper to pin 2. Add 4.7 kΩ pull-up from pin 1 to +5 V; LED/resistor in series from +5 V to pin 1 so the comparator sinks its current. Keep both comparator inputs on the 3.3 V divider/reference rail.
  4. Tie unused comparator inputs to known levels.

Build steps

  1. Measure the sensor divider voltage in bright and dim conditions.
  2. Turn the pot until the LED switches near the chosen threshold.
  3. Cover and uncover the sensor repeatedly.
  4. If it chatters, adjust the threshold away from the boundary or redesign with hysteresis.

Software and firmware setup

This is a hardware-only circuit; no firmware is required.

Test your build

As wired, the LED lights when the photoresistor-divider voltage falls below the reference, usually in darkness.

Troubleshooting

  • Always on/off: adjust the pot and verify inputs on pins 2/3.
  • Output never rises: LM393 needs a pull-up.
  • Threshold barely changes: check divider orientation and pot wiper.

Safety and limitations

5 V hobby indicator only; not a certified security or emergency detector.

Manufacturer and platform documentation

Community Notes for This Project

These are unverified visitor contributions, separate from the build guide and manufacturer specifications. Verify technical advice against the linked datasheets before relying on it.

Set up the comments service to load community notes.

Share a tip or question about this build

← Browse all projects