Computers against crime; the TRS-80 foils a thief. Kel Hess.
Computers Against Crime
Recently my high school math department purchased four TRS-80 computers at a cost to the school board of approximately $3500. When they found out that their insurance was $1000 deductible, they decided to have an alarm system installed at a cost of another hundred dollars or more.
When I discovered this, I thought, why not have the computers monitor themselves to make certain that they don't get stolen?
The first step was to check with the local Radio Shack manager to see if it would harm a computer to be left on overnight. A negative answer gave me the go-ahead, so I thought about what I would like the computer to do as it sat idle night after night. The first and most important function that came to mind was to "watch' the rooms to see if a door was open or a window open or broken. I realized that the computer would have to do something other than just make a loud noise if there were a break-in, so I tried to think of a way to make the machine call the police (or any other number) and play a pre-recorded message.
The dialing was the easy part as I had previously worked on a program which would dial my home phone for me. The hard part was figuring out how to have the computer tell the police that there was a break-in occurring. The first thing I considered was to have the computer pick up the phone and play the tape aloud, but that wouldn't work since the person breaking in would hear the recording and stop it from playing. After much thought, I came up with the following system.
Monitoring the Doors and Windows
This is the part of the alarm that took the most time to prepare for final operation. First I had to wire all the doors and windows in the room with magnetic switches so that if a door or window were opened it would trip the alarm. Then, since I wanted to make certain that no windows were broken, I had to run window foil around all the windows.
After installing all the switches, I had to wire them in series so that if anyone tried to break in, he would open a switch or break the foil on the windows, thereby tripping the activator hooked to the computer. See Figure 1 for a schematic of this activator.
The computer sends an oscillating pulse to the amplifier which is then sent back into the computer. If the signal makes it back to the computer, then port 255 reads 191 which means that everything is okay. But if the curcuit is broken, the signal never makes it back to the computer, and port 255 changes to 63. So if port 255 is ever 63, it means a break-in is occurring.
The Phone Dialer and Message Player
When a person dials on the telephone all he really does is send a series of electronic pulses over the line, ranging from one pulse (representing a 1) to ten pulses (representing a 0). Therefore, to make the computer dial the telephone, I wired the cassette remote control to not only start the tape player but also to pick up the phone and dial it. I wrote the program so that it would first pick up the phone by completing the circuit between the telephone line and an isolation transformer (see Figure 2).
The remote plug connects the circuit long enough to get a dial tone, then dials the local police emergency number 911 by pulsing out through connecting and disconnecting the circuit at the right intervals. At the rate the telephone equipment in my area can handle these pulses, I found that the computer can dial 911 in just a few seconds. (This will work on any type of phone line, either dial or touch tone service.)
At the same time, the cassette control also starts the cassette tape player which repeats a pre-recorded message telling the police where the break-in is occurring.
To keep the burglar from hearing the message, I hooked the ear plug of the tape recorder to the other side of the tansformer (see Figure 2) which enabled the recording to go directly over the phone lines without being heard in the room.
The only problem was that if the emergency number was busy, the computer wouldn't know the difference, and would play a recording to a busy signal.
To solve this problem I programmed the computer to play the message three times, hang up, wait a minute, then call the number again and replay the message. Just in case it was still busy, it would go through this cycle one more time. All told, the computer would contact the police and tell them of the break-in a total of three times.
Another possibility was that the telephone might be ringing at the time of the break-in. The computer would still pick up the phone, dial, and start the recording. If a burglar knew the system he could conceivably call ahead and get the phone ringing; then the computer couldn't dial out.
To combat this the program insturucts the computer to pick up the phone before dialing (to answer any possible ringing), hang up again, then immediately pick up the phone again and dial the emergency phone number.
The only aspect I haven't covered yet is how the teacher gets into the computer room in the morning without setting off the alarm. The answer to this is simple. All I did was connect two key switches that were wired in series, and wire the two in parallel with all the alarm switches (see Figure 1). I put two key switches in the circuit so that if one key was somehow duplicated, the door still could not be opened. It takes both keys to open a door, making it twice as hard to break in. When both of these switches are closed, the other switches are overridden so that when the door is opened, the circuit is still closed and the alarm does not go off.
Also in the first line of the program there is a statement that reads POKE 16396,23. This statement freezes the BREAK key which makes certain that even if the intruder knows to stop the computer by pressing the BREAK key, it won't work. The program continues to do its job whether that means monitoring the room or calling the emergency number and alerting the police.
The activator is an amplifier which amplifies the output of the computer (what is normally fed into the cassette from the computer) and after amplification sends it back into the input (what is normally sent into the computer from the cassette). If a door switch is opened, or a window is opened or broken, the circuit opens, and the computer no longer hears the signal that it is sending out. When someone comes in the room in the morning, after they close both key switches, the circuit is kept closed and the computer continues to hear itself.
The telephone dialer and cassette starter are two devices in one. Both devices are activated by the cassette-control remote plug. When the computer activates its relay, it in turn energizes either two SPST relays (as pictured) or one DPST relay. One set of terminals goes straight to the cassette player to start it; the other goes to a 1:1 ratio (isolation) transformer which is hooked to the telephone lines (see Figure 2).
When the computer clicks out a digit, this relay pulses out the needed pulses to simulate a telephone being dialed. So that the person on the other end of the phone line can hear the recording without the person in the room hearing it, I used an isolation transformer which sends this recording directly over the telephone lines.
To set the volume control to the correct level you first have the computer call a friend, then adjust the cassette player to the correct level. This isolation transformer not only protects the cassette tape player from the telephone lines, but it also protects the telephone equipment from the cassette tape player.
Line 0 freezes the BREAK key so that no one can stop the computer once it is started. The only way of stopping it is to either turn off the power or press the reset button. Both of these buttons can be protected by a small cover of some type. (What about pulling the plug?--Ed.)
Line 10 dimensions the maximum length of the phone number to be dialed. I have it set for 15 digits (including pauses) but this length can easily be changed.
Lines 40-50 keep a constant check on the cassette port (255) to see if there has been a break-in. Line 40 sends a signal to the amplifier, and line 50 checks to see if the computer is receiving the signal (191) or not (63). If the computer is receiving the signal, then it will just keep looping here, chechking the amplified signal until it goes off.
If there is a break-in, the computer gets ready to call the emergency number. Line 110 contains the telephone number that is going to be dialed. In this case it is 911, but if the alarm is inside an office where 9 must be dialed to get a dial tone, the computer must know to dial 9, then pause before dialing the emergency number. So wherever a pause is needed, insert a hyphen. For example, the emergency number programmed in the computer now would be stored as 9-911. Or if this does not provide enough time, you might need to store the telephone number as 9-911.
Lines 150-200 decipher the telephone number stored in A$. Line 170 checks to see if there are any pauses, and if so converts them to 99's. If the digit called for is a zero, then to dial a zero the computer must send ten pulses over the phone lines; so line 180 changes all 0's to 10's. All of these digits are stored in B(1) to B(x), x being the total number of digits and pauses. For example a number being stored as A$.95550123' would be stored in B(1) through B(9) as 9,99,5,5,5,10,1,2,3.
Lines 210-230 just have the computer pick up the phone for a second, hang up, and then pick it up again before it starts dialing. This cycle is in case the telephone is ringing at the time of the break-in. The computer would actually hang up on whoever was calling and then proceed to call the emergency number.
Lines 240-330 are the dialing routine. Line 250 checks to see if there is a pause needed. If so, the computer pauses, then continues with the next digit. Lines 270-300 disconnect and connect the circuit to cause the dialing. The computer goes through this cycle the number of times equivalent to the digit being dialed, then waits at line 320 for a second and then goes on the next digit.
When all the digits have been dialed, the computer leaves time in line 340 for the pre-recorded message to be played; it then hangs up, waits a minute, and starts all over again. After a total of three times, or as indicated by line 140, the computer unfreezes the BREAK key, and waits for someone to arrive.
As for the pre-recorded message being sent over the telephone lines, I suggest the Radio Shack 20-second endless-loop blank tape (stock number 43-401), which is used for answering machines. Make a 20-second emergency message saying something like this . . .
"This is an emergency call, there has been a break-in at 1234 Fifth Street, in room 67, on the 6th floor.'
Be sure to give all the information the police will need. Then adjust line 340 so that during each call the recording is placed two or three times.
Some possible ways of changing this program would be to have the computer dial more than one person in case of a break-in. For instance, have the computer call the police, then the owner, then the programmer, then the police again. There are probably many different ways the program could be changed to better fit the needs of a specific business, but this program gives you the basics that you need.
Photo: Figure 1.
Photo: Figure 2.