NAND Alarm That Triggers on Hum
A practical exam asks students to build a burglar alarm on a breadboard using a 74LS00 quad NAND gate, a 5 V supply, a reed switch, a pushbutton, an LED, and a small piezo buzzer. The reed switch connects input A to ground when the magnet is present and is otherwise open, with a 10 kΩ pull-up to +5 V. Input B comes from a pushbutton wired only to ground through a 1 m wire; no resistor is fitted. The LED is connected from +5 V through 330 Ω to the output of one gate, so it lights when the output is low. The buzzer is driven by a 2N2222A from another gate. During testing, the LED is dim, the NAND gate becomes warm, and the alarm triggers when a hand is brought near the board. The supply rails show 5.0 V, and the breadboard has no decoupling capacitor. The examiner asks for a fault-finding report and a corrected circuit.
1. Analyse the reed switch input. With the 10 kΩ pull-up and the switch closed, calculate the voltage at input A using IIL(max) = 0.4 mA for 74LS. Is it a valid LOW? Recommend a value.
Read the worked answer
When the reed switch is closed, the input is pulled to ground, but the 74LS input sinks IIL = 0.4 mA. That current flows through the 10 kΩ pull-up, so VA = 0.4 mA × 10 kΩ = 4.0 V.
74LS requires VIL ≤ 0.8 V, so 4.0 V is in the undefined region; the gate may read high, oscillate, or draw excessive current. The maximum pull-up is R ≤ 0.8 V/0.4 mA = 2 kΩ. Use 1 kΩ: VA = 0.4 V, a valid LOW, and the closed-switch current is 5 mA. This is fine for a reed switch rated 100 mA. A 10 kΩ pull-up would be acceptable for CMOS but not for LSTTL.
2. Calculate the LED current with 330 Ω and compare with 74LS00 IOL. Explain the dim LED and warm gate. Recommend a fix.
Read the worked answer
LED current = (5 − 2)/330 = 9.1 mA. The 74LS00 IOL(max) is 8 mA, so the gate is overloaded. Its output low voltage rises, leaving less voltage across the LED and resistor; the LED is dim and the extra power is dissipated in the gate, making it warm.
Use 470 Ω: (5 − 2)/470 = 6.4 mA, within 8 mA. Better, drive the LED with a 2N2222 or use a 74LS07 buffer. Never source an LED from an LS output to ground, because IOH is only 0.4 mA. Add a 100 nF decoupling capacitor across the 74LS00 supply pins.
3. Diagnose the floating pushbutton input and the false triggering. Propose a debounce circuit and explain why the 1 m wire matters.
Read the worked answer
Input B is floating when the pushbutton is open. TTL inputs normally float high, but the 1 m wire is an antenna and couples mains hum; the gate sees a train of fast edges and the alarm triggers.
Add a 1 kΩ pull-up from B to +5 V and a 100 nF capacitor from B to ground; the time constant is 100 µs, and software should debounce for 10–20 ms. A 74LS14 Schmitt trigger can clean slow edges. Route the wire twisted with a ground return, keep it away from mains wiring, and tie all unused inputs to +5 V through 1 kΩ. Add 100 nF decoupling at each IC.