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.
Parts from the database
- LM393P × 1Dual comparator
Other supplies
- breadboardCommon build supply
- regulated 5 V comparator supplyCommon build supply
- regulated 3.3 V sensor/reference supply with shared groundCommon build supply
- photoresistorCommon build supply
- 10 kΩ resistorCommon build supply
- 10 kΩ potentiometerCommon build supply
- 4.7 kΩ pull-upCommon build supply
- LED and 330 Ω resistorCommon build supply
- 100 nF bypassCommon build supply
Amazon links may be affiliate links. As an Amazon Associate, Electronics Hobby Hub earns from qualifying purchases.
Connections
- DIP-8 pin 8 +5 V, pin 4 ground; bypass. Comparator A: +IN pin 3, −IN pin 2, open-collector OUT pin 1.
- Photoresistor from +3.3 V to sensor node; 10 kΩ from node to ground; connect node to pin 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.
- Tie unused comparator inputs to known levels.
Build steps
- Measure the sensor divider voltage in bright and dim conditions.
- Turn the pot until the LED switches near the chosen threshold.
- Cover and uncover the sensor repeatedly.
- 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.