Projects / Alarm with latch memory

Alarm with latch memory

Beginner45 minGuided buildReviewed

Build it step by step

0 of 7 done
  1. 74HC0018.1 mA

    Build the latch

    Gate 1 and gate 2 cross-coupled as in the table.

  2. Add the inputs

    Reed switch to +5 V with a pull-down, giving a low when the door opens. Reset button with a pull-up.

  3. BC54718.1 mA

    Add the outputs

    LED on Q and a BC547 driver for the buzzer.

  4. Power up and reset

    Press reset so Q starts low.

  5. 18.1 mA

    Open the door

    The LED and buzzer start.

  6. Close the door

    They stay on, because the latch remembers.

  7. Press reset

    They stop. Open the door again to repeat.

In short

How do you build an alarm with latch memory?

An SR latch made from NAND gates remembers that a door was opened until you reset it. You need 74HC00 quad NAND gate, Door reed switch MC-38, Tactile push button 6 mm, Resistor 10 kΩ × 3, LED 5 mm red, Resistor 330 Ω, Active buzzer 5 V, BC547 NPN transistor, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm), Breadboard power supply module (MB102) and 12 V 2 A DC adapter. It takes 7 steps and about 45 minutes.

Level
Beginner
Time
About 45 min
Parts
12

Parts list

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

Wiring

FromToWhy
74HC00 pin 14 and pin 7+5 V and GNDPower
Reed switch+5 V to node S, with 10 kΩ from node S to GNDHigh while the door is shut, low when it opens
Node SPin 1 (gate 1 input A, SET active low)Set input
Reset buttonNode R to GND, with 10 kΩ from +5 V to node RLow when pressed
Node RPin 4 (gate 2 input A, RESET active low)Reset input
Pin 3 (gate 1 output Q)Pin 5 (gate 2 input B)Cross-coupling
Pin 6 (gate 2 output)Pin 2 (gate 1 input B)Cross-coupling
Pin 3 (Q)330 Ω then red LED to GNDShows the alarm is set
Pin 3 (Q)10 kΩ to BC547 base; buzzer from +5 V to the collector; emitter to GNDBuzzer driver
Unused gate inputs (pins 9, 10, 12, 13)GNDTie off

No code needed

No code. Power: a breadboard power supply module (MB102) from the 12 V adapter, with its jumper set to 5 V. A NAND latch has active-low inputs. A low on SET makes Q high, a low on RESET makes Q low, and with both high it keeps its last state. The reed switch is closed when the magnet is next to it, so node S is high with the door shut and falls when the door opens.

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Door shut, after resetLED and buzzer off
Door openedLED and buzzer on
Door closed againStill on until reset
Reset pressed with the door shutOff

If it does not work

Starts on at power up

Normal, the latch may power up either way. Press reset.

Never latches

The cross-coupling wires are crossed wrongly. Re-check pins 3, 5, 6 and 2.

Buzzer too quiet

The BC547 base resistor is too large or the buzzer needs 5 V.

Works with the magnet backwards

Fine, the reed only needs the magnet close.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the alarm with latch memory?

74HC00 quad NAND gate, Door reed switch MC-38, Tactile push button 6 mm, Resistor 10 kΩ × 3, LED 5 mm red, Resistor 330 Ω, Active buzzer 5 V, BC547 NPN transistor, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm), Breadboard power supply module (MB102) and 12 V 2 A DC adapter.

How long does the alarm with latch memory take to build?

About 45 minutes for a beginner maker, in 7 steps.

How do I know the alarm with latch memory works?

Door shut, after reset: LED and buzzer off. Door opened: LED and buzzer on. Door closed again: Still on until reset.

Starts on at power up: what should I check?

Normal, the latch may power up either way. Press reset.

Never latches: what should I check?

The cross-coupling wires are crossed wrongly. Re-check pins 3, 5, 6 and 2.

Buzzer too quiet: what should I check?

The BC547 base resistor is too large or the buzzer needs 5 V.

Works with the magnet backwards: what should I check?

Fine, the reed only needs the magnet close.