Door Alarm, or Room Theme Music


Do you get enough respect in your own home? When the President of the United States walks into the room the band automatically plays Hail to the Chief. I wanted the same treatment, so I set out to build a circuit that plays a prerecorded message and is triggered whenever I open a door.

This project takes about 4 hours to complete and while it was certainly challenging, it’s very accomplishable for anyone comfortable using a soldering iron and a breadboard.

How It Works
The circuit for this project, shown below in Figure 1, is made up of two major components: the voice recorder/player chip that does most of the heavy lifting and a small audio amp that boosts the signal to the speaker. When the playback/record switch is flipped, the chip goes into recording mode. Flip it back, and the chip returns to playback mode. Now, every time the door is opened it will play the message.


Figure 1. The circuit for the door-activated accompaniment (Click here for full size image)

Voice Recorder
In this circuit, the voice recorder (141655) has two modes, record and playback. Record mode takes pins 23, 24, and 27 low, which activates the microphone and the internal pre-amp, gain control, anti-aliasing filter, and storage. Talking into the microphone creates a signal which is capacitively coupled into the chip. The signal is then pre-amped and gain controlled, sent out the analog out pin, and then returned into the analog in pin. The signal is sent out and in again for flexibility. (If you were using an audio source that wasn't a microphone you'd use the analog in pin, and skip the whole first step.) Once back in the chip, the signal is then amped and gain controlled again, then filtered and stored.



Flipping the playback/record switch again takes pins 23, 24, and 27 high, assuming the door is closed. The chip then places an end-of-message marker in the memory and resets the internal address pointers. Essentially, what this means is that it stops the recording, and then sets it up so that when you open the door, it will start playing from the beginning of the message and end when you flip the switch. Then, when the door opens, the chip reads the message from its memory, filters the sound, amps it, and sends it out the speaker+ and speaker− pins.




Figure 2. The block diagram for the voice recorder. (Click here for full size image)

Audio Amp
The audio amp is an optional part of this circuit. You can attach a speaker directly to the speaker+ and speaker− pins of the chip, which is what I did at first. I soon discovered that it was very quiet, so I added this amp, an LM386 (839826). It's a power amplifier with a gain that you can set anywhere between 20 and 200. The circuit above sets it at 200, since I figured you could just put a resistor in series with the speaker (like the 22Ω one in the circuit above) to modulate volume. You could also use a pot if you want a variable volume control.

Breadboard
I wanted something simple and fast, so I used a small solderless breadboard (20601) to prototype the circuit. This kind of breadboard lets you remove the parts much more easily, which I found myself doing almost every time. It's a double-edged sword, though; as a finished product, parts can unintentionally be pulled out. If you want something more resilient or want to reduce the amount of static, you can transfer the circuit to a proto board (like 616622) after it's in working form.
I didn't transfer the circuit, though, so I decided to enclose the whole project in a plastic box (18893). This is strictly optional, but it makes the project look better and makes it more rugged. I drilled some holes in it for the parts, using 1/8", 7/32" (although 1/4" will work too), 1/2", and 1.5" bits to cut the holes. You'll also need 4 #4-1/4" screws and bolts for the speaker, and a 1/2" retaining ring (also called E-clip) to hold the power socket, as neither includes mounting hardware. You can find both of those at your local Home Depot.
Wire
Stranded wires are impossible to work with in a solderless breadboard environment, and aluminum-based wire is very hard to solder with. So I'd recommend solid copper jumper wires (19290).

Soldering
Whether you build this project in a plastic box or not, you'll need to solder wires to the power connector, the switch, and the speaker. The fumes are toxic, so solder in a well-ventilated area. If you do build it in a box, you'll also need to solder wires onto the microphone, which is difficult. I destroyed my first microphone by soldering it too many times, so be careful.

Chip Placement and Circuit Layout
I'd recommend putting the larger voice recorder/player chip toward the top of the board and the amp at the bottom because you'll end up needing a lot of space between the chips. Plus, the top pins of the voice recorder chip have simpler things to wire, like power and mode select.



The Door Switch
You'll need all three terminals connected on the door switch, wiring the NC (Normally Connected) pin to ground, the NO (Normally Open) pin to the Play/Record pin on the voice recorder/player chip, and wiring COM (Common) to either pin 23 or 24 on the voice chip. There should be a jumper connecting the two, so it doesn't really matter which pin you attach COM to. Since the door switch will not be in the box, you'll need to use a long length of wire for each pin and braid the wires together. The braid makes it look better and also reduces noise on the wires. After building and thoroughly testing the circuit, mount the wired side of the switch on the door frame and the magnet side of the switch on the door so that they're within 1/4" of each other when the door is closed. You can use either the included adhesive pads or screws.

The Record/Playback Switch
You can use either a SPDT switch or a DPDT switch here. The circuit diagram above lists it as a SPDT switch, but I found it better to be able to switch off the speaker while recording. The speaker has a tendency to make an annoying buzzing noise while recording, so I preferred a DPDT (317455). On the other hand, you can use a push-button form (28063) with a SPDT, making recording more user-friendly.

Testing The Circuit
After wiring up the circuit, make sure all the wires are inserted into the breadboard securely and that there are no shorts between components. If there are and you cannot push them apart effectively, wrap the leads in electrical tape. Once you've verified the circuit, flip the Playback/Record switch into Playback mode and attach the power. Place the magnet close to the door switch to simulate a closed door, then flip the Playback/Record switch into Record mode. Say something into the microphone, then flip the switch again. Pull the magnet away from the door, and what you just said should come right back out of the speaker!
If it doesn't quite work, you can troubleshoot by attaching a 1K resistor and an LED in series between pin 25 (EOM) and ground. If the voice chip is working correctly, the LED should light up when recording and when the door is open in playback mode.

Going Further
You can go further with this project by moving it to a proto board (616622), reducing the amount of static on the line. You might also filter the sound with a band filter. You could also use this project as a door alarm, letting you know when someone is coming into your room. I hope you had fun building this door-activated announcer!

Shopping List

Item Jameco Product #
Voice Chip (ISD25120P) 141655
Playback/Record Switch 317455 (DPDT) or 28063
Door Switch 617545
Power Supply 252701
Power Connector 151590
Solderless Breadboard 20601
Microphone 136574
Speaker 111588
Capacitors 2x Non-Polarized 0.05 µF 332507
4x 0.1 µF (Polarized OK) 609043 (order in multiples of 10)
1x 4.7 µF (Polarized OK) 330414 (order in multiples of 10)
1x 220 µF (Polarized OK) 135125 (order in multiples of 10)
Resistors 1x 5.1kΩ 690304 Because resistors are sold in packs of 100, it may be cheaper to buy a bag of assorted resistors, understanding that you may not get all of these parts, and may have to substitute similar resistors. Try 134130 or 18104
2x 10kΩ 691104
1x 470kΩ 691500
Wire 19290, though you will need some longer wire for the door switch.
Soldering Iron, Stand, Sponge, Diagonal Cutters, Long Nose Pliers, Wire Strippers 358598
Solder 170457
Test LED An LED 1554099
1x 1kΩ 690865 See note about resistors above.
Audio Amp Audio Amp (LM386) 839826
1x 10Ω 690380 See note about resistors above.
1x 22Ω or 100Ω pot 690460 or 254298
1x Non-Polarized 0.001 µF 15192 (order in multiples of 10)
1x Non-Polarized 0.05 µF Included above, as the minimum order for 332507 is 10 capacitors.
1x 10 µF Capacitor (Polarized OK) 331192 (order in multiples of 10)
1x 220 µF (Polarized OK) Included above, as the minimum order for 135125
Plastic Box Plastic Box 18893
1/8", 7/32" (although 1/4" will work too), 1/2", and 1.5" bits Your local hardware store.
4 #4-1/4" screws and bolts
1/2" retaining ring (also called E-clip)


About the author

Phil Tang is an engineering student at Tufts University and a summer intern at Jameco, working on new media and data integrity. He loves learning a little bit about everything and a lot about the interesting bits. He's a proficient roboticist and all-around computer guy, enjoying all kinds of electronic marvels. He can be reached at phil.sj.tang@gmail.com.