Maker Pro

How to Make an Analog Alarm System With a TI LM386 Power Amp

May 19, 2017 by Ryan Jones

This device will make a loud and annoying sound when somebody moves an object off of the pad.

Although it was originally designed to make sure Christmas presents stay under the tree, this device will make a loud and annoying sound when somebody moves an object off of the pad.


I love surprising my family with presents during the holiday season, but there's always that one family member who likes to take a sneak peek. I've had repeated trouble with my mom snooping around the Christmas tree, personally. So, this year, I wanted to solve that problem with the help of a little brainpower and some electronic components. I based my project on an Alarm System tutorial on All About Circuits. I was able to throw my solution together pretty quickly, especially since this circuit doesn't require any exotic hardware or a processor.

Now, whenever my mom thinks I'm not looking, she'll quickly realize that I mean business when I say, "Don't open 'til Christmas." When she lifts the present from the two conductive strips, the object-detecting "switch" will open, which causes the oscillator circuit to become active. This, in turn, causes the alarm to sound. Now I can catch her in the act.

How Does the Analog Alarm System Work?

This project is based on a 1 kHz square wave oscillator circuit found in the Texas Instruments LM386 audio power amplifier IC's datasheet (integrated circuit). This circuit generates the audio signal that is sent to the speaker. We can turn this oscillator on and off using a simple circuit consisting of an NPN transistor, a resistor, and (in my implementation) a diode.

If you look at the circuit in the All About Circuits tutorial, you won't see a diode. The original circuit didn't work for me. In my first attempt, the oscillator was active when the object-detecting switch was open and closed. In other words, the speaker made the sound when the object was removed (the intended function) and when it was in place. An alarm that constantly makes noise is not what I was going for. The sound wasn't as loud when the object was in place, but it still made noise.

I inserted a diode between the transistor base and switch, with the cathode facing the switch. This eliminated the unwanted sound and allowed my circuit to function as intended. I'm not sure exactly why this works, but it appears that the diode's voltage drop causes the BJT bipolar junction transistor to conduct small amounts of current. In this state, it effectively disables the amplifier. The amplifier seems to find an alternate current path when the BJT is cutoff.  This is the reality of electronics—sometimes you fix things without knowing exactly why the fix works.

1 kHz square wave oscillator with switch and diode fix.

Okay, now that we have that out of the way, let's dive in! We use R1 and R2 to produce positive feedback; this creates a bistable multivibrator. This means that the IC will always end up in one of two stable states: saturation at the positive rail or saturation at the negative rail. If we were to leave the circuit like this, the output would get "stuck" in one of these states. To make a circuit that oscillates, we need to change it to automatically switch back and forth between the two stable states.

We can accomplish this by creating negative feedback via C2 and R4. Our circuit will now repeatedly switch output states as the voltage across the capacitor gradually increases or decreases following an output transition. Now our circuit is an astable multivibrator.

To enable and disable oscillation, we use a transistor to interrupt the current flow from the amplifier's negative supply pin to ground. In theory, this should power down the amplifier, thus disabling oscillation. But, as discussed above, it didn't quite work this way for me.

A square wave, courtesy of Sparkfun


I used three metal strips from an erector set to create my switch, but you can use anything conductive that makes a solid connection. If you don't have anything handy, I suggest using copper tape. Essentially, there are two isolated strips sitting parallel to each other—one is connected to the base of the transistor through the diode, and the other is connected to ground.

To close the switch, place the third conductive strip on the object you wish to protect and set it on top of the metal strips. Removing the object creates an open switch. For my alarm, I placed the third conducting strip on the bottom of a wrapped present.

Though the strips look connected, they are electrically separated by rubber gaskets.

When the present (Or whatever item you would like to guard) is placed on top of the metal strips, the switch closes. The base of the BJT is at 0.7 V, and only small amounts of electrical current can flow from our collector-emitter. When the present is removed, the switch opens, which results in higher current flowing into the base and, thus, higher current flow from collector to emitter. With current flowing freely from the negative supply terminal to ground, the oscillator is active, and the sound is generated by the speaker.

Now you can be the next Kevin McCallister!


Ryan Jones

Start my career as an Audio Engineer, now turned professional maker!

Related Content



You May Also Like