Saturday, January 30, 2010

Time Delayed Door Alarm

My cat likes to open the front door if we don't latch it properly, which is often. Waking up to a cold house sucks! I designed a time delayed alarm with a couple of 555 timers, if the door is open for roughly 30 seconds it sounds off a piezoelectric speaker until the door is closed again.

Here is the circuit.
(Printer Friendly PDF)

Parts Needed:

- 555 Timer (x2)
- 100k Resistor (x2)
- 10k Resistor (x3)
- 1 Meg-ohm Resistor
- 33uF Electrolytic Capacitor
- 2.2 nF Ceramic Capacitor
- NPN Transistor
- Diode
- Piezoelectric Speaker
- 16 Pin Socket
- 9 Volt Battery Clip
- 9 Volt Battery Holder
- 9 Volt Battery
- Magnetic Contact Switch (found much cheaper at Radio Shack)
- Radio Shack General-Purpose Circuit Board (46.8 x 72.2 mm)

If you don't have any of the resistors it would be cheaper to get a grab bag rather than buy individual resistances in bulk.

Also this circuit is not picky about voltages, you could probably use anywhere from 3 to 16 volts, anything that the 555 will handle.

How it works:

When the door is closed the diode keeps the capacitor (C1) discharged to ground.

When the door opens and the magnetic switch is disconnected the pull up resistor (R2) sets the trigger, on the first 555, high and allows the 33uF capacitor (C1) to charge through the 1 meg-ohm resistor (R1). When the charge reaches 2/3 of the supply voltage the output pin on the 555 is set low. The time it takes for the capacitor (C1) to reach 2/3 of the supply voltage is found by this equation,

Time(sec) = (1.1) x (Resistance) x (Capacitance)

For example if we take the values used in my circuit,

Time = (1.1) x (1,000,000) x (.000033)

The time delay comes out to about 36 seconds. Depending on the quality of the capacitor its not going to be totally precise for such a long delay but its close enough for our purposes. For more precise timing you would want to use a decade counter clocked with a 555.

Anyway, the output on the first 555 is inverted by the transistor, so when the output goes low after 36 seconds R4 pulls the output high, its basically a logic NOT gate. The second 555 is a simple multivibrator circuit which generates a square wave used to drive the Piezoelectric Speaker. The alarm will keep sounding until the door is closed thus resetting the circuit.

If you wanted to cheat you could do away with the second 555 timer and get a Piezoelectric Buzzer which will generate a tone on its own when a DC voltage is applied to it.

Let me know if you bother building one.