You are on page 1of 52

UNIVERSITY OF GONDAR

INSTITUTE OF TECHNOLOGY
DEPARTEMENT OF ELECTRICALAND COMPUTER ENGINEERING
INDUSTRIAL CONTROL ENGINEERING STREAM

PROJECT REPORT ON:


DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE
DOOR LOCK SYSTEM

PREPARED BY:
1. Fatuma Seid (0349/06)
2. Haymanot Melese(0436/06)
3. Miftah Mohammed (0584/06)
4. Misgana Desta (0592/06)

Advisor: Mr. Agmuasie B.

June 2009

Gondar, Ethiopia
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C

Approval page

We hereby declare that this project is our original work done under the guidance of Mr.
Agumasse B. and this project work has not been submitted before.

Name of the Student Signature

Fatuma Seid ________

Haymanot Melese ________

Miftah Mohammed ________

Misgana Desta ________

Advisor

Agumasse B. ________

Electrical and computer engineering


Page
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C

Acknowledgement

We extend our sincere thanks to our advisor Agmuasie B. b.sc in industrial control
engineering with the guidance and facilities for the semester project. We express our sincere
gratitude to the semester project coordinator staff in charge, for their cooperationand guidance
for preparing and presenting this project.We also extend our sincere thanks to all other
friends for their support and encouragement especially for Abdugefar Nurhassen.

Electrical and computer engineering


Page
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C

Abstract

Microcontroller based pass code door lock system is a system that use microcontroller
interfaced with GSM module, keypad ,buzzer, and stepper motor.Unauthorized access to
things might cause harm to the individual person and also can make the company a target to
theft and burglary. For these systems to be secured it will normally take high budget, many
human resources and consume time to implement it.

In our system some embedded program in computer is used.our system able to use GSM
module to send sms message to the owner Since mobile phones have become the most
prevailing communication gadget.

The system has a keypad by which the password can be entered through it . When the entered
password is the same with the password stored in the memory then the relay gets on so that
the door is opened. If we entered a wrong password more than three times then the alarm will
turned on and send SMS to police or the owner. If the password exactly matches with the
stored password in the LED turns on and valid is displayed on the LCD. At this time the door
is open.

The system can provide effective, accurate and real time based security while the owners are
away from their home.

Contents
Electrical and computer engineering
Page
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C

Chapter one...........................................................................................................................................1

Introduction...........................................................................................................................................1

1.1.Background of the study..............................................................................................................1

1.2. PROBLEM STATEMENT.................................................................................................................2

1.3 Significance of the project............................................................................................................3

1.4. Objective of the project..............................................................................................................3

1.4.1 General objective..................................................................................................................3

1.5. Goal of the project......................................................................................................................3

1.6. Methodology...............................................................................................................................3

1.7. Scope of the project....................................................................................................................4

1.8. Outline of the paper....................................................................................................................4

Chapter 2...............................................................................................................................................5

Literature review....................................................................................................................................5

2.1. Introduction................................................................................................................................5

2.2 related works...............................................................................................................................6

2.2.1. Bluetooth-based Home Automation System........................................................................6

2.2.2. GPRS-based Home Automation System...............................................................................6

2.2.3. DTMF-based Home Automation System..............................................................................7

2.3. Drawback of the existing project.................................................................................................7

Conceptual framework of the study......................................................................................................8

3.1. What is the PIC microcontroller?................................................................................................8

3.1.2 .Description of the PIC microcontroller;..............................................................................10

2.1.3Pin configuration of pic1f877a.............................................................................................10

2.1.4 Pin Description of PICF16F877A..........................................................................................10

3.2 Keypad.......................................................................................................................................14

3.2.1. Interfacing Matrix Keypad with PIC Microcontroller..........................................................14

3.3. LED (light emitting diode)..........................................................................................................15

Electrical and computer engineering


Page
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C

3.4 LCD (liquid crystal display);........................................................................................................15

3.4.1 .Description of LCD..............................................................................................................15

3.4.2. LCD Commands and Instruction set...................................................................................16

3.4.3. Sending data to the LCD:....................................................................................................19

3.5 Stepper motor............................................................................................................................19

3.6. GSM Modem.............................................................................................................................20

3.7.Capacitor....................................................................................................................................22

3.8. REGULATOR IC (78XX)...............................................................................................................22

3.9. Resistor.....................................................................................................................................22

CHAPTER FOUR....................................................................................................................................23

SYSTEM DESIGN...................................................................................................................................23

4.1 Introduction...................................................................................................................................23

4.2 Power Supply Design..................................................................................................................25

4.2.1. Transformer.......................................................................................................................25

Chapter 5.............................................................................................................................................32

Test result and discussion....................................................................................................................32

5.1 Result.........................................................................................................................................32

Chapter 6.............................................................................................................................................37

Conclusion and recommendation........................................................................................................37

6.1 Conclusion..................................................................................................................................37

6.2 Recommendation.......................................................................................................................38

Reference.............................................................................................................................................39

Appendices..........................................................................................................................................39

List of figure

Electrical and computer engineering


Page
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C

figure 1. 1Methodology block diagram..................................................................................................4


Y

figure 3. 1; microcontroller..................................................................................................................10
figure 3. 2; PIC16f877a.......................................................................................................................10
figure 3. 3keypad..................................................................................................................................14
figure 3. 44 led symbol and schematic diagram...................................................................................15
figure 3. 55 LCD....................................................................................................................................16
figure 3. 66 stepper motor....................................................................................................................19
figure 3. 7 GSM mode (SIM 900)..........................................................................................................21
figure 3. 8 capacitor.............................................................................................................................22
figure 3. 9 resistor................................................................................................................................22
figure 4. 1 block diagram.....................................................................................................................23
figure 4. 2schematic diagram of microcontroller interfaced with LCD and keypad.............................24
figure 4. 3schematic diagram of microcontroller interfaced with GSM module...................................25
figure 4. 4 digram of microcontroller interfaced with stepper motor....................................................25
figure 4. 5;complete system design for door........................................................................................26
figure 4. 6; simulation result................................................................................................................27
figure 4. 7supply design.......................................................................................................................27
figure 4. 8schematic diagram of power supply.....................................................................................30
figure 4. 9 flow chart chart...................................................................................................................31

figure 5. 1schematic diagram when the password is right....................................................................32


figure 5. 2schematic diagram when the password is wrong.................................................................33

List of Abbreviations

AT………………………………………Atmel

CMOS………………………………….Complementary metallic oxide semiconductor

DRAM………………………………….Dynamic Random Access Memory


Electrical and computer engineering
Page
DESIGN AND SIMULATION OF MICROCONTOLLER BASED PASSCODE DOOR LOCK SYSTEM 2009E.C

I/O………………………………………Input and output

IC……………………………………….Integrated circuit

TTL…………………………………….Transistor transistor Logic

MCS……………………………………Microcontroller system

MCU……………………………………Microcontroller unit

3D………………………………………Three dimensional

USB……………………………………Universal serial bus

LCD……………………………………Liquid crystal display

List of table

Electrical and computer engineering


Page
Chapter one

Introduction

1.1.Background of the study


Over recent years, security systems have changed from simple control panels and locks into
high-tech gadgets. But, today security systems aren’t just the result of the technological
developments that have rocketed over the past few years.

When World War I came to an end in1918, an increase in crime followed. As a result, the
Americans become eagled to find ways of protecting themselves and their property. In
addition to this, many insurance companies began to offer premium discounts to alarm
subscribers. These events in turn produced a consumer demand for alarm system. An early
model of an advanced video home security system consisted of a large camera that could
view the exterior of the home through tiny holes mounted in the front door.

Burglar safety alarms are found in electronic form nowadays. Sensors are connected to a
control unit via either a low-voltage hardwire which in turn connects to a means for
announcing the alarm to elicit response. In a new construction systems are predominately
hardwired for economy while in retrofits wireless systems may be more economical and
certainly quicker to install. Some systems are dedicated to one mission; handle fire,
intrusion, and safety alarms simultaneously.

In common security system, the lights are triggered by motion gives the impression to user
that someone is at home and able to see the burglar. Infrared motion detectors placed in
house security system in crucial areas of the house can detect any burglars and alert the home
owner or police. The first security system invented, house alarms were triggered by the
release of a pressure button fitted into a door or window frame.

This basic alarm was fundamentally flawed as the entire intruder needed to do to silence. The
alarm was to close the door or window. While various systems on the mark ranging from
inexpensive house security alarms to highly sophisticated systems requiring
professional installation. All modern alarms are based on the same foundation, the electric

Electrical and computer engineering


Page
circuit which is completed either when the door is opened or closed depending on the security
system designed.

The alarm is triggered when the circuit is altered and will not be silenced until a code is
punched into the control panel.

The most expensive and complicated alarm systems might also involve a combination of
motion sensors and pressure pads to ensure even the most cunning intruder doesn’t get
his hands on treasures.

Home security is one of the major issues that need to be prioritized by individuals. We are
living in a computerized world where crime and unanticipated accidents occur beyond our
knowledge and awareness.Considering the increasing number of theft needs attention in
collaboration with the government or civil authorities.

Then our project intends to interface the microcontroller with the LED keypad and other
hardware components like memory, sounder start/stop the stepper motor through sending a
right or wrong password. The measure of efficiency is based on how fast the microcontroller
can detect the incoming message and act accordingly.

The controlling unit has an application program to allow the microcontroller read the
incoming data through the modem and control the engine motor as per the requirement. The
performanceof the design is maintained by the controlling unit.

1.2.PROBLEM STATEMENT
Security is a prime concern in our day-today life. Everyone wants to be as much secure as
possible. Knowing your home is protected provides peace of mind both when you are away
and when you are home. Security is important even if you have outstanding public safety
agencies in your area. There are far more homes than there are police officers, not to
mention of skilled thieves. And the other problem is lost of key, the password might be
hack ,the card will be lost, it might be open by similar key.So we would like to implement our
project to do everything possible to make your housesecure rather than just relying on others.

1.3 Significance of the project

1) This kind of systems control home security and other systems, in order to improve

Electrical and computer engineering


Page
Comfort,energy efficiency.
2) This kind of systems is particularly useful for the disabled or elderly, improving
the life quality and avoiding special aid expenses.

1.4. Objective of the project

1.4.1 General objective

Our general objectives are todesign and simulation of microcontroller based pass code door
lock system.

1.4.2 The specific objectives of the project are


 To develop the block diagram of the project
 To design C code that will be loaded to the microcontroller.
 To interface microcontroller with keypad, GSM module, buzzer
and stepper motor.
 To simulate the design results.

1.5. Goal of the project

Our goal is to minimize man power, to minimize the need for a key, to keep room security
based on microcontroller, to use only by the authorized person.

1.6. Methodology
For successful completion of this project some steps have been followed to carry out different
tasks. Different literatures were revised relating to this project and data has been collected
from nearby system. Based on the data collected and parameter availability, system model
have been designed. Finally using appropriate software, the programming hasbeen developed.

Generally the methodology is described by the following block diagram.

Electrical and computer engineering


Page
figure 1. Methodology block diagram

1.7. Scope of the project


The purpose of this project is to provide complete solution for monitoring and security the
door lock system.This application provides an authorized person with valuable information
through the GSM technology.The information is automatically sent through the GSM network
employed in the system.The proposed approach h for designing this system is to implement a
microcontroller based control module that sends its instructions and commands from a
GSM modem over the GSM network to authorized person only. The receiver must reside in
a location where a signal with sufficient strength can be received from a cellular phone
network.

1.8. Outline of the paper


This semester project report is composed of five chapters covering introduction,
literature review, conceptual framework of the study ,system design, test result and
discussion ,conclusion and recommendation and reference.
Chapter 1; explains introduction of the focus study of the project where the number
of home security has increased significantly an overview of the project.
Chapter 2: describes the literature review that we have used in this project.
Chapter 3: the material we used is stated here.
Chapter 4: explains the specific methodology for every project scope and objective are
elaborated by presenting and emphasizing the details of methods applied. Here, the

Electrical and computer engineering


Page
block diagrams and flowcharts related to each objective or scope are also elaborated and
revealed.
Chapter 5:gives every detail of the results based on the experiments and testing implemented
and presents the overall discussion on the results obtained and comparison can be done.
Chapter 6 : the overall conclusion of development of the project is also enclosed
together with suggestion and recommendation for future work or enhance

Electrical and computer engineering


Page
Chapter 2

Literature review

2.1. Introduction
Various home security system solutions are not available. Most of them are very expensive.
We have studied different individual components separately and integrated them together with
some more innovative features to make a home security system. Home security system are
expected to be the standard in the near future when all aspects of the home can be monitored
and controlled remotely by the home owner.

Different methods proposed by researchers around the globe related to the home security
system are outlined here:

2.2 related works

2.2.1.Bluetooth-based Home Automation System

The work of N. Sriskanthan et al. shows the implementation of a home automation system
using Bluetooth. They use a host controller implemented on a PC, which is connected to a
microcontroller-based sensor and device controllers. The researchers even built a new
protocol on top of the Bluetooth software stack, called Home Automation Protocol (HAP), to
make the communication between devices possible. The device controller is connected to

electronic devices through the I2C Bus. The system allows more than one device controller to
be connected to the host controller.
The work of H. Kanmaet al. also proposes a home automation system using Bluetooth that
can be accessed remotely through GPRS. The researchers use a cellphone equipped with
Bluetooth connectivity as a host controller and a GSM modem that provides Internet
connectivity. Home devices are fitted with Bluetooth communication adapters so that they can
communicate with the host controller phone via Bluetooth. The paper discusses remotely
controlling and updating home devices along with fault diagnostics and detection. The work
also talks about providing an electronics user manual on the phone using Bluetooth and
Internet.

Electrical and computer engineering


Page
2.2.2. GPRS-based Home Automation System

There are a lot of home security systems implemented using GPRS. Most systems use the
word security in the traditional sense, and only address the threat put forth by old fashioned
intruders in home.
Researchers M. Danaher and D. Nguyen propose a home security system using GPRS. The
work uses a webcam to stream video and pictures of the home to its owner’s mobile through
GPRS. The webcam detects movement by comparing frames for differences, including light
intensity. Video streaming in the proposed work is done using the home Internet connection,
not the GSM modem.
The work describes video camera surveillance using the GPRS facility in mobile phones. The
camera is triggered when an intrusion is detected or the door bell is rung. The system
identifies intrusions with an infrared sensor. In the case of a doorbell, the system calls the
homeowner and establishes voice communication with a live video feed between the visitor
and the homeowner. When an intrusion is detected, an email is sent to the user along with a
picture, most likely of the intruder. Upon receiving this email the user can start monitoring
the video feed on his phone.

2.2.3. DTMF-based Home Automation System

The work of L. Muhury and A.H.M.A Habib describes the design and implementation of a
DTMF-based home automation system. The user calls a SIM number assigned to the home
and presses the digits on their phone’s keypad to control the home’s devices by generating a
DTMF tone. The tone is received and decoded by the GSM module at home using a DTMF
decoder. The decoded instructions are passed to the microcontroller so that user commands
can be implemented at home.

2.3. Drawback of the existing project


Bluetooth-based Home Automation System: it was accessed by every phone that have
Bluetooth connection

GPRS-based Home Automation System: it needs internet connection.

DTMF-based Home Automation System: Home automation systems using DTMF are not
very commonly implemented, maybe because there are other better options for

Electrical and computer engineering


Page
communication available. Like all other systems, DTMF-based home security systems also
have their security flaws. They are vulnerable to “fuzzing attacks,” as described by R. Sasi. In
a fuzzing attack, a user exploits vulnerability in DTMF processing algorithms by giving
unusual input data, which results in triggering an exception. This could cause the entire home
network to crash.

Our project will solve the above problems by creating strong security system it have used
GSM module and password. It was used by only authorized person and when problem is
happen, our system send a message to the owner or police. This make our system more safe
and secure than before.

Electrical and computer engineering


Page
Chapter 3

Conceptual framework of the study

3.1. What is the PIC microcontroller?


PIC (usually pronounced as "pick") is a family of microcontrollers made by Microchip
Technology, derived from the PIC1650 originally developed by General Instrument’s
Microelectronics Division. The name PICinitially referred to Peripheral Interface Controller.
The first parts of the family were available in 1976; by 2013 the company had shipped more
than twelve billion individual parts, used in a wide variety of embedded systems .Early
models of PIC had read-only memory(ROM) or field-programmable EPROM for program
storage, some with provision for erasing memory. All current models use flash memory for
program storage, and newer models allow the PIC to reprogram itself.

Program memory and data memory are separated. Data memory is 8-bit, 16-bit, and, in latest
models, 32-bit wide. Program instructions vary in bit-count by family of PIC, and may be12,
14, 16, or 24 bits long. The instruction set also varies by model, with more powerful chips
adding instructions for digital signal processing functions.

The hardware capabilities of PIC devices range from 6-pin SMD, 8-pin DIP chips up to 144-
pin SMD chips, with discrete I/O pins, ADC and DAC modules, and communications ports
such as UART, I2C , CAN, and even USB . Low-power and high-speed variations exist for
many types.

The manufacturer supplies computer software for development known as MPLAB assemblers
and C/C++ compilers, and programmer/ debugger hardware under the MPLAB and PICKit
series. Third party and some open-source tools are also available. Some partshave in-circuit
programming capability; low- cost development programmers are availableas well as high-
production programmers.

Features of PIC

PIC devices are popular with both industrial developers and hobbyists due to their

 low cost
 wide availability
Electrical and computer engineering
Page
 large user base
 extensive collection of application notes
 availability of low cost or free development tools
 serial programming, and re-programmable Flash-memory capability.

figure 3. ; microcontroller

The microcontroller in the above figure the components that are the RAM, ROM, I/O, Timer,
serial com port are all within the chip.

3.1.2 .Description of the PIC microcontroller;

The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and
interrupt system to continue functioning. The Power-down mode saves the RAM contents but
freezes the oscillator, disabling all other chip functions until the next external interrupt or
hardware reset.

2.1.3Pin configuration of pic1f877a

figure 3. ; PIC16f877a
Electrical and computer engineering
Page
2.1.4 Pin Description of PICF16F877A

Electrical and computer engineering


Page
Electrical and computer engineering
Page
Programmable microcontroller are design to be used for embedded application unlike
microprocessor that can be found in PIC. Microcontroller are used automatically controlled
device including power tools, toys, implantable medical device, office machines, engine
controls device, appliance, remote control and other type of embedded system. So in our
project we interface as the following

 Pin 14&13 are interfaced with crystal and capacitor for stability.
 Pin 33 to pin 38(RB0 to RB5) are interfaced with LCD display.
 Pin 39(RB6) was interfaced with buzzer.

Electrical and computer engineering


Page
 Pin 40 was interfaced withed stepper motor.
 Pin 15 was interfaced with the relay.
 Pin 25&26(RC6&RC7) are interfaced with virtual terminal.
pin 19 to 30(RD0 to RD7) are interfaced with the keypad’

3.2 Keypad
Keypad is most widely used input device to provide input from the outside world to
the microcontroller. The keypad makes an application more users interactive. A matrix
keypad consists of arrangement of switches in matrix format in rows and columns with the
microcontroller I/O pins connected to the rows and columns of the matrix such that switches
in each row are connected to one pin and switches in each column are connected to another
pin. A keypad is generally a matrix arrangement of tact switches which are basically push
button switches.

figure 3. keypad

There are numerous techniques depending on the connection keypad with microcontroller,
but the fundamental logic is same the columns are made as input and drive the rows making
them as output. So as to detect which key is pressed from the matrix keypad, the row lines are
to be made low one by one and read the columns.

Here we are going to see a 4×4 matrix keypad. It is 16 keys keypad consists of four rows and
four columns. Assume that if row1 is made low, then read the columns. If any of the key in
row1 is pressed then correspondingly the column 1will give low that is if second key is
pressed in row1, then column2 will give low.

3.2.1. Interfacing Matrix Keypad with PIC Microcontroller

The concept of interfacing a keypad with the PIC is similar to interfacing it with any other
microcontroller. The article of interfacing keypad with PIC can be referred for detailed

Electrical and computer engineering


Page
description of the methodology used here. This article explains the interfacing of a 4x4
keypad with pic and displaying the output on a LCD. The brief steps to interface the keypad.

3.3. LED (light emitting diode)


Short for Light-Emitting Diode, LED is a special semiconductor that illuminates when an
electrical charge passes through it. LEDs are commonly green or red; however can be an
assortment of other colours. Below are just a few examples of how an LED could be used
with a computer. LED falls within the family of P-N junction devices. The light emitting
diode (LED) is a diode that will give off visible light when it is energized. In any forward
biased P-N junction there is, with in the structure and primarily close to the junction, a
recombination of hole and electrons. This recombination requires that the energy possessed
by the unbound free electron be transferred to another state. The process of giving off light by
applying an electrical source is Called electroluminescence.

figure 3. 4 led symbol and schematic diagram

LED is a component used for indication. All the functions being carried out are displayed by
led .The LED is diode which glows when the current is being flown through it in
forward bias condition. The LEDs are available in the round shell and also in the flat shells.
The positive leg is longer than negative leg.

In our project the led light used to indicate that the password is correct.

3.4 LCD (liquid crystal display);

3.4.1 .Description of LCD

LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range
of applications. In this project we use the 16x2 LCD display; it’s a very basic module and
is very commonly used in various devices and circuits. These modules are preferred over
Electrical and computer engineering
Page
seven segments and other multi segment LEDs. LCDs are economical; easily programmable;
have no limitation of displaying special & even custom characters (unlike in seven segments),
animations and so on .A 16x2 LCD means it can display 16 characters per line and there are 2
such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data. The command register stores the command
instructions given to the LCD. A command is an instruction given to LCD to do a
predefined task like initializing it, clearing its screen, setting the cursor position,
controlling display etc.

3.4.2.LCD Commands and Instruction set

Only the instruction register (IR) and the data register (DR) of the LCD can be controlled by
the MCU. Before starting the internal operation of the LCD, control information is
temporarily stored into these registers to allow interfacing with various MCUs, which
operate at different speeds, or various peripheral control devices. The internal operation of
the LCD is determined by signals sent from the MCU.

These signals, which include register selection signal (RS), read/write signal (R/W), and the
data bus (DB0 to DB7), make up the LCD instructions.

There are four categories of instructions that:

 Designate LCD functions, such as display format, data length, etc.


 Set internal RAM addresses
 Perform data transfer with internal RAM
 Perform miscellaneous functions.

figure 3. 5 LCD

LCD PIN description: The LCD Pin description is illustrates in the table below

Electrical and computer engineering


Page
LCD: 16×2 Liquid Crystal Display which will display the 32 characters at a time in two rows
(16 characters in one row). Each character in the display of size 5 × 7 pixel matrixes,
Although this matrix differs for different 16×2 LCD modules if you take JHD162A
this matrix goes to 5×8. This matrix will not be same for all the 16×2 LCD modules. There
are 16 pins in the LCD module, the pin configuration are given in the above.

Follow these simple steps for displaying a character or data

 E=1; enable pin should be high


 RS=1; Register select should be high
 R/W=0; Read/Write pin should be low.

Electrical and computer engineering


Page
To send a command to the LCD just follows these steps:

 E=1; enable pin should be high


 RS=0; Register select should be low
 R/W=1; Read/Write pin should be high.
Commands: There are some preset commands which will do a specific task in the LCD.
These commands are very important for displaying data in LCD. The list of commands given
below:

Coming to the programming you should follow these steps:

STEP1: Initialization of LCD.

STEP2: Sending command to LCD.

STEP3: Writing the data to LCD.

Initializing LCD: To initialize LCD to the pic16f8877a the following instruction and
commands are to be embed in to the functions

 0×38 is used for 8-bit data initialization.


 0xFH for making LCD on and initializing the cursor.
 0X6H for incrementing the cursor which that display another character in the LCD
 0x1H for clearing the LCD.

Electrical and computer engineering


Page
3.4.3. Sending data to the LCD:

 E=1; enable pin should be high


 RS=1; Register select should be high for writing the data
 Placing the data on the data registers
 R/W=0; Read/Write pin should be low for writing the data.

In our project LCD is used to display the request to enter the password ,to display the
password with asterisk and also it displays writher the password we enter is Wright or wrong.
Are economic; easily programmable; have no limitation of displaying special & even custom
characters (unlike in seven segments), animation and so on.

3.5 Stepper motor


First of all, a stepper motor is a motor that converts electrical power into mechanical power.
The main difference between them and all the other motors is the way they revolve.
Unlike other motors, stepper motors does not continuously rotate! Instead, they rotate in
steps (from which they got the name). Each step is a fraction of a full circle. This fraction
depends mostly from the mechanical parts of the motor, and from the driving method. The
stepper motors also differs in the way they are powered. Instead of an AC or a DC voltage,
they are driven (usually) with pulses. Each pulse is translated into a degree of rotation. For
example, 1800stepper motor will revolve its shaft 1800on every pulse that arrives. Often, due
to this characteristic, stepper motors are called also digital motors. First of all, you may want
to see the videos with the 3D model of a stepper motor, that we explain how it is made and
how it operates: As all motors, the stepper motors consists of a stator and a rotor. The rotor
carries a set of permanent magnets, and the stator has the coils. The very basic
design of a stepper motor would be as follows:

figure 3. 6 stepper motor

Electrical and computer engineering


Page
There are 4 coils with 90 0 angle between each other fixed on the stator. The way that the coils
are interconnected, will finally characterize the type of stepper motor connection. In the
above drawing, the coils are not connected together. The above motor has 90 orotation step.
The coils are activated in a cyclic order, one by one. The rotation direction of the shaft is
determined by the order that the coils are activated.

The easiest way of interfacing a stepper motorwith a microcontroller is via ULN2003


transistor array chip. This IC has seven Darlington transistor drivers and is used for high
current torque motors. In the circuit diagram, the four input pins (1B, 2B, 3B, 4B) of
ULN2003 are connected to the lower significant bits of PORTC of the microcontroller and
the output pins (1C,2C, 3C, 4C) are connected to the ‘live’ pins of the stepper motor.

3.6. GSM Modem


GSM is the acronym for Global System for Mobile Communication. GSM module is wireless
modem that transmits data using radio waves. GSM architecture is similar to the mobile
architecture. It is a hardware component that allows the capability to send and receive SMS to
and from the system. The communication with the system takes place via RS232 serial port.
Cell phone can be attached at the place of GSM hardware but it limits the hardware
functionality such as sending or receiving of SMS. The GSM modem provides the
communication mechanism between the user and the microcontroller system by means of
SMS messages. GSM modem is a plug and play device and is attached to the PC which then
communicates with the PC via RS232 port. GSM modem is a bridge responsible for
enabling/disabling of SMS capability. GSM MODEM is a class of wireless MODEM devices
that are designed for communication of a computer with the GSM network. It requires a SIM
card just like mobile phones to activate communication with the network. A GSM MODEM
can perform the following operations:9+

Receive, send or delete SMS messages in a SIM.

 Read, add, search phonebook entries of the SIM.

 Make, Receive, or reject a voice call.

Electrical and computer engineering


Page
figure 3. GSM mode (SIM 900)

The MODEM needs AT commands, for interacting with processor or controller, which are
communicated through serial communication. The controller sends these commands. The
MODEM sends back a result after it receives a command. Different AT commands supported
by the MODEM can be sent by the controller computer to interact with the GSM cellular
network. AT commands are used to control MODEMs functionality.

In this project RXD and TXD pin of GSM module and PIC should be connectedwith each
other in reveres manner because transmitted data of PIC microcontroller receive to GSM
module andsimilarly transmitteddata from GSM TXD go to RXD receive pin of PIC
microcontroller .this is a weird communication to send data from one device to another.
There are many method of weird communication but PIC and GSM interfaced through 2 wire
serial communications. Serialcommunication means to send data bit bybit. There is one
important to consider whileusing serial communication that is baud rate.Baud rate is the
number of bits transfer persecond from one device to another. You shouldcheck baud rate
compatibilitybetween twodevices. Usually SIM900D GSM module support9600 baud rate
with UART type serial communication. UART mean universalAsynchronous receiver and
transmitter. PIC microcontroller have built hardware toimplement UART serial
communication process between PIC microcontroller and GSM module.SIM900D GSM
module also support UART serialcommunication.

GSM module is used to establish communication between our system and mobile system.
Global System for Mobile communication (GSM) is an architecture usedfor mobile
communication in most of the countries.

3.7.Capacitor
Capacitors are two-terminal electrical elements. Capacitors are essentially two
conductors, usually conduction plates - but any two conductors - separated by an
insulator - a dielectric -with connection wires connected to the two conducting plates.
Capacitors occur naturally. On printed circuit boards two wires running parallel to
each other on opposite sides of the board form a capacitor.

Electrical and computer engineering


Page
Capacitors are components that are used to store an electrical charge and are used in
timer circuits. A capacitor may be used with a resistor to produce a timer. Sometimes
capacitors are used to smooth a current in a circuit as they can prevent false triggering of
other components such as relays. When power is supplied to a circuit that includes a
capacitor, the capacitor charges up. When power is turned off the capacitor discharges its
electrical charge slowly.

figure 3. capacitor

3.8. REGULATOR IC (78XX)


It is a three pin IC used as a voltage regulator. It converts unregulated DC current into
regulated DC current

3.9.Resistor
The flow of charge through any material encounters an opposing force similar in many
respects to mechanical friction this opposing force is called resistance of the material .in
some electric circuit resistance is deliberately introduced in form of resistor. Resistor
used fall in three categories, only two of which are colour coded which are metal film and
carbon film resistor.The third category is the wire wound type, where value is generally
printed on the vitreous paint finish of the component. Resistors are in ohms and are
represented in Greek letter omega, looks as an upturned horseshoe.

Most electronic circuit requires resistors to make them work properly and it is
obliviously important to find out something about the different types of resistors
available. Resistance is measured in ohms; the symbol for ohm is an omega ohm. 1 ohm is
quite small for electronics so resistances are often given in KOhm and M Ohm.Resistors
used in electronics can have resistances as low as 0.1 ohm or as high as 10 Mohm.

figure 3. resistor
Electrical and computer engineering
Page
CHAPTER FOUR

SYSTEM DESIGN

4.1 Introduction
There are several steps to be applied in designing room security system. The relevant
information is gathered through literature review. Data on different hardware materials and
security system projects has been collected where the theoretical design is studied based on
microcontroller for security concept.

The hardware development according to the circuit designed. This process is just only being
preceded if each part of the circuit being improved is valid, else, it will be repeated until it is
valid as the theoretical. Once the hardware development circuits have the output as the
expected, then, the comparison for both hardware and theoretical analysis will be done. Next
is the step where software structure is developed for the security system to be interface with
the hardware development. While the final step of this research is on applying the whole
project to the real room entrance like doors.

figure 4. block diagram

Electrical and computer engineering


Page
Description of block diagram

In our system first give the power supply to activate microcontroller and stepper motor.
Keypad used as an input for the microcontroller to enter pass word. buzzer,GSM module
AND LCD are output of microcontroller and also stepper motor driver . The stepper motor
driver connected to the stepper motor and stepper motor connected to the door. The buzzer
used for give sound ,GSM module used for receiving and sending message to and from the
system and LCD display the action.

The stepper motor driver used for connecting motor with microcontroller and stepper motor
used for activate the door.

When the microcontroller interfaced with LCD display and keypad,the schematic diagram
will look like the following.

figure 4. schematic diagram of microcontroller interfaced with LCD and keypad

Electrical and computer engineering


Page
when the GSM module interfaced with microcontroller,the schematic diagram will look like:

figure 4. schematic diagram of microcontroller interfaced with GSM module


When the microcontroller interfaced with stepper motor:

figure 4. digram of microcontroller interfaced with stepper motor

Electrical and computer engineering


Page
The system will look like the figure 5.4when we start the over all program. And when the
password we enter is right the simulation result is just look like that of figure 5.5

figure 4. ;complete system design for door

Electrical and computer engineering


Page
LCD displays the “enter password” and the GSM virtual terminal board is also ready.

figure 4. ; simulation result

4.2 Power Supply Design


The input to the circuit is applied from the regulated power supply. We need a
constant low voltage regulated power supply of +5V, providing input voltages to the
microcontroller, keypad and LCD display which requires 5 volts supply and this
power supply unit contains the following parts:

figure 4. supply design

4.2.1. Transformer

Transformer is electromagnetic device that transforms electrical energy from one


circuit to another through inductively coupled conductors. A varying current in the primary
side creates varying magnetic flux in the transformer’s core and thus a varying magnetic
field through the secondary winding. Step down transformer is used while design the power

Electrical and computer engineering


Page
supply to our system, since the microelectronic circuit need only 5 V. A step down
transformer accepts a given voltage on the primary side and outputs a lower voltage on its
secondary side. It uses 220V at 2A from the feeder line and steps down to safer 9 V at
500mA; using the transformer equations we have the following calculation;

V 1 N 1 I2
= = … … … … … … … .( 4.1)
V 2 N 2 I1

Form the above equation and the give values for input output we can calculate number of
turns

I1= 2A, V2= 9V, V1 = 220V, I2= 500Ma

v2 9
= =24.4
v 1 220

So from these we get the turn ratio is 24:1 assume that number of turn in secondary be 50

220 N 1
Therefore, =
9 50

N1 = 1222turns

Rectifier
The input from step down transformer is 9 volts AC is converted to DC voltage using a 4
diodes bridge rectifier circuit. 1N4007 rectifier diodes have been used. These diodes have a
voltage drop of 0.9 volts across them and maximum rating 5 V/ 1 A. It also gives
better rectified output compared to other rectifier diodes. First we need to convert the RMS
power supply voltage to its peak voltage value (amplitude) as follows:

Vpeak=√ 2*Vrms=√ 2*9=12.73V

Vdc=0.9*12.73=11.457V

Vacrms
Ripple factor, y= Vdc =0.786

Therefore, we get 11.457 V and 600mA at the output.

Capacitor
Electrical and computer engineering
Page
Capacitors are used as a filtering component. They filter out the AC ripple present in the
output of full wave rectifier.The value of capacitor is calculated as follows for full wave
rectifier

1
C= 4∗√ 3∗¿ f ∗y =0.03f

We use standard electrolytic capacitors of rating 100µF/25V and 1000 µF/16V for this
purpose. We require 1 µF for 1 mA. Therefore, for 500mA we will require 500 µF. Hence we
use 1000 µF (standard) filter capacitor and d 100 µF (standard) ripple capacitor.

Regulator

Since we require a constant 5 V DC supply voltage for the entire circuitry, we have to
regulate the output from the bridge rectifier circuit. So we use LM2937 500mA Low dropout
regulator. The LM2937 is a positive voltage regulator capable of supplying up to 500 mA of
load current. The use of a PNP power transistor provides a low dropout voltage
characteristic. With a load current of 500 mA the minimum input to output voltage
differential required for the output to remain in regulation is typically 0.5V (1V
guaranteed maximum over the full operating temperature range). Special circuitry has
been incorporated to minimize the quiescent current to typically only 10 mA with a full
500 mA load current when the input to output voltage differential is greater than 3V.
The LM2937 requires an output bypass capacitor for stability. As with most low dropout
regulators, the ESR of this capacitor remains a critical design parameter, but the LM2937
includes special compensation circuitry that relaxes ESR requirements. The

LM2937 is stable for all ESR below 3Ω.

Electrical and computer engineering


Page
figure 4. schematic diagram of power supply

Flowchart description

First initialized the material that used in the system then assign a trial to ready entered the
password if the password is correct LCD display welcome then the really on and the stepper
motor activate clock wise and the door open after some delay stepper motor rotate at revisers
direction and the door closed after this the system ready for the next, else check the trial if the
trial is greater than two the buzzer is on and send SMS to the authorized person after this
they need reset value or text to restart the system, else the LCD display in valid password and
increment the trial to give another chance to enter password.

Electrical and computer engineering


Page
This section shows our proposed program model for the microcontroller.

figure 4. flow chartchart

Electrical and computer engineering


Page
Chapter 5

Test result anddiscussion

5.1 Result
The power supply is provided first to the hardware and through voltage regulator, the
circuit components receive their proper supply voltage. After that, the LCD displays the
required BCD code. The code is received by the module and checks the code availability.this
all is done by the following procedure.

when the right password is enter the schematic diagram will look like this

figure 5. schematic diagram when the password is right

Electrical and computer engineering


Page
when the wrong password is enter the schematic diagram will look like this

figure 5. schematic diagram when the password is wrong.

Electrical and computer engineering


Page
Chapter 6

Conclusion and recommendation

6.1 Conclusion
This project concentrates on the design and implementation of a home security system
via cellular phones through GSM modem and microcontroller support. It realizes the help of
mobile since this is the cheapest gadget that almost everybody is using nowadays. In our
project, since it deals with simplicity and low cost, we were able to conceptualize a
user friendly device that helps to protect our properties.

Pertaining to the devices involved in our project, we have tried configuring the GSM modem
for the very first time and also the performance of different sensor needed to accomplish our
project were first studied for their feasibility before any configuration. The software
simulation greatly helped us also to demonstrate the detailed output of our project and it was
very successful. In this project we have studied and completely and successfully modeled
home security system with sending message to cell phone. Interfaced sensors,
programmed microcontroller, GSM configuration and lights activation was obtained by
the group to help protecting our home properties.

The result of our final designed project has met our objectives, in which every sensor is
working and will sound specific alarm when the system goes into alert condition. The
designed project was a really enjoyable and challenging project to work with. It requires a lot
of hard work but the result was amazing and gave as reward, a lot of experience in exploring
different technologies.Our project is really very effective and practical. It can be used not
only in the home but also in any establishment too. It can detect the surrounds to not only
protect our assets but also our lives. Besides, it can be highly customized to suit each one's
need and preference. We think that our designed project is very useful for us as well as
other people. We believe every house in our country should equip a security system like
the one we design.

This project has deepened our technical knowledge in each aspect of electrical
engineering streams. In addition to this, we are proud that we were able to express our own
ideas to make this project more meaningful, from the beginning we were realistic about
the specifications of ourprojects given time, knowledge, and financial constraints. Our final

Electrical and computer engineering


Page
project closely follows our claims except that we are still configuring and searching solutions
to understand and configure the features of our expensive and borrowed GSM modem
for hardware implementation and simulation purposes.

6.2 Recommendation
Along the course of project completion, we encountered various problems and
obstacles. Not everything that we had planned went smoothly during the project development
span. We had to start from the research phase at the beginning and needed to gain knowledge
on all the devices and components that we had intended to use for our project.

As part of our recommendation, we would like to recommend to the future researcher


modify this project by adding biometric sensor and thehardware interfacing and GSM
configuration must be perfectly implemented since the software analysis designed is already
done.Furthermore, for additional features such as, temperature sensor, automation,
weather, remote sensing and the like should be taken also in consideration for the future
developer.

Electrical and computer engineering


Page
Reference
[1]. Amer Iqbal, Lets Begin Microcontroller Programming Using PIC
Microcontrollers.

[2]. Dogan Ibrahim, Microcontroller projects in C for the 8051, Oxford, 2000.

[3]. PIC16F87xA microcontroller datasheet

[4]. AT89C51 microcontroller datasheet

[5]. GSM Modem modules datasheet

Appendices
char AT[]="AT";//to initialize mode

char noecho[]="ATEO";//to stop echo

char mode_text[]="AT+CMGF=1" ;// to set the text mode

//char char mode_text[]="AT+CSEA=\"GSM\"";

char param[]="AT+CSMP=17,167,0,0" ;//set the parameter of character

char mobile_no[]="AT+CMGS= \"+251936600292\"";//used to set rcepiant number and


mesage

char terminator=0x1A;//character form of control +z terminator character

char mesg[]="leba mta";//message we want to send

void send_to_modem(char*s) //function to write anything serialy

while (*s)

UART1_WRITE(*s++) ;

UART1_WRITE(0X0D) ;

Electrical and computer engineering


Page
}

void send_to_modem1(char*s)

while (*s)

UART1_WRITE(*s++) ;

void send_sms()

unsigned short kp, cnt, oldstate = 0,i;

int sum , pro;

char txt[6];

int pass[3];

int k,j;

// Keypad module connections

char keypadPort at PORTD;

// End Keypad module connections

// LCD module connections

sbit LCD_RS at RB4_bit;

sbit LCD_EN at RB5_bit;

sbit LCD_D4 at RB0_bit;

sbit LCD_D5 at RB1_bit;

sbit LCD_D6 at RB2_bit;


Electrical and computer engineering
Page
sbit LCD_D7 at RB3_bit;

sbit motor at RB6_bit;

sbit buzzer at RB7_bit;

sbit ck at RC0_bit;

sbit LCD_RS_Direction at TRISB4_bit;

sbit LCD_EN_Direction at TRISB5_bit;

sbit LCD_D4_Direction at TRISB0_bit;

sbit LCD_D5_Direction at TRISB1_bit;

sbit LCD_D6_Direction at TRISB2_bit;

sbit LCD_D7_Direction at TRISB3_bit;// End LCD module connections

void main() {

TRISB = 0x3F;

while(1){

cnt = 0; // Reset counter

Keypad_Init(); // Initialize Keypad

// ANSEL = 0; // Configure AN pins as digital I/O

//ANSELH = 0;

start: sum = 0;

Lcd_Init();

// Initialize LCD

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF);

Lcd_Out(1, 1, "enter password"); // Cursor off


Electrical and computer engineering
Page
buzzer =0;

motor = 0;

ck=1;

cnt = 3;

for(k = 0;k<10;k++) {

kp = 0; // Reset key code variable // Wait for key to be pressed and


released

do kp = Keypad_Key_Click();

while (!kp); // kp = Keypad_Key_Press();

switch (kp) {

/*case 10: kp = 42; break; // '*' // Uncomment this block for keypad4x3

case 11: kp = 48; break; // '0'

case 12: kp = 35; break; // '#'*/

default: kp += 48;

case 1: kp = 1; break; // 1

case 2: kp = 2; break; // 2

case 3: kp = 3; break; // 3

case 5: kp = 4; break; // 4

case 6: kp = 5; break; // 5

case 7: kp = 6; break; // 6

case 9: kp = 7; break; // 7

case 10: kp = 8; break; // 8

case 11: kp = 9; break; // 9

Electrical and computer engineering


Page
case 13: kp = 42; break; // *

case 14: kp = 48; break; // 0

case 15: kp = 35; break; // #

if(k>5)

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF);

Lcd_Out(2, 1, "Limit exceeded!");

delay_ms(200);

goto start;

if (kp != 42 && kp != 35 )

{ //if * and = is not pressed

if(k == 2)

sum = sum + 1*kp;

if(k == 1)

sum = sum + 10*kp;

if(k == 0)

sum = sum + 100*kp;

Lcd_chr(2, 10+k, '*');

} else

if (kp == 42)
Electrical and computer engineering
Page
{ //if clear is pressed

if(k == 2)

sum = sum - 100*kp;

if(k == 1)

sum = sum - 1000*kp;

if(k == 0)

goto start;

Lcd_Cmd(_LCD_MOVE_CURSOR_LEFT);

Lcd_chr(2, 10+k-1, '*');

k--;

if(kp == 35) //= pressed

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

Lcd_Out(1, 1, "1");

for(i = 1;i<4;i++) {

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF);

Lcd_Out(1, 1, "CHECKING"); // Write message text on LCD

DELAY_MS(50);

Lcd_Out(1, 1, "CHECKING.");

delay_ms(50); // Write message text on LCD


Electrical and computer engineering
Page
Lcd_Out(1, 1, "CHECKING. . ");

delay_ms(50); // Write message text on LCD

Lcd_Out(1, 1, "CHECKING. . .");

delay_ms(50); }

if(sum == 147)

motor = 1;

Lcd_out(1,1,"wellcom");

ck=1;

delay_ms(1200);

ck=0;

delay_ms(1200);

motor = 0;

else {

Lcd_Out(1, 1, "Incorrect input");

buzzer=1;

UART1_Init(9600); // Initialize UART module at 9600 bps

Delay_ms(100); // Wait for UART module to stabilize

UART1_Write(10);
Electrical and computer engineering
Page
UART1_Write(13); // Endless loop

UART1_Write_Text("Unauthorized person");

delay_ms(1000);

} } } }}

Electrical and computer engineering


Page

You might also like