How to Make a Latching Relay Circuit With a 555 Timer

Want a relay that turns on with one press and stays on until you deliberately turn it off—no microcontroller required? A 555 timer in bistable (flip-flop) mode is a classic, reliable way to build a latching relay controller with just a handful of parts.

In this guide, you’ll learn exactly how it works, what to buy, how to wire it on a breadboard or perfboard, and how to adapt the design for different coil voltages, loads, and environments. We’ll walk through calculations, protection, debouncing, and troubleshooting so your build works the first time and stays rock-solid.

If you’re comfortable with LEDs and resistors but haven’t driven relays before, you’re in the perfect spot. Let’s build it.

What You’ll Build (Big Picture)

You’ll build a tiny control circuit that uses a 555 timer as a bistable latch plus a transistor (or MOSFET) driver to energize a relay coil. Two momentary pushbuttons give you precise control:

  • SET button: Energizes the relay (turns it ON) and keeps it on.
  • RESET button: De-energizes the relay (turns it OFF) and keeps it off.

The relay’s Common (COM) and Normally-Open (NO) contacts switch your external load (lamp, motor, outlet, etc.). The 555 merely controls the coil; the relay contacts safely handle the higher voltage/current of your load as long as they’re rated for it.

Why Use a 555 for a Latching Relay?

  • Simplicity & cost: No programming, no boot time, no software bugs. Parts are cheap and everywhere.
  • Noise immunity: Properly decoupled, a 555 works well in electrically noisy environments (e.g., motors).
  • Repeatable behavior: Defined thresholds at ~1/3 VCC and ~2/3 VCC give predictable switching.
  • Flexibility: Works from ~5–15 V (NE555). With the CMOS LMC555/TS555, you can go lower power or lower voltage.

Core Idea: 555 in Bistable Mode

Most folks know the 555 for astable (oscillator) and monostable (one-shot) modes. But there’s a third: bistable—no timing capacitor, just two stable states controlled by the TRIG (pin 2) and THRES (pin 6) inputs:

  • Trigger low (< 1/3 VCC) → Output high (latches ON)
  • Threshold high (> 2/3 VCC) → Output low (latches OFF)
  • Control Voltage (pin 5) normally left at 2/3 VCC (with optional small capacitor to ground for noise immunity)
  • No RC timing needed—pressing buttons changes state immediately and it stays put

We’ll wire:

  • A SET pushbutton that momentarily pulls pin 2 (TRIG) low.
  • A RESET pushbutton that momentarily drives pin 6 (THRES) high.
  • The 555 output (pin 3) drives a transistor that powers the relay coil.

Bill of Materials (BOM)

Adjust values to your supply voltage and relay coil current.

Active & Electromechanical

  • 1 × NE555 (or TLC555/LMC555 if you want lower power)
  • 1 × Relay, coil voltage matches your supply (5 V or 12 V are common)
    • Choose coil resistance/current to suit your supply (e.g., 12 V coil at ~30–90 mA)
    • Contacts rated for your load (e.g., 10 A @ 125/250 VAC)
  • 1 × NPN transistor (e.g., 2N2222, PN2222A, S8050) or logic-level N-MOSFET (e.g., AO3400, IRLZ44N for heavy loads)
  • 1 × Flyback diode for relay coil (1N4148 for small coils, 1N4007 for general use)

Passives

  • 1 × Base resistor (for NPN) typically 1 kΩ–4.7 kΩ (we’ll calculate)
  • 1 × Gate resistor for MOSFET (100 Ω–220 Ω), optional but recommended
  • 1 × Pull-down resistor on NPN base or MOSFET gate (e.g., 100 kΩ), optional but recommended
  • 2 × Button resistors (to shape logic levels if needed—often 10 kΩ)
  • 1 × 0.01 µF–0.1 µF capacitor on 555 pin 5 (Control Voltage) to ground (noise filter)
  • 1 × 100 nF ceramic decoupling capacitor across 555 VCC–GND (place close to chip)
  • 1 × 47–220 µF electrolytic across supply rails (bulk decoupling)
  • 1 × LED + current-limit resistor (1–3 kΩ) as status indicator (optional)
  • Optional snubber (RC) or MOV for AC loads

Hardware

  • Breadboard or perfboard, hookup wire, two momentary pushbuttons, screw terminals for load

Tools

  • Multimeter, wire stripper, small screwdriver. Optional: scope for debugging bounce/noise.

Choosing a Relay and Supply

Pick your supply voltage first (5 V or 12 V are common). Then match your relay coil:

  • 5 V builds: Great for USB-powered or low-power systems. Ensure coil current is within USB or regulator limits.
  • 12 V builds: Typical in automotive or higher-power setups. Keep wiring tidy; inductive spikes are bigger.

Check:

  • Coil current (I_coil): Needed for driver sizing. Example: a 12 V, 360 Ω coil → I ≈ 12 V / 360 Ω ≈ 33 mA.
  • Contact ratings: Must exceed your load’s voltage and current (and preferably the inrush current for lamps/motors).

The Schematic (Explained)

555 Core Pins

  • Pin 1 (GND): Ground
  • Pin 8 (VCC): +5 to +15 V (match relay coil if using single supply)
  • Pin 4 (RESET): Tie to VCC (through a direct link) to avoid inadvertent resets
  • Pin 5 (CTRL): 0.01–0.1 µF to GND for noise filtering

Bistable Control

  • Pin 2 (TRIG): Normally held high (via a resistor to VCC). SET button briefly pulls it to GND → output goes HIGH.
  • Pin 6 (THRES): Normally held low (via a resistor to GND). RESET button briefly pulls it to VCC → output goes LOW.
  • Pin 3 (OUT): High/low output that will drive the transistor/MOSFET.

Relay Driver

  • With NPN transistor (common, simple):
    • 555 pin 3base resistor (e.g., 2.2 kΩ) → NPN base
    • Emitter → GND
    • Collector → one side of relay coil
    • Other side of relay coil → +V (same as VCC)
    • Flyback diode across coil: cathode at +V, anode at transistor collector
    • Optional pull-down (100 kΩ) from base to GND to ensure off at power-up
  • With N-MOSFET (great for higher coil currents):
    • 555 pin 3 → gate (through 100–220 Ω)
    • Source → GND
    • Drain → one side of relay coil
    • Other side of relay coil → +V
    • Flyback diode across coil as above
    • Gate pull-down 100 kΩ to GND

Status LED (Optional but Helpful)

  • 555 pin 3 (or transistor collector/drain) → LED + resistor → VCC (for “active low” LED) or to GND (for “active high”). Choose 1–3 kΩ depending on brightness.

Button Wiring and Pull Resistors (Clean Logic)

Bistable mode needs clean logic levels:

  • SET Button (to trigger ON):
    • Pin 2 is normally high. Use a pull-up resistor (e.g., 10 kΩ) from pin 2 to VCC.
    • Button from pin 2 to GND. Pressing pulls pin 2 below 1/3 VCC → output latches HIGH.
    • Optional 100 nF from pin 2 to GND can help reject noise, but don’t make presses too “long.”
  • RESET Button (to trigger OFF):
    • Pin 6 is normally low. Use a pull-down resistor (e.g., 10 kΩ) from pin 6 to GND.
    • Button from pin 6 to VCC. Pressing pushes pin 6 above 2/3 VCC → output latches LOW.
    • Optional 100 nF from pin 6 to GND to ignore glitches.

Debouncing: Mechanical switches bounce for a few ms. The 555’s thresholds and the RC on each input often tame bounce adequately. If you see double-toggling, add a small series resistor (1–4.7 kΩ) plus 100 nF to ground at the pin (simple RC low-pass), or use tactile switches with built-in debounce mechanisms.

Calculating the Transistor Base Resistor (NPN Option)

We’ll design the driver conservatively so the relay always pulls in.

  1. Find coil current, I_coil (datasheet or I = V/R).
    • Example: 12 V / 360 Ω ≈ 33 mA.
  2. Pick a forced gain (β_forced) of ~10–20 for saturation.
    • With small signal BJTs, β_forced = 10 is robust.
  3. Compute base current I_B = I_coil / β_forced.
    • I_B ≈ 33 mA / 10 = 3.3 mA.
  4. Base resistor R_B = (V_out − V_BE) / I_B.
    • NE555 high output ≈ ~VCC − 1 V in some cases; assume V_out ≈ 10.5–12 V with 12 V supply (it varies).
    • V_BE ≈ 0.7 V.
    • If we assume V_out ≈ 11 V for safety: R_B ≈ (11 V − 0.7 V) / 3.3 mA ≈ 3.1 kΩ → choose 2.2 kΩ or 3.3 kΩ.

For 5 V builds with ~70 mA coils, you may prefer a logic-level MOSFET—less stress on the 555 output and no base current math. If you stick with NPN, just re-run the calculation with your coil current.

Power and Decoupling (Don’t Skip!)

Relays are inductive and noisy. Keep the 555 happy:

  • 0.1 µF ceramic right at the 555’s pin 8 to pin 1.
  • 47–220 µF electrolytic across supply rails near the relay.
  • Short ground returns. Keep relay current path and 555 ground tied at a single point if possible.

Step-by-Step Breadboard Build

  1. Place the 555:
    • Orient the notch/dot. Pin 1 bottom left, count counterclockwise.
    • Tie pin 1 to GND, pin 8 to VCC.
    • Tie pin 4 (RESET) to VCC.
    • Add 0.1 µF from pin 8 to pin 1 (close to chip).
    • Add 0.01–0.1 µF from pin 5 to GND.
  2. Wire the SET input (pin 2):
    • 10 kΩ from pin 2 → VCC (pull-up).
    • Momentary button from pin 2 → GND.
    • Optional 100 nF from pin 2 → GND for noise rejection.
  3. Wire the RESET input (pin 6):
    • 10 kΩ from pin 6 → GND (pull-down).
    • Momentary button from pin 6 → VCC.
    • Optional 100 nF from pin 6 → GND.
  4. Join pins 2 and 6?
    • No. In bistable mode they are separate; each gets its own button.
  5. Driver and relay (NPN example):
    • 555 pin 32.2 kΩ → NPN base.
    • NPN emitter → GND.
    • Relay coil between +V and NPN collector.
    • Flyback diode across coil: cathode to +V, anode to collector.
    • Optional 100 kΩ from base to GND (ensures off at power-up).
  6. Status LED (optional):
    • From pin 3 through 1–3.3 kΩ to GND (LED lights when pin 3 is high), or
    • From VCC through resistor+LED to pin 3 (LED lights when pin 3 is low—less common here).
  7. Bulk decoupling:
    • 47–220 µF electrolytic across VCC–GND near relay.
  8. Test without load:
    • Power up. Output should be LOW initially (varies—if you need a guaranteed default, add a power-up reset network; see Tips).
    • Press SET: you should hear a click; LED (if on OUT) should light; relay coil energized.
    • Press RESET: relay releases.
  9. Wire the load:
    • Use relay COM and NO for “off by default, on when set.”
    • For “on by default, off when set,” use COM and NC.
    • Keep load ground and high-voltage wiring physically away from the 555 where possible.

Understanding Exactly How It Works

  • The 555 contains two comparators and an SR latch. In bistable mode:
    • TRIG low (< 1/3 VCC) sets the latch → OUT goes HIGH.
    • THRES high (> 2/3 VCC) resets the latch → OUT goes LOW.
  • Your buttons create those events on demand. Between presses, OUT stays where it is—hence “latching.”
  • OUT drives a low-side switch (NPN or N-MOSFET). When OUT is high, the transistor saturates/turns on, current flows through the coil, and the relay actuates.
  • The flyback diode catches the coil’s negative voltage spike when current is interrupted, protecting the transistor and 555.

Option: Use a MOSFET Driver (When and Why)

Use a logic-level N-MOSFET if:

  • Coil current > ~100 mA
  • Supply is only 5 V and the BJT base current would be too large
  • You want lower dissipation and snappier coil drive

Wiring is the same topology:

  • Gate from pin 3 (add 100–220 Ω series + 100 kΩ pull-down)
  • Source to GND
  • Drain to coil
  • Coil to +V, flyback diode across coil

Adapting to 5 V or 12 V Systems

  • Single supply: Power the 555 and relay from the same rail (5 V or 12 V). Ensure the 555 variant tolerates your voltage.
  • Dual supply (advanced): If you have a 5 V logic rail and a 12 V coil, you can still control the 12 V coil with a transistor/MOSFET. Just tie grounds together. Ensure the 555 OUT can drive the transistor gate/base reliably; with a MOSFET, choose logic-level.

Protecting Your AC or Inductive Loads

  • For AC inductive loads (motors, transformers), put an RC snubber (e.g., 100 Ω + 100 nF, series) across the load or across the relay contacts to reduce arcing.
  • For DC motors/solenoids being switched by the relay, add an external flyback diode across the load too (not just across the relay coil).
  • Consider a MOV for mains spikes if switching 120/230 VAC (observe safety, creepage/clearance, and enclosures).

Ensuring a Known Power-Up State

Depending on tolerances, the 555’s output at power-up might be undefined for a moment. If you require “always OFF at power-up”:

  • Add a small power-on reset network that briefly asserts THRES high at startup. For example:
    • 100 nF from VCC through a resistor (e.g., 100 kΩ) to pin 6, with a diode from pin 6 to GND to quickly discharge after power-down. This gives a quick “reset pulse” > 2/3 VCC on boot.
  • Or use a dedicated reset supervisor IC if the environment is critical.

Common Mistakes (and Quick Fixes)

  1. Relay doesn’t click:
    • Check coil voltage and polarity.
    • Verify the flyback diode orientation (reverse across coil).
    • Confirm transistor pinout; many PN2222/2N2222 clones flip pins.
  2. LED lights but relay doesn’t:
    • OUT pin can source/sink a few tens of mA max—never drive coil directly from pin 3.
    • Ensure the driver transistor/MOSFET is actually switching the coil (check collector/drain voltage change).
  3. Circuit toggles unreliably:
    • Add 100 nF at pins 2 and 6 to ground and keep wires short.
    • Debounce buttons with series resistors (1–4.7 kΩ) and small caps (100 nF).
    • Improve decoupling (0.1 µF at 555 + 100 µF on rails).
  4. Gets stuck ON or OFF:
    • Double-check pull-up/pull-down values on pins 2 and 6.
    • Ensure pin 4 (RESET) is tied firmly to VCC.
  5. Hot transistor:
    • Coil current too high → use MOSFET.
    • Base resistor too large → not saturating; recalc for more base current.
    • Consider heat sinking or a lower-R_DS(on) MOSFET.

Example Designs

Example A: 12 V System, 33 mA Coil, NPN Driver

  • Supply: 12 V
  • Relay coil: 360 Ω (≈33 mA)
  • NPN: PN2222A
  • Base resistor: ~2.2–3.3 kΩ (we picked 2.2 kΩ)
  • Pull-ups/downs on pins 2/6: 10 kΩ
  • Caps: 0.1 µF (VCC-GND), 0.01 µF (pin 5-GND), 100 nF (optional at pins 2 and 6), 100 µF bulk across rails
  • Button wiring: pin 2 → 10 kΩ to VCC; button to GND. pin 6 → 10 kΩ to GND; button to VCC.
  • Flyback diode: 1N4007 across coil

Operation: Press SET → relay energizes and stays. Press RESET → de-energizes and stays.

Example B: 5 V System, 80 mA Coil, MOSFET Driver

  • Supply: 5 V
  • Relay coil: 62.5 Ω (≈80 mA)
  • MOSFET: AO3400 (SMD) or IRLZ44N (through-hole, overkill)
  • Gate resistor: 150 Ω; Gate pull-down: 100 kΩ
  • Pull-ups/downs on pins 2/6: 10 kΩ
  • Caps: same as above
  • Flyback diode: 1N5819 (Schottky) or 1N400x

Why MOSFET here: 80 mA on 5 V could demand relatively high base current for deep saturation if using BJT. MOSFET simplifies it and runs cooler.

Variant: Single-Button Toggle (Without a Microcontroller)

A classic 555 bistable uses two buttons (SET and RESET). If you want one button to toggle, you have options:

  • Edge-shaping network: Feed a brief low pulse to TRIG on odd presses and a brief high pulse to THRES on even presses. Doing that cleanly with one button alone is tricky; you typically add extra logic (e.g., a T flip-flop made from a CD4013) to turn presses into alternating set/reset signals. That’s beyond “pure 555,” but it’s simple and reliable.
  • DPDT pushbutton or alternate switch wiring: Some pushbuttons include a second pole you can wire to generate complementary pulses, but the debounce gets more finicky. For beginners, two buttons are much more robust.

For this tutorial, we recommend two-button control—it’s clean, intuitive, and very reliable.

Layout & Build Tips

  • Keep coil current loop (coil + transistor + diode) short and away from the 555 inputs.
  • Run separate ground returns: one for power (coil) and one for logic (555), meeting at a single point.
  • Place flyback diode physically close to the relay coil pins.
  • Put the 0.1 µF decoupler as close as possible to 555 pins 8 and 1.
  • For perfboard builds, route high-current traces wider and keep mains on a separate side or in an enclosure.

Safety When Switching Mains Loads

If your relay will switch 120/230 VAC:

  • Use a relay with appropriate isolation and contact ratings.
  • Maintain creepage/clearance distances on the PCB/board.
  • Enclose the mains section. Provide strain relief for cables.
  • Add a snubber or MOV if you’re switching inductive AC loads.
  • If you’re not experienced with mains wiring, use a pre-built relay module inside a rated enclosure and follow local electrical codes.

Troubleshooting Flow (Quick Checklist)

  1. No response at all
    • Verify VCC at pin 8 and GND at pin 1.
    • Check RESET (pin 4) is solidly tied to VCC.
    • Confirm decoupling cap placement.
  2. SET works once, then weird behavior
    • Debounce pins 2 and 6 (RC suggestions above).
    • Check wiring lengths; shorten if you can.
  3. Relay chatters
    • Add 100 nF on pins 2 and 6, and a bulk cap near the relay.
    • Confirm coil current isn’t sagging your supply.
  4. Transistor/MOSFET hot
    • For BJT, reduce base resistor (within 555’s drive limits) or switch to MOSFET.
    • For MOSFET, ensure it’s truly logic-level (low R_DS(on) at your gate voltage).
  5. Power-up glitch
    • Add a power-on reset pulse to pin 6 (brief > 2/3 VCC).

Frequently Asked Questions

Can I drive the relay directly from the 555 output pin?

No. The 555 can only source/sink limited current (tens of mA). Always use a transistor or MOSFET plus a flyback diode.

Can I use the CMOS 555 (LMC555/TLC555)?

Yes. It draws less current and can run at lower voltages. Just verify it can drive your transistor/MOSFET gate/base cleanly. For BJTs, you may need to lower the base resistor slightly because CMOS 555s source/sink less current than bipolar NE555 variants.

How do I control a 120 VAC lamp?

Use the relay contacts. Put the lamp in series with the NO contact and COM. When the relay energizes, the lamp turns on. Ensure contact ratings exceed your lamp’s inrush and steady current. Enclose the mains wiring.

Enhancements and Nice-to-Haves

  • Indicator LEDs: One for coil ON, another for power. Great for debugging.
  • EMI filtering: Add a ferrite bead on the coil line or small series resistor (e.g., 10 Ω) to tame spikes (keep flyback diode in place).
  • Optocoupler isolation: For very noisy environments, isolate the 555 from the driver with an optocoupler (e.g., PC817) and give the coil its own supply rail with a common ground or fully isolated supply depending on design goals.
  • Modular headers: Use screw terminals for the load and JST or dupont headers for ease of maintenance.

Complete Wiring Summary (Bistable 555 → Relay)

  • Power: VCC → pin 8; GND → pin 1
  • Reset: pin 4 → VCC
  • Control Voltage: pin 5 → 0.01–0.1 µF → GND
  • SET (latch ON): pin 2 with 10 kΩ → VCC; momentary button pin 2 → GND
  • RESET (latch OFF): pin 6 with 10 kΩ → GND; momentary button pin 6 → VCC
  • Output: pin 3 → driver (BJT with base resistor or MOSFET with gate resistor/pull-down)
  • Relay Coil: +V → coil → transistor collector/drain → GND
  • Flyback Diode: across coil (cathode to +V)
  • Decoupling: 0.1 µF at 555; 47–220 µF across supply near relay

Testing Procedure

  1. No load connected:
    • Apply power. OUT should be low or defined by your power-up network.
    • Press SET: OUT goes high; relay clicks; LED (if present) updates.
    • Press RESET: OUT goes low; relay releases.
  2. With load connected:
    • Start with a benign load (e.g., a 12 V lamp on a 12 V relay).
    • Repeat SET/RESET. Verify stable operation.
    • For mains loads, double-check wiring, enclose, and test with proper safety precautions.
  3. Edge cases:
    • Tap the buttons lightly and repeatedly. Ensure no double-triggers.
    • Wiggle wires gently—if behavior changes, you’ve got a loose connection or need better decoupling.

Example Parts (Shopping Hints)

  • 555: NE555P (Texas Instruments), LM555, or low-power LMC555/TLC555 if desired.
  • Relays: Songle SRD-xxVDC-SL-C (common, through-hole), OMRON G2R or G5LE series for reliable contacts.
  • Transistors: PN2222A, 2N2222 for small coils; TIP122 (Darlington) for heavier DC coils; IRLZ44N/AO3400 for MOSFETs.
  • Diodes: 1N4148 (small), 1N4007 (general), SS14/1N5819 (Schottky).
  • Buttons: 6×6 mm tact switches or panel-mount momentary pushbuttons.
  • Power: A regulated DC adapter matching your coil voltage (5 V or 12 V), capable of the coil current + margin.

Going Further

  • Delay-on or delay-off latches: Combine bistable control with a monostable 555 to add timed behaviors (e.g., press SET, relay energizes for exactly N seconds, then latches off).
  • Remote control: Replace buttons with a transistor output from a sensor or RF receiver (still respect the TRIG/THRES thresholds).
  • Dual-coil latching relays: If you use a mechanically latching relay with separate SET/RESET coils, the 555 can be configured to send pulses to each coil via two driver transistors. This then remembers state even across power loss.

Conclusion

A latching relay circuit built around a 555 timer in bistable mode is one of the cleanest ways to get push-to-toggle control without code. By separating low-voltage logic (the 555 and buttons) from high-voltage/high-current switching (the relay contacts), you get a robust, maintainable design that’s easy to debug and adapt. With proper decoupling, a flyback diode, and tidy wiring, your circuit will shrug off noise, bounce cleanly, and control loads safely.

Build the two-button version first (SET/RESET). Once you’ve got it working, you can dress it up with a MOSFET driver, indicator LEDs, power-up reset, and snubbering for tougher loads. From there, it’s simple to scale: different relays, different voltages, even dual-coil latching relays if you want mechanical memory.

You now have everything you need—parts list, wiring, calculations, and troubleshooting—to make a dependable 555-based latching relay. Have fun, build safely, and enjoy that satisfying “click” every time you press the button.

Alex Klein Author

Author

Alex Klein is an electrical engineer with more than 15 years of expertise. He is the host of the Electro University YouTube channel, which has thousands of subscribers.