Home Alarm System: An analysis
Home burglaries and property trespassing is a common event; more than forty per one thousand households get robbed yearly. With the introduction of home alarm systems the rates of burglaries have dropped significantly for the past thirty years. Therefore, throughout the semester, we have been working on building a functional home alarm system using PIC microcontroller, a keypad, an LCD display and a magnetic sensor.
Household burglary is defined as an illicit entry or attempted entry of a residence which usually involves theft. The illegal entry may be by force, such as breaking a window or slashing a screen, or may be without force by entering through an unlocked door or an open window. As long as the person entering has no legal right to be present in the structure a burglary has occurred. Furthermore, burglary is not only the entry of the house by itself; illegal entry of a garage or any other structure on the premises also represents household burglary. 
Figure1.Home Burglary Statistics (2008-2011).Washington Post [Photograph].Retrieved from http://homesecurity.net/home-burglary-statistic/
The most common targets are residential houses. Those of them without security systems installed are about three times as likely to be broken into as homes with security systems installed. Moreover, the first place that the robber will search is usually the master bedroom because most people keep their valuables there. The preferred items to be stolen are cash, jewelry, electronic equipment, silver, guns and other items easy to put on the market. 
Statistics showed that every 14.6 seconds, a burglary takes place in the United States and most of them occur between 10 am and 3 pm. Burglars spend an average of 8 to 12 minutes in your household. The residence owner can take the following safety measures such as: burglars search for homes that appear to be vacant; robbers want to waste no more than sixty seconds breaking into a home. 
Points of Entry of Burglars:
Figure2 .Burglary Facts and Statistics (2008). [Photograph]. Retrieved from http://www.articlesbase.com/home-and-family-articles/burglary-facts-and-statistics-338161.html
One survey in Pennsylvania showed that:
81 percent of residential intrusions occur through the first floor.
34 percent of burglars entered through the front door;
23 percent through a first-floor window;
22 percent through the back door;
9 percent through the garage;
4 percent entered through a basement;
4 percent through an unlocked entrance;
2 percent through a storage area;
2 percent entered anywhere on the second floor. 
Definition of a Home Alarm System:
A home alarm system is used as a defensive device to monitor all unwelcome events such as intrusion, glass breaking and mainly to avoid theft. It is also used to alert a user of a possible danger. It focuses on all of the accessible entry points of the house, so that the alarm will sound as soon as the intruder enters.
The most important advantage of the home alarm system is the security it offers from theft of costly things such as the jewelry, the television set, your pc, cell phones, and etcâ€¦ causing massive financial problems. In addition, a home alarm system is necessary not just for the material possessions in your home but also increases protection on the family. Furthermore, a burglar may want to break the door of your house while barging in. You also might have to cope with broken windows, smashed furniture and other general damage. Making up for this damage will be expensive not just time wise but also requires great deal of effort since burglars these days are interested in expensive items. They search for important identifications such as your bank statements, passports, and credit cards, essentially whatever they get their hands on. The misuse of these documents will disturb your economic balance.  Therefore, it is recommended to install a home alarm system at your place.
One of the main disadvantages and is mainly caused by a malfunction is the generation of a false alarm where it can be triggered accidentally and thus cause unnecessary inconvenience. Moreover, having children might cause a lock of the system by improper insertion of the password. Also, if you failed to insert the password in time, the alarm may be triggered. Some burglars are highly experienced and have the knowledge to disable the alarm, the phone lines, and the electricity leaving you helpless in a critical situation.
How Does a Home Alarm System Operate?
Sensors are the most vital part of the system; they act like the eyes and ears of a home alarm system by monitoring break in points and interior areas. The typical sensors, which are usually two magnets, are generally installed on doors and windows such that one magnet is connected to the door or window and the other is connected to the door or window frame. When the door or window is opened, one magnet is removed from the surrounding area of the other and the sensor registers that the door has been opened. More advanced home alarm systems may also contain vibration sensors to detect when glass has been broken by measuring the vibrations caused by the breakage. Also, many systems use motion sensors that compute the proximity of a room’s walls by producing infrared beams and measuring the time required for them to bounce back; if a beam comes back sooner than expected, it likely bounced off of a person and the sensor registers motion. 
When the alarm system is installed, each sensor is registered with the control panel either through wires or wirelessly. The control panel also interfaces with keypads and other input devices used by the home owner to control the system.
The control center keeps track of the status of the sensors and reports activity through LCD displays and other output devices. Moreover, when activity takes places, such as the opening of a window, the sensors report the activity to the control center and the center registers that a disturbance has occurred. In managed alarm systems, the control panel also checks the sensors to verify that they are still operational; if a sensor fails to reply, the center alerts the home owner of an out of order sensor. If the home owner activates the alarm system and the control center registers activity in the home, a signal is sent by the control to a buzzer, flashing lights or any other audiovisual alarm element.
Types of Alarm Systems:
Home burglar alarms normally include the following:
Window and door sensors
Main control panel
Centrally located keypad
Exterior security signs
Hard-wired or wireless construction
These systems are often centrally monitored by a security provider that alerts authorities of break-ins.
Some of the more common systems that are included in many homes:
Smoke alarm systems include smoke detectors, possibly strobe lights and hearing impaired features for seniors and hearing impaired home owners.
Fire alarms include a series of smoke detectors, heat detectors and possibly an in-home sprinkler.
One ignored aspect of your home security is your home’s built in systems, such as heating and cooling and plumbing.
Critical System Alarms include:
Cooling and heating alarms have detection and monitoring devices that transmit information about your heating and cooling system often directly to a monitoring company.
Flood and water alarm systems monitor your plumbing system where even small leaks can go unnoticed and result in thousands of dollars in repairs. 
Types of Alarm Sensors:
Alarm Sensors are essential elements of your home security system. A wide variety of security alarm sensors and detectors are available for use. It is obvious what most sensors do, so we will only describe the main ones used in a basic system.
Contact Sensors: Most burglaries involve doors, either on entry or while leaving the house. So protecting all doors is a must. (Example: magnetic circuit breakers).Door contacts may be hardwired or wireless; hardwired contacts are usually buried in the doorframe, which is less obvious than wireless and are preferable.
Window Contacts: Can be hardwired or wireless.
Motion Sensors: It’s the most essential and common form of protection.
Passive infrared sensors: Detect motion by sensing a sudden change in heat.
Dual-Tech motion detectors use two different technologies in the same unit: passive infrared and microwave. These devices are designed to avoid false alarms since both technologies must detect motion before setting off the alarm.
Photoelectric Sensors: These sensors project a beam of light across a hall or doorway to detect motion and are triggered when a person passing through interrupts the beam.
Glass Break Detectors: Usually mounted near windows to detect the specific high frequency sound of glass being shattered. They are usually installed on a wall opposite or adjacent to the protected glass and are effective within about 15′ to 25′.
Smoke and Heat Detectors: Detect smoke and heat. 
Our Home Alarm System
Our Home Alarm System:
Our project’s main concern was to build a Home Alarm System using a PIC microcontroller. We started off our project by coding the Keypad, then LCD and the final touch was the sensor. We also added two types of buzzers: one to sound the alarm and the other as a key tone buzzer. The final result turned out to be the following:
Figure3. Our Home Alarm System
Materials Used: Cost:
4X4 Keypad 2$
JHD 162A LCD 6$
6V Alarm Buzzer 0.5$
Key tone Buzzer 0.5$
4 MEGA Crystal Oscillator 5$
3 Flashing LEDs 0.1$
9 Resistors (10Kâ„¦, 470 â„¦, 1Kâ„¦) 0.1$
18 Pico Capacitors 1$
Magnetic Sensor 2$
Total Cost: 27.3$
Process of Building:
First of all the PIC:
PIC is a family of Harvard architecture microcontrollers. The name PIC refers to “Peripheral Interface Controller”. They are popular with both professional developers and hobbyists alike due to their low cost, wide availability and large user base.
The PIC has an overall of 40 pins. These pins include input/output ports such as PORTA, PORTB, PORTC, PORTD, PORTE and two Vdd ports for input voltage.
The PIC architecture is characterized by its multiple attributes:
Separate code and data spaces (Harvard architecture).
A small number of fixed length instructions.
Most instructions are single cycle execution, with one delay cycle on branches and skips.
All RAM locations function as registers as both source and destination of math and other functions.
A hardware stack for storing return addresses.
Data space mapped CPU, port, and peripheral registers.
The program counter is also mapped into the data space and writable.
There is no distinction between memory space and register space because the RAM serves the job of both memory and registers, and it is usually just referred to as the register file.
This device is used to enter the password selected by the user and to arm or disarm the alarm by selecting the various profiles installed in the system. As you can see from our project’s picture we used a 4 x 4 keypad, as instructed by Dr. Ayoubi we started off our project by working on the keypad and testing it on Proteus and on the PIC itself.
The design of a 4 x 4 keypad can be approached by either adopting the serial or the parallel concept. The serial concept is tedious in terms of software effort, complex in circuitry and slow in response. However, it requires few interface lines. Meanwhile, the parallel concept on the other hand is less complex in circuitry, less software intensive and faster in response. Its concept also requires more interface lines, that is, 8 plus an interrupt line for a 4 by 4 keypad. 
Our design for a functional keypad was the usage of an alternation of ports between inputs and outputs which is done by using the TRIS function. We started off by setting the first four ports of PORTB as the inputs and the latter four ports as the outputs. This is done by moving the binary literal ‘11110000’ to the working registers and having the latter four ports pulled down by 10kâ„¦ resistors. The first four ports are connected to the columns meanwhile the last four are connected to the rows. Moreover, as a justification for this reasoning is the fact that it is required to scan the columns for the pressed key and then scan the rows and the results will be decoded in a decoder telling us which button of the keypad was pressed.
The main functionality of the keypad as mentioned earlier is to set the code. The alarm can be armed and disarmed with a standard four digit user code in our case. The master code is a step above a regular user code. It is used to unlock the system, as well as programming or erasing a regular user code. Theoretically it can also be used to bypass some sensors. The default password set during the design, which is also the installation code, is 1234. Most alarm companies use the same installer code for all of their installations, and the vast majority will never give their installer code to a customer, for obvious reasons.
LCD (Liquid Crystal Display):
An LCD is a thin, flat electronic visual display that uses the light modulating properties of liquid crystals (LCs). They are used in a wide range of applications, including computer monitors, television, instrument panels, etc. They are common in consumer devices such as clocks, watches, calculators, and telephones.
Liquid crystal displays (LCDs) offer several advantages over traditional cathode ray tube displays that make them ideal for several applications. Of course, LCDs are flat, and they use only a fraction of the power required by CRTs. They are easier to read and more pleasant to work with for long periods of time than most ordinary video monitors. It also has few disadvantages, such as limited view angle, brightness, and contrast, not to mention high manufacturing cost. As research continues, these limitations are slowly becoming less significant.   
In our design, we used a 1k resistor to set the contrast at the LCD display.
The sensor used is the typical magnetic switch circuit breaker as shown in the figure below:
Figure4. How Burglar Alarms Work. Retrieved from http://home.howstuffworks.com/home-improvement/household-safety/security/burglar-alarm1.html
A magnetic sensor is used to detect any changes as well as disturbances in a certain magnetic fields. In addition, when the magnets are separated it means we have an open circuit and when it is closed it acts like a short circuit.
When the door is closed, the magnet pulls the metal switch close so the circuit is complete. Then, the current powers the relay’s electromagnet, so the buzzer circuit stays open. When you move the magnet by opening the door, the spring snaps the switch back into the open position. This cuts off the current and closes the relay, sounding the alarm. 
Functionality of our system
As soon as we connect the 5V power source the alarm greets us with a welcome message displayed on the LCD then asks us to provide the password. Once entered correctly the green LED flashes accepting the code. If the password entered was incorrect the red LED flashes and the system gives you two further chances to enter the correct password. If both remaining attempts failed the system will lock. The only way to unlock the system is by clicking the star key (*) for more than five seconds. This feature should be kept a secret between the user and the company otherwise anyone who knows it can unlock the system and keep trying to hack into it.
The keypad should be installed next to the entry door because it is programmed with a time lag, to permit you to exit when leaving, and enter on arriving home, without activating the alarm. We have set a profile that gives you 20 seconds before leaving the house and the alarm starting. By clicking the (A) button on the keypad the counter starts giving you the amount of time to leave the house. If the magnets of the magnetic switch get separated, by the opening of a door or a window (depending on where it is installed), the internal invisible counter gives the user 15 seconds or 3 trials to set the password correctly or the alarm will go off. The alarm will remain firing until the password is set correctly.
Furthermore, the option of changing the password is also available. In order to do so insert an incorrect password and the red LED flashes. While it is blinking click on the star button and wait until the yellow LED blinks and the LCD displays “INSERT ADMIN PASS”. In our system the administrator password is “5678”. After inserting the correct administrator password the system will ask you to insert the new password then once again for confirmation. The administrator password however cannot be changed unless we change it in the code and download it again on the chip.
Algorithm & Design
Figure5. Block Diagram showing how the system functions
Figure6. Block Diagram showing how the keypad functions
Figure7. Our Design on Proteus
Conclusion & References
As we have seen in the graph “Burglary rates” figure7, the alarm system is becoming a must in modern day life in order to protect our valuables and the ones we care about. As we can see from the graph below, the rate of burglary is declining in 1981 that is when technology started evolving greatly and as we can see with time crime kept on decreasing.
Figure7.Key Facts at a Glance (2011).Retrieved from http://bjs.ojp.usdoj.gov/content/glance/burg.cfm
Figure8.Certified Security Systems (2010). Retrieved from http://certifiedsecuritysystems.com/crime-statistics.aspx
In flow chart figure8, alarms are moderately effective (57%), 40% very effective, and 3% not effective as owners say. Alarm owners are very satisfied with price and value of security systems such that 74% excellent and good, 22% just okay, and 4% Poor and Terrible.
In conclusion, comparing our cost to the prices on the market we can see that systems cost from 30$ to 200$ depending on the number of sensors, the ground it covers and its specifications. Therefore, we recommend each house owner to buy an alarm system because it is not very expensive and might save you the trouble and the inconvenience and the financial losses caused by a robbery.
 Alarm Sensors…Are Essential and Primary Elements of Your Home Security System (n.d.). Retrieved January 19, 2011 from http://www.home-security-action.co.uk/alarm-sensors.html
 Burglary Facts and Statistics (2008).Retrieved January 19, 2011, from http://www.articlesbase.com/home-and-family-articles/burglary-facts-and-statistics-338161.html
 Certified Security Systems (2010). Retrieved January 20, 2011 from http://certifiedsecuritysystems.com/crime-statistics.aspx
Evans, K. (n.d.). How Does a Home Alarm System Operate? Retrieved January 18, 2011 from http://www.ehow.com/how-does_4568395_home-alarm-system-operate.html
 From Burglar Alarms to Fire Alarms (2008-2011). Retrieved January 19, 2011 from http://homesecurity.net/security-alarms/
 Gowan, M. (2000). How it Works: LCD Monitors. Retrieved January 20, 2011 from http://www.pcworld.com/article/15112/how_it_works_lcd_monitors.html
 Harris, T. (n.d.). How Burglar Alarms Work. Retrieved January 20, 2011 from http://home.howstuffworks.com/home-improvement/household-safety/security/burglar-alarm1.html
 Home Burglary Statistics (2008-2011).Washington Post. Retrieved January, 19, 2011, http://homesecurity.net/home-burglary-statistic/
 How Hard Wired Home Alarm Systems & Its Add On Components Work! (n.d.). Retrieved January 20, 2011 from http://www.top-home-security-info.com/home-alarm-systems.html
 Interrupt Driven 4×4 Keypad (n.d.). Retrieved January 19, 2011 from http://priorartdatabase.com/IPCOM/000005778
 Introduction to Liquid Crystal Displays (n.d.). Retrieved January 19, 2011 from http://plc.cwru.edu/tutorial/enhanced/files/lcd/intro.htm
 Key Facts at a Glance (2011).Retrieved January 19, 2011, from http://bjs.ojp.usdoj.gov/content/glance/burg.cfm
 Krejcik, R. (2010). Advantages of a Home Alarm System. Retrieved January20, 2011 from http://www.realestateproarticles.com/Art/30563/271/Advantages-of-a-home- alarm-system.html
 LCD (2011). Retrieved January 20, 2011 from http://www.webopedia.com/TERM/L/LCD.htmlOrder Now