A burglar alarm is supposed to detect an intruder. To do that, though, the
alarm must be as sophisticated as possible to detect and act upon a variety
of situations. A computer, equipped with the proper sensors and actuators,
can do just this and become an effective burglar alarm.
Intruders may reveal their presence to a computer-controlled
burglar alarm in a number of ways. First of all, the intruder must somehow
enter the building-a door or window is the most logical means of entry. If
the computer's sensors are set to detect use of these entrances, an alarm
can be triggered when someone passes through them.
Sensors could also be set to detect anyone in areas considered
off-limits. For instance, if a sensor detects someone in the living room
when all rightful occupants are sleeping upstairs, the burglar alarm can
safely assume that an unauthorized person is in the protected area.
Another possibility is to have the alarm sensors detect
movement of particular objects. Most car alarms work on this principle. The
sensors can be set to tell whether your stereo, television, or anything else
has been moved. If an intruder tries to steal something, the burglar alarm
can alert you, or even alert the police.

Using What You Know
The previous projects in this book laid the groundwork for a burglar alarm.
In particular, the joystick project in Chapter 3 and digital light sensor
project in Chapter 7 will be used as the sensors. The electronic switch project,
found in Chapter 8, is the actuator required by the alarm. If you didn't
put them together earlier, turn back now and try them. Be sure you have a
basic understanding of these circuits before proceeding. You'll need to refer
to these chapters as you construct this burglar alarm.
As you saw in Chapters 2 and 3, a computer joystick is
actually a set of switches. Many types of burglar alarm sensors are switches
as well. These sensors can be connected to your computer in the same way
as a joystick-through the I/O lines of the control port.
One type of switch sensor is a thin, adhesive, metallic
tape that can be stuck on windows and other glass. This tape normally acts
as a closed switch, allowing current to flow through a circuit. If the glass
is broken, the fragile tape breaks, too, and the circuit is interrupted.
Another type of switch sensor is a magnetic switch. This sensor is generally
used to detect doors and windows being opened or closed, but it could also
be installed on desk drawers. A typical application is a magnet mounted on
a door, with the magnetic switch mounted on the door frame. When the door
closes, the magnetic switch either closes or opens, depending on the type
of switch. When the door opens, the magnetic switch changes.
Other types of sensor switches include vibration detectors,
ultrasonic sensors, and even infrared sensors. Most of these "switch" alarm
sensors can be purchased at electronic stores such as Radio Shack.
Your alarm will use the digital light sensor project
built earlier to detect entry into an off-limits area. The light source and
sensor should be set up so that any light in the controlled area will trigger
the sensor.
The computer will use the electronic switch to turn on
the alarm itself. The alarm can be a buzzer or a louder alarm (providing
it doesn't exceed the ratings of the relay or solderless breadboard). With
the proper programming, your computer could even use a modem to call the
police, and then play a tape recording announcing your address and reporting
a break-in.

Setting Up the Alarm
To set up your computer as a burglar alarm, plug the electronic switch into
control port 1.

Before placing the digital light sensor's 9-pin plug
into control port 2, solder wires for switch sensors to its pins 2, 3, 4,
and 6.

If you have a VIC-20, you need a new connector since both the electronic
switch, the digital light sensor, and the other switch sensors must be plugged
into the single control port.

To do this, you need to make a new connector:

1. Solder wires to pins 1, 2, 3, 4, and 6 of a 9-pin
plug. Solder two wires each to pins 7 and 8.
2. Remove the old connectors from the electronic switch and light
sensor cicuits.
3. The wire from pin 1 of the new connector inserts into point A4 of the
electronic switch circuit. It provides the digital signal required to turn
the electronic switch on or off.
4. The wire from pin 2 connects to point 14 of the light sensor circuit
to receive its digital output signal.
5. The wires from pins 7 and 8 provide the power to the two circuits. One
set of two wires from pins 7 and 8 connects to points Y1 and X1 respectively
of the light sensor circuit board. The other set of two wires from pins 7
and 8 connects to points X1 and Y1 respectively on the electronic switch circuit.
The remaining wires from the control port are used for switch sensors.

Whichever type (or types) of switch sensors you choose for your burglar alarm,
they must be normally closed. They're set up so that they ordinarily form
a closed loop between the ground pin of the control port and one of the I/O
pins. The Commodore 64, 128, and Atari computers can each have four switch
sensors connected to them in addition to the light sensor. The VIC-20 can
have three switch sensors in addition to the light sensor. For any of the
machines, there's no need to wire one end of the switch sensors directly to
pin 8 of the control port-any connection to ground, such as the x row of
the light sensor circuit, will do.
Since, in normal conditions, the switch sensors form
a closed loop between ground and their particular I/O lines, these lines
are at a logic low level. Similarly, the digital light sensor circuit outputs
a logic high signal as long as no light is detected. The computer program
of the burglar alarm can tell if things are as they should be just by checking
to make sure that the bits in the data register corresponding to the sensors
are off.
If one of the sensor bits of the data register has changed,
this means one of the sensors has been activated-its corresponding I/O line
no longer forced to ground. The burglar alarm program must detect if this
happens and send a signal to the electronic switch to turn on the alarm.
You may want to experiment with infrared emitters and
detectors, such as those used in the digital timer project of Chapter 7.
In a darkened hallway, you might be able to use the digital timer as a switch
for an intruder alert. Other infrared detectors and emitters could be purchased.

Program 9-1 is a simple demonstration program illustrating
the use of your computer-controlled burglar alarm. Once you have the basic
circuitry working, you can modify the program and circuit to add additional
sensors as necessary. If you need more sensors than this simple alarm allows,
refer to the multiplexer project of Chapter 12.
Program 9-1-Commodore 64/128

Before mounting sensors, you should first check your burglar alarm. The switch
sensors can be simulated by connecting their I/O pin wires to the ground of
either of the circuits. When you run the appropriate version of Program 9-1,
you're instructed to carry out the necessary adjustment to the digital light
sensor. Once you do this, your burglar alarm is operational.
To trigger the alarm, shine a light on the light sensor
or disconnect a switch sensor wire from ground. The program prints on the
screen which sensor was triggered and turns on the alarm after a delay of
several seconds (so that an authorized person could disable the alarm). The
alarm stays on for a couple of seconds before shutting off. You'll probably
want to increase the delay of timers when you install the system. (Of course,
a power failure will disable the alarm. The program will have been removed
from your computer's memory.)

Other Applications
Not all the applications for this project are as serious as a burglar alarm.
You could mount a magnetic switch on the refigerator door to make sure someone
isn't cheating on a diet. If you have a small store, you could use this project
to sound a buzzer when a customer enters. With some thought, you can modify
the program and circuit for almost any application.
Return to Table of Contents
| Previous Chapter
| Next Chapter