Schmitt trigger with hysteresis
Build it step by step
0 of 6 doneBuild the plain comparator
Wire everything except the 100 kΩ feedback resistor.
Watch it flicker at dusk
Dim a lamp slowly or cover the LDR gradually with a card and note any flicker near the switching point.
Add the feedback resistor
Connect 100 kΩ from pin 1 to pin 3.
Find the two switching points
With a multimeter on pin 3, note the voltage when the LED turns on and when it turns off as the light changes slowly.
Compare the gap
The difference between the two readings is the hysteresis.
Change the gap
Try 47 kΩ or 220 kΩ in place of 100 kΩ and see the gap move: smaller resistor, larger gap.
How do you build a schmitt trigger with hysteresis?
Add positive feedback to a comparator so a slowly changing light level does not make the output chatter. You need LM393 Comparator, LDR Photoresistor, Resistor 10 kΩ × 4, Resistor 100 kΩ, LED 5 mm red, Resistor 1 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm), 9 V battery and 9 V battery snap with DC jack. It takes 6 steps and about 60 minutes.
- Level
- Intermediate
- Time
- About 60 min
- Parts
- 10
Parts list
- Integrated CircuitsBuyLM393 Comparator × 1
- SensorsBuy
- PassivesBuyResistor 10 kΩ × 4
- PassivesBuyResistor 100 kΩ × 1
- SemiconductorsBuyLED 5 mm red × 1
- PassivesBuyResistor 1 kΩ × 1
- PrototypingBuy
- PrototypingBuy
- BatteriesBuy9 V battery × 1
- PowerBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 9 V battery + | + rail | Supply |
| 9 V battery - | - rail | Ground |
| LM393 pin 8 | + rail | Power |
| LM393 pin 4 | - rail | Ground |
| 10 kΩ resistor (reference top) | + rail and LM393 pin 2 (IN-A) | Half-supply reference |
| 10 kΩ resistor (reference bottom) | LM393 pin 2 and - rail | Half-supply reference |
| LDR | + rail and LM393 pin 3 (IN+A) | Light sensor, top of the divider |
| 10 kΩ resistor (sensor bottom) | LM393 pin 3 and - rail | Bottom of the divider |
| 10 kΩ resistor (pull-up) | + rail and LM393 pin 1 (OUT-A) | Open-collector output needs a pull-up |
| 1 kΩ resistor and red LED | + rail through the resistor and the LED anode, cathode to LM393 pin 1 | LED lights when the output is pulled low |
| 100 kΩ resistor (feedback) | LM393 pin 1 and pin 3 | Add this in step 3 for hysteresis |
| LM393 unused inputs pins 5, 6 | - rail | Unused second comparator |
No code needed
No code. The LM393 output is open-collector, so it needs the pull-up resistor; it can only pull low. With the LDR on top of the divider, a dark room gives a low voltage on pin 3, the output goes low and the LED lights. Without the feedback resistor the switching point is exactly half supply. With the 100 kΩ feedback resistor, the output going high pulls pin 3 up slightly and going low pulls it down slightly, so the light level needed to switch on is different from the level needed to switch off. The gap is of the order of a few hundred millivolts on a 9 V supply; measure it rather than trusting the estimate.
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Plain comparator in slowly changing light | LED may flicker around the switching point |
| With 100 kΩ feedback | LED switches cleanly once each way |
| Pin 3 voltage at LED on versus LED off | Two different readings, a few hundred millivolts apart |
| Smaller feedback resistor | Bigger gap |
If it does not work
LED never lights
Check the LED direction and that the pull-up sits on pin 1.
LED always on
Check the reference divider gives about half supply on pin 2.
Still chatters
Check the feedback goes to pin 3, not pin 2, and use a smaller resistor.
Strange readings
A meter on the high-value divider loads it a little, so read quickly.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the schmitt trigger with hysteresis?
LM393 Comparator, LDR Photoresistor, Resistor 10 kΩ × 4, Resistor 100 kΩ, LED 5 mm red, Resistor 1 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm), 9 V battery and 9 V battery snap with DC jack.
How long does the schmitt trigger with hysteresis take to build?
About 60 minutes for a intermediate maker, in 6 steps.
How do I know the schmitt trigger with hysteresis works?
Plain comparator in slowly changing light: LED may flicker around the switching point. With 100 kΩ feedback: LED switches cleanly once each way. Pin 3 voltage at LED on versus LED off: Two different readings, a few hundred millivolts apart.
LED never lights: what should I check?
Check the LED direction and that the pull-up sits on pin 1.
LED always on: what should I check?
Check the reference divider gives about half supply on pin 2.
Still chatters: what should I check?
Check the feedback goes to pin 3, not pin 2, and use a smaller resistor.
Strange readings: what should I check?
A meter on the high-value divider loads it a little, so read quickly.
