DEPARTMENT OF ECE
HOME SECURITY SYSTEM
PRESENTED BY
1.SYED OWAIS MOHIUDDIN (16M21A0477)
2.MUBINA BEGUM (17M25A0403)
3.MOHAMMED BILAL (16M21A0466)
4.MD.ADIL (15H11A0402)
UNDER THE GUIDANCE
SURENDER REDDY
CONTENTS
• Aim
• Abstract
• Block diagram
• Hardware Components
• Software Requirement
• Coding
• Flowchart
• Advantages
• Applications
• Bibliography
AIM
• The Main Aim of the Project is “To Design and Implement the home
security system using micro controller”.
ABSTRACT
• This system helps you to upgrade your safety standards, comply statutory
requirements on environmental commitments.
• The most important and basic function being prevent accidents and
protect life and property from disaster
BLOCK DIAGRAM
POWER SUPPLY
GAS/FIRE SESNSOR LCD
MICRO
INTERFACING
CONTROLLER
CIRCUIT
INTERFACING BUZZER
CIRCUIT
THEFT SENSOR
SCHEMATIC DIAGRAM
HARDWARE COMPONENTS
• Power Supply
• 8051 microcontroller
• Gas Sensor
• Fire Sensor
• IR Sensor
• 16*2 LCD Display
• Buzzer
POWER SUPPLY
Transformer
Rectifier
Filter
Voltage Regulator
Fig: Block diagram of power supply
TRANSFORMER
• Static device which works on the
principle of electro magnetic
induction.
• Transfer electrical power from one
circuit to another without any
variation in the frequency.
• We are using step down transformer.
• It convert high voltage low current to low voltage high current.
RECTIFIER:
• It is an electrical device composed
of one or more diodes that converts
the AC to DC.
• Uses diodes to rectify the inputs.
• Diode allows one way flow of current.
• The output is available for whole wave.
FILTERS:
• Filter remove unwanted frequency components from applied signal.
• It can be active or passive and analog or digital.
VOLTAGE REGULATOR
• It regulates the voltage, there are two types of regulators
a . Fixed Regulator
b . Variable Regulator
• We are using fixed regulators, There are two series
i. Series 7805
ii. Series 7905
• We are using series 7805 it provides
positive regulated voltage from
5v to 12v
MICRO CONTROLLER
We are using 8051 Micro Controller series of AT89C52
FEATURES OF AT89C52:
• Compatible with MCS-51 Products
• 8K Bytes of In-System Reprogrammable Flash Memory
• Fully Static Operation: 0 Hz to 24 MHz
• Three-level Program Memory Lock
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Programmable Serial Channel
• Low-power Idle and Power-down Modes
• 40-pin DIP
PIN DIAGRAM:
POWER SUPPLY PINS :
There are total 7 pins
– PC6 is Reset Pin
– IOREF
– 3.3V
– 5V
– GND
– GND
– Vin (I/P voltage)
PIN DIAGRAM
SENSORS
• A sensor is a device that detects and responds to some type of input from
the physical environment.
GAS SENSOR(MQ2):
• Gas sensor detects combustible gases and smoke.
WORKING PRINCIPLE
• MQ2 Gas sensor works on 5V DC
and draws around 800mW.
• It can detect LPG,Alcohol, Propane,
hydrogen,Methane concentration
any where from 200 to 10000ppm.
SPECIFICATION:
• Power Supply: 5 Volts
• Interface Type: Analog & Digital
• High Sensitivity to Smoke & combustible gasses like Hydrogen, LPG &
Propane.
• Low Cost.
• Stable & Long Life.
• On board Power indication.
Pin detail:
• pin 1: Vcc +5V
• pin 2: Ground
• pin 3: Digital out
• pin 4: Analog out
FIRE SENSOR:
• Detects fire and outputs digital and analog signal. The digital signal can
have a trigger level. LEDs indicate power and output signal.
Pin details
• VCC = 3.3V to 5V DC
• GND = Ground
• DO = Digital Output
• AO = Analog Output
SPECIFICATIONS:
• Operating Voltage: 3.3V to 5V DC
• Operating Current: 15ma
• Output Digital - 0V to 5V, Adjustable trigger level from preset
• Output Analog - 0V to 5V based on infrared radiation from fire
flame falling on the sensor
• LEDs indicating output and power
• PCB Size: 3.2cm x 1.4cm
• LM393 based design
IR SENSOR
• An infrared sensor is an electronic
device, that emits in order to sense
some aspects of the surroundings.
• An IR sensor can measure the heat
of a object as well as detects the
motion.
• These types of sensors measures only infrared radiation, rather than
emitting it that is called as a passive IR sensor.
INTERFACES:
• VCC external 3.3V-5V voltage
• GND external GND.
• OUT board digital output interface (0 and 1).
FEATURES:
• Digital output
• Typical response time: 39ms
• Range: 10 to 80cm
• Typical startup delay: 44ms
• Average current consumption: 30mA
BUZZER
• A buzzer or beeper is a signalling device,
usually electronic, typically used in
automobiles, household appliances
such as a microwave oven, or
game shows etc.
16*2 LCD DISPLAY
• An LCD is an electronic display Module which uses liquid crystal to
produce visible image
• Each Character is displayed in a 5*7 pixel matrix & I2c
• 2 lines by 16 character
PIN DESCRIPTION:
Pin 1- Ground
Pin 2 - Supply voltage
Pin 3 – Contrast adjustment
Pin 4 - Register select
Pin 5 - Read and write
Pin 6 – Enable
Pin 7- Pin 14 – 8 Data pins (DB0-DB7)
Pin 15 – Back light vcc (led +)
Pin 16 – Back light ground (led-)
REGISTER SELECT(RS) :
• It has two registers
i. When RS = 0 (command)
ii. When RS = 1 (data)
LCD COMMANDS:
SOFTWARE REQUIREMENT
KEIL UVISION:
• µVision is a window-based software development platform that
combines a robust and modern editor with a project manager and make
facility tool.
• It integrates all the tools needed to develop embedded applications.
• Including a C/C++ compiler, macro assembler, linker/locator, and a HEX
file generator.
PROTEUS VERSION 8:
• Proteus ISIS is the best simulation software in the world for various
designs with electronics & microcontroller.
• It is mainly popular because of availability of almost all microcontrollers
in it.
• So it is a handy tool to test programs and embedded designs for
electronics hobbyist & expert.
COMPONENTS INTERFACING WITH
MICROCONTROLLER
Micro controller Component
port number Name Sensor pins Description
P 1.0 Fire sensor 3 pins Controller will
convert Analog to
Digital
P 1.1 Thief sensor 3 pins Controller will
convert Analog to
Digital
P 1.2 Gas sensor 3 pins Controller will
convert Analog to
Digital
P 1.3 Buzzer 1 Transducer that
produces sound for
alert
Port 2.0-2.7 LCD 8 pins It is used to display
the result
CODING
#include<reg51.h>
//Function declarations
void cct_init(void);
void delay(int);
void lcdinit(void);
void writecmd(int);
void writedata(char);
void ReturnHome(void);
void LCD_String (char *str);
// Defines Pins
sbit RS = P2^0;
sbit E = P2^1;
sbit fire =P1^0;
sbit ir =P1^1;
sbit gas =P1^2;
sbit buzz =P1^3;
// ***********************************************************
// Main program
//
void main(void)
{
cct_init(); //Make all ports zero
lcdinit();
ir=1;
fire=1;
buzz=1;
gas=1;
writecmd(0x80);LCD_String("HOME SECURITY");
writecmd(0xC0);LCD_String(" SYSTEM ");
delay(200);
writecmd(0x01);
while(1)
{
writecmd(0x80);LCD_String("Sensor Detection");
if(ir==0){writecmd(0x01);buzz=1;}
else{ writecmd(0x80);LCD_String("Sensor Detection");
writecmd(0xc0);LCD_String("Theft detected");buzz=0;}
if(fire==0){writecmd(0x80);LCD_String("Sensor Detection");
writecmd(0xc0);LCD_String("Fire detected");buzz=0;}
else{writecmd(0x01);buzz=1;}
if(gas==0){writecmd(0x80);LCD_String("Sensor Detection");
writecmd(0xc0);LCD_String("Gas detected");buzz=0;}
else{writecmd(0x01);buzz=1;}
}
}
void cct_init(void)
{
P0 = 0x00; //not used
P1 = 0x00; //not used
P2 = 0x00; //used as data port
P3 = 0x00; //used for generating E and RS
}
void delay(int t)
{
unsigned int i,j;
for(i=0;i<1275;i++)//1microsec
for(j=0;j<t;j++);
}
void writedata(char t)
{
RS = 1; // This is data
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= (t&0xF0); // Write Upper nibble of data
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= ((t<<4)&0xF0);// Write Lower nibble of data
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
}
void writecmd(int z)
{
RS = 0; // This is command
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= (z&0xF0); // Write Upper nibble of data
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= ((z<<4)&0xF0);// Write Lower nibble of data
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
void lcdinit(void)
{
///////////// Reset process from datasheet /////////
// delay(150);
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= (0x30&0xF0); // Write 0x3
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= (0x30&0xF0); // Write 0x3
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= (0x30&0xF0); // Write 0x3
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
P2 &= 0x0F; // Make P2.4 to P2.7 zero
P2 |= (0x20&0xF0); // Write 0x2
E = 1; // => E = 1
delay(1);
E = 0; // => E = 0
/////////////////////////////////////////////////////
writecmd(0x28); //function set
writecmd(0x0c); //display on,cursor off,blink off
writecmd(0x01); //clear display
writecmd(0x06); //entry mode, set increment
}
void ReturnHome(void) //Return to 0 location
{
writecmd(0x02);
delay(1500);
}
void LCD_String (char *str)
/* Send string to LCD function */
{
int i;
for(i=0;str[i]!=0;i++)
/* Send each char of string till the NULL */
{
writedata(str[i]);
/* Call LCD data write */
}
}
FLOWCHART
ADVANTAGES
• It is cost effective.
• Simple and reliable.
• Time complexity is less compared to other projects.
• The speed of execution increases as the hardware complexity decreases.
APPLICATIONS
• Used in lockers.
• Used home security.
• Used in top secret labrotories
• Miltary bases
BIBLIOGRAPHY
• 8051 Microcontroller By Mazdi
• Architecture, Programming, Interfacing and System Design By Raj Kamal
3rd Edition
• The 8051 Microcontroller and Embedded Systems By Kenneth J. Ayala &
Dhananjay V. Gadre
• Electrical Engineering By Allan R. Hambley 5th Edition Published by Tata
McGraw Hill
• www.Microchip.com
• http://www.engineersgarage.com/8051-microcontroller
• http://www.national.com/mpf/html#Overview
• http://www.circuittoday.com
THANK YOU