Beruflich Dokumente
Kultur Dokumente
Final Report
Submitted By:
The purpose of this project was to design, build, and test a burglar system. Using
simulation software and a programming code that was made to control operation of the
system via a microcontroller. A user interface was designed that will enabled the user
the burglar alarm system, the programming code was implemented with a visual
interface, a LCD display unit and a keyboard. The system was tested by triggering
code, user interface, and sensor compatibility while undergoing random presentation
testing. The team as a whole cumulatively worked on all paperwork of the project,
testing the system, designing the programming code, and building an interface for
Home safety is a key concern among many homeowners. The burglar alarm system
provides an added sense of security when just locking the doors is not gratifying
enough. This need for household security is a concern that dates back to the 19th
Century. The electric burglar alarm system has been around since the mid 1800s. The
first electric burglar alarm system was invented in Boston, MA, by Edwin Holmes in
1852. It consisted of a tripwire that electrically powered a solenoid which struck a gong
when it was set off. Holmes then turned his system into a business and moved to New
York. When in New York the American Telephone and Telegraph Company (AT&T)
bought the company from Holmes. Once bought, AT&T hooked all the personal burglar
alarms up to the same grids as those aligned with the police and fire department. This
let the police or fire department know when somebody was breaking into a house or if
In the 1970s the burglar alarm system evolved to have motion detectors installed with
each system that was set up. The following decade brought about the introduction of
infrared sensors, which contributed to the overall efficacy of the alarm system. Now
burglar alarm systems are in the majority of homes across America. With the advent of
more intricate and well-developed technologies, burglar alarms have now become
equipped with a device that allows the owner to arm or disarm the security system from
his or her cellular device or laptop. As time progresses, so too does the vastness of the
range of capabilities of the alarm system. In today’s world, individuals are able to
monitor the safety of their children, homes, and priceless belongings with the use of
video surveillance. The burglar alarm system has now become less expensive and
3
Final Report
Team 1A
more advanced than ever before giving households everywhere the sense of safety and
Many burglar alarms on the market today are either overpriced or are not dependable.
While the more expensive alarm systems are dependable with sound engineering, they
are simply too expensive for most people. On the other hand, less expensive alarm
systems are simply not dependable enough. The cost of competitive alarm systems the
team analyzed varied from $99.95 – $619.99. This project has tackled both of these
with the goal of designing a less expensive, fully dependable alarm system.
Advanced Technology Solutions has a tech savvy, high priced alarm system for
$619.99. Their product consists of 2 x 1/3 inch SONY Super HAD CCD Cameras and 1
x 4-Channel Digital Video Recorder (DVR). The wide angle cameras have built in
infrared sensors that serve 2 purposes: video surveillance and motion detecting.
Coupled with the DVR, this system is state of the art with an almost fool-proof
dependability scenario. Although the Advanced Technology Solutions system has one
Wireless Home has a less expensive solution priced at $99.95. While the price is right
for the average consumer, this system lacks dependability as it contains only 1 infrared
sensor and 2 magnetic window sensors. This obvious lack of security is unacceptable
for most consumers, considering most home have 10 sets of windows and two doors.
4
Final Report
Team 1A
The fact that one has to buy warning signs and decals separately might lead the
consumer to the conclusion that the company has trimmed all costs to provide a “great
deal”. But with minimal experience in commercial sensor pricing, this product is also
The purpose of this project is to deliver a reasonably priced, dependable alarm system.
After analyzing the competition, the projects 14 sensor array will provide beefed-up
security than even the more expensive systems. More sensors simply equal more
security. Finding dependable sensors will be a tough task for the project, but once
reasonably priced sensors have been found, accomplishing the low-cost goal will be
within reach.
3. Experimental Method
A program was written that simulated a basic house burglary alarm system. This alarm
system was able to detect when there was an intrusion through any door, window, or
garage door. Also there was an LCD screen which displayed the alarm status along
with a 16-bit hexadecimal keypad that helped navigate through the LCD screen.
The house consisted of sensors on all windows and doors. There had to be at least six
window sensors, two garage door sensors, and two regular door sensors. In addition to
the sensors it was required that there be four either infrared motion detectors. The
5
Final Report
Team 1A
motion detectors detected motion throughout the house. The program that was written
was a link to all switches and infrared detectors to the AVR ATMEGA 128.
After the sensors and infrared detectors were set up, a user interface was created to
display on the LCD screen. The 16-bit hexadecimal keypad was used to navigate
through the LCD screen. The user interface had four different modes the user could
choose from. There were the Setup, Arm, Disarm, and Status modes to select from.
S Y S T E M S T A T U S
1 0 / 2 0 / 0 9 1 0 : 3 0 A M
A L A R M M O D E : A R M E D
S T A T U S : S E C U R E
The Setup mode was used initially to set up the time, date and a five-digit disarm code.
After the setup was complete the alarm system started monitoring the sensors and
infrared detectors. The system then went into status mode. The status mode gave the
current situation at each sensor and infrared detector. To arm the alarm system the
user selected alarm mode and this mode set the system in arm mode. All sensors and
detectors were secure before the system was armed. Once the system was armed
there was a 45-second wait period to allow the family to leave the house without tripping
the alarm. If the alarm had been tripped after the initial 45-seconds then an alarm
would go off to signify that an intruder was in the building. The alarm system would
then go into the disarm mode. In disarm mode it allowed the individual 45 seconds to
6
Final Report
Team 1A
disarm the alarm with the five digit disarm code after it has been tripped. When the
alarm system was not armed there was the main screen where the user could select
between all four modes by push button. The push buttons had to be hardware
debounced in order for them to work properly. This was done by using capacitors and
resistors between the switch and AVR connection. All equipment required is shown on
Requirements Usage
The program code was written piece by piece. The first important piece of the
code was to initialize the ports being used. Port A was initialized to be the
sensors for the windows and doors. Port D was initialized to communicate with
the Keypad. Port E was initialized to communicate with the LCD screen. Finally
// Port A initialization
PORTA=0x00;//port for window and door sensors
DDRA=0xFF;//0-3 for windows and 4-7 for door sensors
// Port D initialization
PORTD=0x0F; //Port for the keypad
DDRD=0xF0; //Upper 4-bits are output and lower 4-bits are
inputs
// Port E initialization
The second piece of code that was a major portion was telling the LCD screen
what to display. The LCD screen is how the user communicates with the burglar
alarm system. So what is shown on the display screen is important so the user
can navigate through the screens without any problems. An example of this
The last portion of the code was setting up the sensors to communicate when a door or
window was being opened/close. This part of the code tells the ATmega 128 to
communicate with the sensors see if the doors or windows are opened or closed. If
they are closed then the system does not do anything, but if the sensors detect a open
door or window it will then notify the ATmega 128 that there has been a breech in the
house.
if(PINA.7==1)sensor_screen3[10]='-';else sensor_screen3[10]='A';
if(PINA.6==1)sensor_screen3[9]='-';else sensor_screen3[9]='A';
if(PINA.5==1)sensor_screen3[8]='-';else sensor_screen3[8]='A';
if(PINA.4==1)sensor_screen3[7]='-';else
sensor_screen3[7]='A';
if(PINA.3==1)sensor_screen3[5]='-';else
sensor_screen3[5]='A';
if(PINA.2==1)sensor_screen3[4]='-';else
sensor_screen3[4]='A';
if(PINA.1==1)sensor_screen3[3]='-';else
sensor_screen3[3]='A';
if(PINA.0==1)sensor_screen3[2]='-';else
sensor_screen3[2]='A';
if(PINF.7==1)sensor_screen3[18]='-';else
sensor_screen3[18]='A';
if(PINF.6==1)sensor_screen3[17]='-';else
sensor_screen3[17]='A';
if(PINF.5==1)sensor_screen3[16]='-';else
sensor_screen3[16]='A';
if(PINF.4==1)sensor_screen3[15]='-';else
sensor_screen3[15]='A';
if(PINF.3==1)sensor_screen3[12]='-';else
sensor_screen3[12]='A';
9
Final Report
Team 1A
if(PINF.2==1)sensor_screen3[11]='-';else
sensor_screen3[11]='A';
Fig 4. Setting Up Sensors
The rest of the code set up the time and date, and also linked the major parts of
The switches on the ATmega128 were simulations of the sensor for the burglar
alarm system. When the sensor was set to high then the door/window was
5. Experimental Results
While writing the program, there were several issues that had to be dealt with
before we got the code working. The first problem was trying to find which port to
use for the LCD screen. The LCD screen has its own slot on the ATmega 123
but it does not show what port it was. After a great deal of research it was found
Once the right port was initialized for the LCD screen there was also trouble
trying to get the screen display what was desired for it to display. The screen
would just show blocks across the entire screen. It took a lot of trial and error to
solution on how to fix the problems encountered with setting up the time and date
There was a problem getting infrared motion detectors so there was no way to
check the code written to see if it worked. Also switches were used in the place
of the sensors for the doors and windows. If the switch read high then the
door/window was closed, and if the switch read low then the door/window was
open.
6. Conclusion
The objective of this project was to create a model burglar alarm system that
would detect motion and the opening of all doors and windows when the system
is armed. The system should have a LCD screen that allowed you to setup, arm,
disarm, and check the status of the alarm system. A keypad was also needed to
navigate through the LCD screen. There had to be a total of six window sensors,
four door sensors (two regular doors and two garage doors), and four motion
detectors.
11
Final Report
Team 1A
The greatest challenge faced in this project was writing and debugging the code
to get it to operate correctly. There were several problems in the code that had
to be fixed before it would work correctly. A few of the main problems corrected
were assigning the right port to the LCD screen (Port E), getting the LCD screen
to display correctly, and getting the time and date to set up correctly.
Overall the parts of the objectives that were completed worked correctly as the
7. References
“Atomic Mall product Info- Wireless Home -Business Security Burglar Alarm System.”
Web.< http://www.atomicmall.com/view.php?id=540587>
“Dino Direct- Advanced Technology Solutions 4 Channel DVR & 2 Color Cameras
dvr-sky-8204st-cam-817l/AFFID-183.html>
12
Final Report
Team 1A
“Amtel Products- AVR ATMEGA 128.” Web. <
http://www.atmel.com/dyn/products/product_card.asp?part_id=2018>
http://www.ehow.com/facts_5038281_history-burglar-alarm.html
http://www.guide4home.com/care-alarm/house.htm
http://www.top5inrealestate.com/items/view/null/8973/
13
Final Report
Team 1A
8. Appendix
//Declared variables
void intsetup ();
void InputData1 ();
char button (char keycode);
void SensorScreen ();
void MainMenu();
void MainMenu2();
void zone_set_up();
unsigned long GetCurrentDate();
unsigned long GetCurrentTime();
void clock ();
18
Final Report
Team 1A
}
void LCD_init() //Initializes the LCD
{
LCD_reset();
lcd_cmd (0x28); //4-bit, 2 line, 5x7 dots
lcd_cmd (0x0C); //Display on Cursor off
lcd_cmd (0x06); //Entry Mode
lcd_cmd (0x01); //Clears the Screen
lcd_cmd (0x80); // Set Cursor at line 1
}
//Set the LCD display position x=0...39, y=0...3
void lcd_gotoxy (unsigned char x, unsigned char y)
{
lcd_cmd (base_y [y] + x);
lcd_x = x;
lcd_y = y;
}
/*void lcd_senddata (unsigned char data) //Write one character to LCD
{
//send high bits
LCD_PORT = LCD_EN|LCD_RS; // Allow data to be
sent to LCD
LCD_PORT = ((data & 0xF0) |LCD_EN|LCD_RS); //Write the data to
the LCD
LCD_PORT = ((data & 0xF0) |LCD_RS); // Put on commands
ports makes EN low
//send low bits
LCD_PORT = LCD_EN|LCD_RS; // makes EN high
LCD_PORT = (((data << 4 ) & 0xF0) |LCD_EN|LCD_RS);
LCD_PORT = (((data << 4) & 0xF0) |LCD_RS); //Puts data on the LCD
delay_ms (5); //Give LCD time to
process
}
*/
void lcd_displaystring (unsigned char *var) //Display a string on the
LCD
{
unsigned char current_char;
while (*var != 0)
{
current_char = *var++;
20
Final Report
Team 1A
//send high bits
LCD_PORT = LCD_EN|LCD_RS; // makes EN high and RS
high to write to LCD
LCD_PORT = ((current_char & 0xF0) |LCD_EN|LCD_RS);
LCD_PORT = ((current_char & 0xF0) |LCD_RS); // Put on commands
ports makes EN low
//send low bits
LCD_PORT = LCD_EN|LCD_RS; // makes EN high
LCD_PORT = (((current_char << 4 ) & 0xF0) |LCD_EN|LCD_RS);
LCD_PORT = (((current_char << 4) & 0xF0) |LCD_RS); //Puts string
on the LCD
delay_ms (5); //Give LCD time to process
}
}
armed or disarmed
unsigned char c = 0;
unsigned char temperature_data;
int clock_hours;
int time_counter;
22
Final Report
Team 1A
int clock_seconds;
int clock_minutes;
int date_DD;
int date_MM;
int date_YY;
unsigned char ZZ = 0;
int arm;
int code_a;
int code_b;
int code_c;
int code_d;
int code_e;
int decide;
int status;
void main(void)
{
// Port A initialization
PORTA=0x00;//port for window and door sensors
DDRA=0xFF;//0-3 for windows and 4-7 for door sensors
// Port D initialization
PORTD=0x0F; //Port for the keypad
DDRD=0xF0; //Upper 4-bits are output and lower 4-bits are inputs
// Port E initialization
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 250.000 kHz
// Mode: Normal top=FFh
// OC0 output: Disconnected
ASSR=0x00;
TCCR0=0x04;
TCNT0=0x06;
OCR0=0x00;
// ADC initialization
// ADC Clock frequency: 1000.000 kHz
// ADC Voltage Reference: Int., cap. on AREF
// Only the 8 most significant bits of
// the AD conversion result are used
while (1)
{
keyData1 = PIND & 0x0F;
if ((keyData1 != 0xF) & ZZ==0)
{
delay_ms (5);
keyData2 = PIND & 0x0F;
if (keyData1 == keyData2)
{
key_select = button(keyData2); //Takes data from keypad
and put in a variable
ZZ=1;
}
}
InputData1();
date_MM = key_select*10;
InputData1();
date_MM += key_select;
InputData1();
date_DD = key_select*10;
InputData1();
date_DD += key_select;
InputData1();
date_YY = key_select*10;
InputData1();
date_YY += key_select;
lcd_gotoxy (0,1);
lcd_displaystring (enter_code);
digit_code();
InputData1();
code_a = key_select;
if (code_a == 1);
{
continue;
27
Final Report
Team 1A
}
InputData1();
code_b = key_select;
if (code_b == 2);
{
continue;
}
InputData1();
code_c = key_select;
if (code_c == 3);
{
continue;
}
InputData1();
code_d = key_select;
if (code_d == 4);
{
continue;
}
InputData1();
code_e = key_select;
if (code_e == 5);
{
continue;
}
lcd_gotoxy (0,2);
}
28
Final Report
Team 1A
unsigned GetCurrentDate()
{
current_date = (unsigned)date_MM + (unsigned)date_DD +
(unsigned)date_YY;
29
Final Report
Team 1A
return current_date;
}
if(PINA.7==1)sensor_screen3[10]='-';else sensor_screen3[10]='A';
if(PINA.6==1)sensor_screen3[9]='-';else sensor_screen3[9]='A';
if(PINA.5==1)sensor_screen3[8]='-';else sensor_screen3[8]='A';
if(PINA.4==1)sensor_screen3[7]='-';else sensor_screen3[7]='A';
if(PINA.3==1)sensor_screen3[5]='-';else sensor_screen3[5]='A';
if(PINA.2==1)sensor_screen3[4]='-';else sensor_screen3[4]='A';
if(PINA.1==1)sensor_screen3[3]='-';else
sensor_screen3[3]='A';
if(PINA.0==1)sensor_screen3[2]='-';else
sensor_screen3[2]='A';
if(PINF.7==1)sensor_screen3[18]='-';else sensor_screen3[18]='A';
if(PINF.6==1)sensor_screen3[17]='-';else sensor_screen3[17]='A';
if(PINF.5==1)sensor_screen3[16]='-';else sensor_screen3[16]='A';
if(PINF.4==1)sensor_screen3[15]='-';else
sensor_screen3[15]='A';
if(PINF.3==1)sensor_screen3[12]='-';else
sensor_screen3[12]='A';
if(PINF.2==1)sensor_screen3[11]='-';else
sensor_screen3[11]='A';
system_screen2[13] ='A';
system_screen2[14] ='R';
system_screen2[15] ='M';
system_screen2[16] ='E';
system_screen2[17] ='D';
system_screen3[10]='S';
system_screen3[11]='E';
system_screen3[12]='C';
31
Final Report
Team 1A
system_screen3[13]='U';
system_screen3[14]='R';
system_screen3[15]='E';
return;
}
system_screen2[13] ='D';
system_screen2[14] ='I';
system_screen2[15] ='S';
system_screen2[16] ='A';
system_screen2[17] ='R';
system_screen2[18] ='M';
system_screen2[19] ='E';
system_screen2[20] ='D';
system_screen3[10]='I';
system_screen3[11]='N';
system_screen3[12]='S';
system_screen3[13]='E';
system_screen3[14]='C';
system_screen3[15]='U';
system_screen3[16]='R';
system_screen3[17]='E';
return;
}
}
32
Final Report
Team 1A