2,400 kHz ± 200 Hz. I wrote a program that will warble
around 2,400 kHz for maximum sound. There are two
other alarms written in the software code. If you want to
use them, you will need to change the software GOTO to
the different locations. One is a French ambulance alarm;
the other is a single tone. This will require you to have a
programmer for the chip and understand writing code.
(A pre-programmed chip is available from the author.) If
you’re feeling ambitious, you can even write little tunes
that it can play.
The magnetic transducer is activated by turning it on
and off using a square wave generator. The resonate
frequency (being 2,400) needs a square wave of 417
micro-seconds.
■ Top and bottom of board.
1 = .0004167 2,400
The output from the op-amp goes to a PIC12F508
which acts as a timer and tone generator for the speaker
(magnetic transducer). The 10 µF capacitor passes only AC
to the speaker and blocks any DC.
The PIC508 is inexpensive and is about as simple as
microcontrollers can get. When it is put to sleep, it draws
less than two micro-amps. The op-amp draws about 230
micro-amps, so in total the two AA batteries should last for
over a year. I put in a one minute delay so that the unit
can be set down and arm itself. To save power, I use the
508’s sleep function.
When the micro is sleeping, there are a couple of
things that can wake it up. I used a watch dog timer
(WDT) and a pin change on one of the input pins (GP0). I
set the WDT to wake up every 2. 3 seconds; when this
happens, it increments a counter. When the counter
reaches 26 ( 60 seconds), it arms the alarm. If the sensor
detects any movement, it changes pin 7/GP0’s voltage
and this causes it to alarm.
How does the micro know what woke it up or if it
just turned on? With the status register. By checking the
bits in the status register, the micro will either jump to
the program area to increase the count or jump to sound
the alarm.
The magnetic transducer has a resonate frequency of
This is controlled by a counting loop in the software
in Listing 1.
Construction
■ Listing 1.
TONE
MOVLW
.068
MOVWF LOOP1
BCF SPEAKER
DECFSZ LOOP1,1
GOTO
MOVLW
$-1
.068
If you’d like to make your own boards, the files are
available on the Nuts & Volts website ( www.nutsvolts
.com) along with the software code, tips, and suppliers of
parts. Go to www.expresspcb.com and download their
free software for making your own boards and schematics.
This software will open the files on the website.
Pull the two wires coming out of the battery box back
into the battery box. Slide a piece of heat shrink tubing
over the black wire. Cut them to a length so that you can
still solder them, and then parallel solder them together.
Slide the heat shrink tubing over the solder joint and push
them inside the box next to the switch.
Use the board as a template and place it into the
center battery compartment of the battery box. The +
mark should be next to the spring of the battery
compartment. At first, you might think that’s wrong but it’s
not. Move the board toward the spring about 1/16”.
Using a small drill, make a hole in the center of the
speaker area into the box. Turn it over and using the small
hole as a guide, drill a 1/4” hole in
the battery box. Be careful not to
drill through the spring. This hole
is for the output of the speaker.
Depending on how you are going
to use the alarm, you can glue a
magnet on the back or pop-rivet a
lanyard so that you can hang it on
a doorknob.
MOVWF
BSF
LOOP1
SPEAKER
;LOADING A NUMBER TO BE DECREMENTED FOR FIRST
;HALF OF SQUARE WAVE (THIS SETS THE TONE)
;MOVE IT INTO LOOP 1
;TURN ON SPEAKER (GROUND THE SPEAKER)
;COUNT DOWN LOOP 1 UNTIL ZERO AND SKIP NEXT
;COMMAND
;JUMP BACK ONE UNTIL ZERO
;RELOAD NUMBER TO BE DECREMENTED FOR OTHER
;HALF OF SQUARE WAVE
;MOVE IT INTO LOOP 1
;TURN OFF SPEAKER (BOTH TERMINALS OF SPEAKER
;POSITIVE)
;COUNT DOWN LOOP 1 UNTIL ZERO AND THEN SKIP
;NEXT COMMAND
;JUMP BACK ONE UNTIL ZERO
;KEEP DOING UNTIL POWER IS SHUT OFF
Board Assembly
DECFSZ LOOP1,1
GOTO
GOTO
$-1
TONE
Tap the hole at the end of the
board next to the speaker with a
2-56 tap. This will be for a screw
which will make contact with the
34
June 2010