EE 476 Final Project: Home Security System

Zachary Seto
Jackson Yu
May 3, 1999

I. Introduction:

For our final project, we designed a home security system with three detection zones. We used magnetic sensors to detect for zone faults. The magnetic switches would trigger the alarm system when opened. A 4-digit security code armed and disarmed the system. The alarm system includes the following features:

II. Design and Testing Methods:

High level design

In the initial state, the system will be in a ready status. Any zone faults occurring in this state are displayed on the LCD, and a flashing green LED is use to signify a warning. This operating state accounts for when the homeowner is at home with windows or doors opened. The system cannot be armed unless all the zones are clear of violations.

Pressing the programming key "A" while in the ready state brings us into the programming stage. The old security code is requested to verify the user. If confirmed, the system prompts for a new security code. Then it prompts for the new code again for confirmation. If any verification fails, the system returns to the ready state with no changes to the alarm code.

When no zones are in fault, the system can be armed by entering the security code. If a zone fault occurs in this state, then the zone(s) in violation are displayed on the LCD panel, and an alarm is sounded. Entering the security code again will disarm the system. Also, Zone 1 has a 15 second delay in sounding the alarm to allow for the owner to enter the front door and disarm the alarm.


Program/hardware design

For the design of our home security system, we used the following hardware:

We spent a significant part of our time in trying to figure out how to implement both a NAPCO MA900 Security Panel and a RP1009 KeyPad (w/ status LEDs, 7 segment display, and keypad). The manufacturer only provided minimal documentation on the installation of the panel and no technical documentation on the actual keypad-panel interface. We tried to determine the specifics on how data was transferred to/from the KeyPanel by measuring signals outputted and by sending data signals to it. Another issue we ran into was implementing a level shift from the 5 Volt output on the Port pins to 12 Volts on the KeyPanel. A simple BJT circuit could be used to solve this issue. We would have needed 6 of these circuits for outputting to the Panel and 6 more circuits for receiving input from the Panel. With these roadblocks, we decided to design our own panel by reverting back to using the keypad and LCD display.

We used a polling method as in previous labs to decode which key was pressed on the keypad:

  1. Set PC0-PC3 to output & pulled low
    Set PC4-PC7 to input & pulled high
    Read PC4-PC7
  2. Set PC4-PC7 to output & pulled low
    Set PC0-PC3 to input & pulled high
    Read PC0-PC3

If a button was pressed on the keypad, then exactly one bit in each of the following will equal 0.

  1. PC4-PC7
  2. PC0-PC3

In each of the alarm states described above, we used the polling method to test for zone faults and to check for keypresses.

In designing our program, we used Timer0 for sounding the alarm tones for our alarm (alternating notes between c4 @ 262 Hz and f4 @ 349 Hz). A prescalar of 64 was used on Timer0 to generate the correct frequencies for the alarm notes.

Timer1 was used primarily for

  1. Implementing our delay loops to debounce our keypad
  2. Delaying the sounding of alarm upon entry in zone 1
  3. Blinking the LED.

We used a prescalar of 256 for the debounce delay loop, which gave us 15ms of wait time, while a prescalar of 1024 gave us the .5s of wait time for controlling the blinking of LEDs and the 15s wait time for entry in zone 1.

For the alarm zones, we tried to use Pins A0,2,4 as output (5V) and to poll Pins A1,3,5 (set to input). However, we ran into the issue where we could not get our zones to trigger a fault because Pins A1,3,5 would not go low if a zone fault occurred when a magnetic switch was opened. So, we had to modify our circuit and code so that zone faults occur when Pins A1,3,5 go high. With normally closed switchs, the Pins get pulled low when the door/window is closed.

III . Analysis:

Results of Design

We were successful in implementing our home alarm system. We ran into a minor issue of requiring the zone faults to occur simultaneously in order be recognized. It is a minor issue because a zone violation has occurred whether it is one or more zones. This occurs only when the system is armed. In the ready state, zone status is current for all times. We were only able to implement three detection zones instead of eight as in our final project proposal. The limitation came from the number of ports we had available and the number of magnetic switches we were able to obtain. We also had some problems with the alarm tones where they would mysteriously stop sounding. We tried to debug this problem, but could find no problem with the code (a straight forward implementation from Lab 3) nor any other problems. This isn't too big an issue because, in all practicality, the Port would be connected to an external siren horn which would have a siren oscillator built in. The Napco MA900 panel doesn't even implement this feature; it simply provides power to the speaker pins for a siren oscillator. However, we implemented the siren tones for expository purposes.

Future Improvements

A limitation in our design is that zone faults must happen simultaneously (when the system is armed) to get displayed on the LCD screen. In the future, we would like to show multiple zone faults on the LCD panel when they occur in the armed state. Some other features that we may include are:

IV. Appendix I -- Source Code

V. Appendix II -- Zone Schematic

Zone Schematic