Projects / Schmitt trigger with hysteresis

Schmitt trigger with hysteresis

Intermediate1 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. LM393

    Build the plain comparator

    Wire everything except the 100 kΩ feedback resistor.

  2. 376 lux

    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.

  3. Add the feedback resistor

    Connect 100 kΩ from pin 1 to pin 3.

  4. 11.9 mA

    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.

  5. Compare the gap

    The difference between the two readings is the hysteresis.

  6. Change the gap

    Try 47 kΩ or 220 kΩ in place of 100 kΩ and see the gap move: smaller resistor, larger gap.

In short

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

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
9 V battery ++ railSupply
9 V battery -- railGround
LM393 pin 8+ railPower
LM393 pin 4- railGround
10 kΩ resistor (reference top)+ rail and LM393 pin 2 (IN-A)Half-supply reference
10 kΩ resistor (reference bottom)LM393 pin 2 and - railHalf-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 - railBottom 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 1LED lights when the output is pulled low
100 kΩ resistor (feedback)LM393 pin 1 and pin 3Add this in step 3 for hysteresis
LM393 unused inputs pins 5, 6- railUnused 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.

CheckExpected
Plain comparator in slowly changing lightLED may flicker around the switching point
With 100 kΩ feedbackLED switches cleanly once each way
Pin 3 voltage at LED on versus LED offTwo different readings, a few hundred millivolts apart
Smaller feedback resistorBigger 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 →

Ask Lark AI

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.