Building a Simple Home Monitoring System

Posted Mar 8, 2006 | by roger  

Many of us have older computers stilting around that we don’t know what to do with – or at least enough leftover components to assemble a “basic” computer. And yet such computers can be used for many interesting projects. Even an older computer can be used. Even with only DOS and BASIC on your computer, the possibilities can be almost endless. (BASIC comes with almost any version of DOS, or can be found on older PCs, or on many Windows CDs. Older versions of Visual Basic can be bought fairly cheaply, and free BASIC versions can be found/downloaded).


What can you do with that old computer? How about turning your computer into a low cost home/business alarm system? One that will issue a visual and audio alarm if anyone comes in your house or business and it will tell you how many times and even the date and time, that anyone has entered and left your house, or any particular room in a building.


You can do this even project if you have limited technical knowledge. All that is required is a PC, two keyboards, a few standard burglar (momentary contact) alarm switches, or homemade switches, and a few lines of BASIC.



The Keyboard – Connecting Your Computer to the Outside
Your keyboard is designed such that each key will send out its own particular [ASCII] code when pressed. And your computer is designed to interpret each key as a particular letter, number, or symbol.


It is easy enough to write a simple program in BASIC that will register which key on the keyboard has been pressed and even issue a sound when the key is pressed.


“So what good is that?” you ask. Actually, not much – until you “wire in” to your keyboard. When you connect your keyboard into external devices/switchers, you can turn your computer into a home or building monitoring system.



To Build Your Home Monitor
To start with, get an old or cheap keyboard (and you’ll need a second working one to program your computer). Take the keyboard you want to use for the project and try to remove a few keys – or just disassemble the keyboard. Usually you can just pull individual keys out, but you may have to break the keyboard open to access the internal electrical contacts.


Many keyboards can be taken apart by removing screws located at the bottom. With other keyboards you may have to use a screwdriver at the side seam to break it apart. You can also use a screwdriver to remove a few keys from the keyboard.


Once you have taken the keyboard apart, or just removed a few keys, look for the keyboard circuit board, and the electric contacts associated with each key. You should see a point where the key makes electrical contact (or shorts) across two contacts. There is where you want to wire into. To test, you can use a piece of wire to try shorting the suspected contacts and watch for a letter to appear on your computer screen.


Note: Many types of keyboard designs exist. On certain keyboards you may have to cut through the plastic that to get to the electrical contacts. On other keyboards you may have to wire into the circuit board itself. In other cases you might want to try another keyboard that is easier to hack. The keyboard is a low voltage device, however, you still could damage it by shorting the wrong contacts. Examine the way an individual key works and try to track down the exact two electrical contacts that the key connects.


For wiring, “clear” speaker wire works nicely, it is easy to handle and easy to hide. About the smallest gauge of speaker wire you can find will work. Place the burglar alarm switches at doors or windows, and wire them back to your keyboard. Remember that a keyboard works on a momentary contact basis. So, that is the type of burglar alarm switch you want, one that makes momentary contact – about a quarter of a second should do.


In most cases you can make your own switch. If you install a simple electrical contact on a door and on the doorframe that makes contact during the time when the door is opening or closing, that would work.



Getting and Learning BASIC
With all the alarm switches wired in, you can now use BASIC to program your computer to indicate when a switch is activated. Learning BASIC is easy. I prefer older versions because they have the commands you need without requiring you learn the Windows environment. However, even Visual Basic can be used in a simple format – without the need to create dialog boxes and such.


Older versions of BASIC such as GW BASIC, QUICK BASIC, and QBASIC, can be found on most DOS disks, or Windows OS disks. Look for “Old DOS” or “DOS” directory on Windows 9x installation medium. You can also download a number of free versions of BASIC off the internet. Just search for “BASIC language” or “QBASIC” and so on. QBASIC still has a good following. To learn QBASIC, or to get help writing a program, try these tutorials/forums:


http://pages.intnet.mu/jhbpage/Program/Qbasic/tutorial/index.htm – Pretty simple. A good starting place
http://www.qbasic.com/ – Old and new forums
http://qbasicnews.com/learn/tutorials.shtml  – General information, news, forums



For Visual Basic, try these:


www.devdos.com/vb/wanttobe.shtml – A good starting point
www.vbtutor.net/vbtutor.html



The Program
As mentioned earlier, you can program the computer to indicate which switch has been activated (i.e. which window was opened), what time it occurred, and sound an alarm. The BASIC program is quite simple. Say that the “D” key is tied to the switch at the front door. Here is the program you would write:


(Note: this is a generic-BASIC program for an example. Check the manual/tutorial for the type of BASIC you use.)


10 CLS  [Clears screen]


20 CLEAR  [This command clears previous values (such as C=3) from memory.


30 A$=INKEY$  [This makes the variable A$ equal to whatever key that is closed]


40 IF A$= “D” THEN PRINT “FRONT DOOR OPENED” THEN PRINT TIME$: THEN SOUND 200, 180   [This tells the computer that if the D key has made contact, print on the screen "FRONT DOOR OPENED" and print the time it was opened, and issue a warning sound of 200 Hz for about 1 minute]



100 GO TO 20 [Return to line 10 to keep scanning keyboard]


This program will print out to the screen each time the door is opened [and closed], and sounds the alarm, and indicate the time. All entries will be printed on the screen.


Take note that line 40 is just one command for one key. Many such lines can be written for each key that to which you have wired a switch.  You could also have the computer monitor how many times the door has been opened, to indicate how many people came in or out of your house or building by adding to line 40: “THEN A=A+1″  This will cause A to increment each time line 40 is activated.



Going Further
Keep in mind that all you need is for electrical contact to be made, and relayed back to the keyboard. With a little imagination, you can make more than door and window switches.


How about a flood alarm? You can use a small float in a container, with wired contacts made such that if water lifts the float, electrical contact is made. With your imagination the uses of such a monitoring system should be almost endless.

Which Of These Traits Applies To YOUR Computing Life?...

3 Responses to “Building a Simple Home Monitoring System”

  1. christine says:

    U mentioned to use speaker wires for this project..What if I would like to increase the monitored area such as two houses up to 3 stories high..will the attenuation of the signal affect the input to the keyboard? Is there a need for a better type of cable used?

  2. Dan says:

    Would like to monitor the heat in my house while I am away. It is minus 34 degrees celcius out there tonight. If the heat goes off my water system will freeze. Suggestions? Products?
    Thanks
    Dan

Leave a Reply