Home Security System Using Atmel Mega32


This is a digital home security system with voice feature which can monitor room temperature, smoke, motion, and windows & doors.
The goal of this project is to utilize the after-market parts and build an integrated home security system. Besides traditional magnetic switch equipped on doors and windows, we have also incorporated temperature sensor, smoke detectors, and motion sensor. Hence the security system will sound an alert when there is an attempt of break-in or if there is possible smoke or fire.

Home Security System
The system is fully digital and also be fully customized. It incorporated a 16×2 LCD display with a 4×4 keypad. Each sensor can be enabled or disabled, and alarm frequency and skim can also be chosen by users. We have also equipped a voice playback chip, and it will speak which sensor has gone wrong.
High Level Design

Project Idea

The idea of our project comes from lab 3 when we did a simple security system. However, that security system is quite basic and only offers simple password lock. Hence we would like to enhance our security system with different kinds of sensors. We have also browse some of the old final project and found the “Phone Dialer” project from spring 2002. Originally, we were going to put Zarlink MT8880C DTMF transceiver chip, so it will dial a desire number that user specify. When the phone connected, we will use Winbond ISD1420 voice record and playback chip to play pre-recorded voice signal. However, due to the lack of the phone jack in the lab, plus the majority of the Cornell campus has digital phone line instead of analog phone line, we decided to put away this idea. Since ISD1420 chip has address bit feature, we decided to make our system playback certain pattern of voice when the system goes into alert status.

Logical Structure

The logical structure of our design is shown in the block diagram on the right. The central system will handle all the sensors and keypad input, output information to LCD screen, indicate system status on LED, and make buzz or voice alarm.

Hardware & Software Tradeoffs

The IR motion sensor is quite inexpensive ($5.99 dollars for the one we got), so we also decided to buy it instead of building one on our own. We also acquire one of the smoke detector from home. This is the very basic version and will sound the alarm when the smoke is detected.

Besides some necessary capacitor and resistor connections to the ISD1420 chip, the majority of our project is based on our software. This is mainly because our system if fully customizable and has quite a lot of features. It need to monitors all the sensor, and time the appropriate seconds in order to play certain voice pattern (ex. “Temperature, smoke error, please…” “Door or window error, please…”) depending on which sensor goes wrong. It also need to handle the user interface via keypad and LCD screen. All of these are programmed in our software.


The 16×2 LCD we use has standard 16 pin connection (pin 15 and 16 for LED backlit power). The keypad is also standard 4×4 which has 8 pin connector. The smoke detector is powered by standard E-block 9V battery. The motion sensor is powered by 2 AAA 1.5V battery in serial.

Existing Patents, Copyrights and Trademarks

The magnetic contact switch is manufactured by SECO-LARM? The motion detector is manufactured by SPY GEAR. The smoke sensor is a little bit hard to identify because we do not have the original box, but we believe it manufactured by FAMILY GARD?

Program & Hardware Design

Program Detail

The hardest part of the program is timing. When any sensor goes wrong, the program will wait for certain seconds (set by user), and then make ISD1420 chip play back the desired voice pattern we want. Originally, we though we can just output the appropriate address bit and then make the chip play, however, later on we discovered there is a THOLD in the ISD1420 chip that we need to take care of, otherwise it will reference to the previous address bits. The voice playback chip does not have a very fast internal clock, so we have to manually use the delay function in our program after we set the address bits, and then make the chip play. Although using the delay function is somehow undesirable, however, we have implemented our program such that this delay will not cause any error in our software.

Besides, we also need to implement the keypad function so it acts accordingly when the LCD is displaying certain menu. This is not very difficult but we have to take care of all the possible circumstances. We have 12 submenus in our system. Set temp define the lowest temperature allowed before sounding the alarm (70~120F, with step size of 1F). The Sec. Allow is the time in second before the voice alarm goes off (0~30sec, with step size of 2 seconds).

1.Enable System
2.(*)Temp Sensor
3.(*)Mot. Sensor
4.(*)Smk. Sensor
5.(*)Mag. Switch
6.Set Temp: 100F
7.(*)Voice Alarm
8.(*)Buzz Alarm
9.New Pswd:
A.Buzz Freq: 7
B.Buzz Skim: 3
C.Sec. Allow: 10

We also have simple de-bounce feature for our keypad, and it will sound a buzz when you press any key (if you HOLD a key but buzz will only sound once). Although the de-bounce function is as easy as few lines, it takes a while to think about the logic and how to actually implement it. Also we implement the backspace feature so that when use enter a wrong password, this key can be used to delete the previous entered number. Also just a quick note, our password is masked on LCD for a safer purpose.

Hardware Detail

The first sensor we have is the temperature sensor. Since we implemented a digital thermometer in lab 5, we decided to use the same circuit. So we incorporated National Semiconductor LM34 temperature sensor, with National Semiconductor LMC7111 OpAmp chip to amplifier our output voltage going into ADC. The final connection of our circuit look like the following.
The second sensor we have is the motion sensor. Although we do not have the diagram of the circuit (it has some IC components), we discovered there are few NPN transistors in the circuit. NPN transistors are like switches, so it is obvious these are used enable the original buzzer on the circuit. Hence we took the base pin together with ground to connect to our ADC pin input. If the voltage exceed VTH (threshold voltage), we know the alarm goes off.
The third sensor we have is the smoke detector. The smoke detectors mostly equipped with piezoelectric buzzer, which has F (feed back), C (main electrode), M (metal plate) three pins. Piezoelectric buzzer has an internal crystal and will sound if small current is applied (voltage drop). Hence we took out the piezoelectric buzzer and connect the F pin into our ADC input. When the sensor goes off, the voltage will go high.
Home Security System diagram
The final sensor we have is the magnetic switches. It is normally closed. So when the switch is right next to each other, the resistance is zero. When the switch is separated, the resistance will become infinity as if it’s disconnected. So we drive the switch with an 10K pull-up resistor, and connect the output to the ADC. Since we have two magnetic switches, we decided to build a simple AND/OR gate by using 1 74LS00 chip. There are four NAND gates in 74LS00, and if we connect two of NAND gate in parallel with their input signal to another NAND gate, we will get as if there are 2 AND gate in parallel with their signals to an OR gate. The diagram can be found in our appendix.

Parts List:

Parts Name Price Vendor
Atmel Mega32 8.00 Lab
16×2 LCD 5.00 Lab
4×4 Keypad 5.00 Lab
White breed board 5.00 x 2 Lab
Winbond ISD1420P Voice Record/Playback IC 5.20 www.futurlec.com (ISD1420P)
Magnetic Contact Switch (Closed Circuit) 2.99 x 2 www.smarthome.com (7113)
Spy Motion Alarm 5.99 www.smarthome.com (9511)

For more detail: Home Security System

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top