Design an Alarm / Tamper Circuit with an S-R Latch
Resources
Hello, and welcome to The Logic Minute. In this video, we'll look at how to use logic to perform a latching function in alarm circuits. An alarm circuit is used to indicate when a trigger event is happening and is typically followed by a function that has to be performed to address the event. For this video, the two-position switch will act as our alarm trigger for simplicity.
As you can see in the example, the trigger is connected directly to the MCU for direct processing of the event. However, there are a variety of ways the alarm circuit can be implemented to indicate when a trigger event happens. There can be a buzzer or a speaker at the output of the alarm circuit for an audible indication, or there could be an LED at the output that will light up for visual indication. For this video, we will continue to use the LED indicator as an example to clearly represent when a trigger event happens.
There is a potential problem with the current alarm circuit. Whenever the trigger disappears, the LED turns off. If you are feeding the alarm circuit into an MCU, it may not be able to address the event before the signal disappears.
This would be like your home alarm going off when the door opens and then turning off when the door is closed. This is a huge issue, since these alarm circuits are used in critical situations, and it is important that the event is addressed. The signal needs to stay high until a trigger event is addressed, and then it can be reset.
The way to do this using logic is by implementing a latch into the circuit. With the alarm trigger being fed into a latch, you are still able to see the trigger event happening at the output of the latch. But now, the signal at the output of the latch stays high even when the alarm trigger disappears.
A latch can be simply made by connecting two NOR gates together in this configuration to form an S-R latch. This will give us the ability to set and reset the output by controlling two pins.
Now, I can insert the S-R latch into our alarm circuit. The S input, or set input, is connected to the trigger event. And the R input, or reset input, is connected to a push button. A button was used to simplify the circuit, but it can be replaced with an MCU connecting a GPIO to the R input.
When the set input goes high, the Q output is high, turning on the LED. The LED stays on when the S input goes low. Now, the trigger event can be addressed at any time. When the event has been addressed, the user can press the button, setting the R input high and making the Q output go low and turning off the LED.
Here, we see a different alarm circuit that uses NAND instead of NOR gates. By doing this, the latch inputs are not active low. The button was replaced with an MCU which has the alarm circuit fed into it, allowing for the event to be addressed and the latch reset.
Thank you for watching. Please explore the other videos and training material on our website. And if you have any other questions, come over to the ETE forums to ask us directly.
This video is part of a series
-
Common applications of logic
video-playlist (20 videos) -
Common applications of gates
video-playlist (5 videos) -
Common applications of flip flops, latches and registers
video-playlist (5 videos)