SlideShare a Scribd company logo
1 of 43
Download to read offline
Microcontroller Based Password Protected Home
Appliance
A project report submitted in partial fulfillment of
the requirements for the degree of
Bachelor of Technology
in Electronics and Communication Engineering
by
Susmit Sarkar
(Roll No. 14400311114)
Under the guidance of
Prof. Biplab Roy
Department of Electronics and Communication Engineering
Neotia Institute of Technology, Management and Science
West Bengal University of Technology
Report Approval
The project report entitled
Microcontroller Based Password Protected Home
Appliance
by
Susmit Sarkar
(Roll No. 14400311114)
is approved for the degree of
Bachelor of Technology
Examiner Examiner
Supervisor Head of the Department
Date:
Place: NITMAS
Abstract
The micro-controller based digital lock is an access control system that allows only autho-
rized persons to access any restricted division. The major components include a keypad, LCD,
EEPROM and the micro-controller ATmega8A-PU which belongs to the 8159 8-bit series of
micro-controllers. The electronic control assembly allows the system to unlock the device with
a password. A four digit pre-defined password needs to be specified by the user. A 4x3 matrix
KEYPAD have been used here to set the password which is stored in the EEPROM so that we
can change it at any time. While unlocking, if the entered password from keypad matches with
the stored password, then the lock opens and a message is displayed on the LCD. Also an output
pin is made high to be used for further purposes. As the program starts, string “Enter Password”
is displayed on LCD. The keypad is scanned for pressed digits one by one. Every time row and
column of the key pressed is detected and the digit is displayed on LCD. If all the four digits
match with set password, LCD displays “Access Granted” and the lock output pin goes high
and the led glows. If the security code is wrong, “Access Denied” is displayed in the LCD and
the buzzer rings which is connected to one of the pins of the micro-controller.A relay circuit is
also present by means of which we are controlling one 12V DC fan and a 15W bulb (one at a
time), which will operate when the password matches.
ii
Acknowledgments
I would like to take this opportunity to express my gratitude to everyone who supported us
throughout the course of this B.Tech final year project.I am thankful for their aspiring guidance,
invaluably constructive criticism and friendly advice during the project work.I am sincerely
grateful to them for sharing their truthful and illuminating views on a number of issues related
to our project.I express my warm thanks to our project mentor Prof. Biplab Roy and our Head
of the Department Dr. Sujoy Biswas for their support and guidance at NITMAS.I would also
like to thank Prof. Biswarup Mukherjee for suggesting us with some modifications to make
our project better.
Date: 20th May, 2015
Susmit Sarkar
Declaration of Academic Ethics
I declare that this written submission represents our ideas in our own words and where oth-
ers’ ideas or words have been included, our have adequately cited and referenced the original
sources. I declare that we have properly and accurately acknowledged all sources used in the
production of this report.
Ialso declare that we have adhered to all principles of academic honesty and integrity and
have not misrepresented or fabricated or falsified any idea/data/fact/source in our submission.I
understand that any violation of the above will be a cause for disciplinary action by the Institute
and can also evoke penal action from the sources which have thus not been properly cited or
from whom proper permission has not been taken when needed.
Date: 20th May, 2015 Susmit Sarkar
(Roll No. 14400311114)
Contents
Abstract ii
List of Figures vii
1 Introduction 1
2 Flowchart Design 2
3 Block Diagram 3
3.1 Description of Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 Hardware Components 4
4.1 ATmega8 Micro-controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.2 4-Pin Push Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.3 Liquid Crystal Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.4 IC 7805 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.5 Other Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5 Circuit Diagram 7
5.1 Explaination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6 ATmega8 9
6.1 Why ATmega8? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3 Pin Configuration and Explanation . . . . . . . . . . . . . . . . . . . . . . . . 10
6.4 Pin Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
v
7 Power Section 12
7.1 Source of Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
7.2 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
7.3 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
8 LCD Module 14
8.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8.2 LCD Display Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
8.3 Interfacing the LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
9 Keypad Module 17
9.1 Interfacing the Keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
9.2 Matrix Keypad Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
10 Relay 20
10.1 What is a Relay? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
10.2 Pin Description of a 5 pin Relay . . . . . . . . . . . . . . . . . . . . . . . . . 21
10.3 How does it works? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
10.4 Specifications and Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . 23
11 Buzzer Interfacing 24
12 Peripheral Devices 25
13 Software Implementation 26
13.1 AVR Studio 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
13.2 Software Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
13.3 Downloading the Hex File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
13.3.1 Apparatus Required . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
13.3.2 Steps Involved: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
14 Conclusion 32
15 Future Aspects 33
References 34
vi
List of Figures
2.1 Flowchart Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.1 4-pin push button Layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Connection of positive and negative/ground terminals. . . . . . . . . . . . . . . 5
5.1 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.1 Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
6.2 Pin Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
7.1 Top view of the Power Section . . . . . . . . . . . . . . . . . . . . . . . . . . 12
7.2 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
8.1 Top view of LCD display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8.2 Block Diagram along with Pin Connections . . . . . . . . . . . . . . . . . . . 15
8.3 Interface Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
8.4 LCD Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
9.1 LCD Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
9.2 Matrix Connection 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
9.3 Matrix Connection 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
9.4 Matrix Connection 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
10.1 A simple Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
10.2 Pin Diagram of a Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
10.3 Relay Internal Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
10.4 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
vii
11.1 Circuit Diagram and Implementation . . . . . . . . . . . . . . . . . . . . . . . 24
12.1 Peripheral Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
13.1 Development Board and Programmer . . . . . . . . . . . . . . . . . . . . . . 30
13.2 Entire Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
viii
Chapter 1
Introduction
Security is a prime concern in our day-to-day life.Everyone wants to be as much secure as pos-
sible.The Micro-controller Based Password Protected Home Appliance is an access control
system that allows only authorized persons to access an appliance.The system is fully controlled
by the 8 bit micro-controller ATmega8.There is a Keypad by which the password can be entered
through it.When the entered password matches with the password stored in the memory then
we get access to the appliance.Presence of a stored EEPROM within the MCU which helps us
to modify the password everytime we want. If the stored password doesn’t matches with the
given password, the buzzer will start to make noise, and the relay will not operate.
The objectives of our project are listed as below:
• To protect home appliances from unauthorized persons.
• We can operate both AC and DC components one at a time.
• To design a keyless lock system by using electronic digital lock code.
1
Chapter 2
Flowchart Design
Figure 2.1: Flowchart Design
The password is entered through the keypad.If the password matches “Access Granted”
is displayed and the led glows and the relay is opened else it displays “Access denied” and the
buzzer gets activated.
2
Chapter 3
Block Diagram
Figure 3.1: Block Diagram
3.1 Description of Block Diagram
There micro-controller controls four modules viz. : Power, Keypad, LCD and Buzzer.The power
supply module is supplying +5V(via IC 7805)to the MCU and the LCD.Three interfacing pro-
grammes for LCD, Keypad and User Interfacing have been incorporated in the1
MCU.The relay
is mainly used to operate any household appliances (within a fixed power rating) one at a time.
1
Micro-controller Unit
3
Chapter 4
Hardware Components
4.1 ATmega8 Micro-controller
Features:
• High-performance, Low-power Atmel AVR 8-bit Microcontroller
• Advanced 1
RISC Architecture
• Non-volatile Memory segments
• Internal Calibrated RC Oscillator(1 Mhz)
• Operating Voltages
4.5V - 5.5V (ATmega8)
• Speed Grades
0 - 16MHz (ATmega8)
• Power Consumption at 4Mhz, 3V, 25◦
C
Active: 3.6mA
Idle Mode: 1.0mA
1
Reduced instruction set computer
4
4.2 4-Pin Push Switch
The 4 pin push button has two pairs of pins on opposite sides.In this case pin 1 and pin 2 are
connected to the same switch and so is pin 3 and pin 4.
Figure 4.1: 4-pin push button Layout.
Figure 4.2: Connection of positive and negative/ground terminals.
The switch (i) connects pin 1 and pin 2 and (ii) connects pin 3 and pin 4. The push button
closes both switches at once, when pressed.
4.3 Liquid Crystal Display
Features:
• 5 x 8 dots with cursor
• Built-in controller (KS 0066)
• 5V power supply
5
• 16 Characters * 2 Line Displays
• Display Mode and Backlight Variations
• 2
RoHS Compliant
4.4 IC 7805
7805 is a voltage regulator integrated circuit. The voltage source in a circuit may have fluctua-
tions and would not give the fixed voltage output. The voltage regulator IC maintains the output
voltage at a constant value.
Pin Description:
Pin 1:Input voltage (5V-18V)
Pin 2:Ground (0V)
Pin 3:Regulated output; 5V (4.8V-5.2V)
4.5 Other Components
1. Capacitor (0.1uF, 470uF)
2. Diode
3. Resistor (110Ω,4.7kΩ,330Ω)
4. Preset (10KΩ)
5. LED(3.5V DC and 0.8 Amp)
6. KS 110 Vero Board
7. Buzzer (5-30V, 7W maximum at 12Vp-p 4.0kHz)
8. Transistor (BC 548)
2
Restriction of Hazardous Substances
6
Chapter 5
Circuit Diagram
Figure 5.1: Circuit Diagram
5.1 Explaination
The Main Part of the above Circuit diagram is the micro-controller ATmega8. The Keypad is
the input device and it is connected in a matrix format so that the numbers of ports needed
are reduced. The micro-controller reads a four-digit password through the Keypad. Then the
micro-controller compares the four digit password with the number which is pre-programmed
and if it is equal then the micro-controller will switch on the relay for the appliance. The
7
Password is stored in the 1
EEPROM and the password can be changed at any time using the
same keypad.The power module should deliver constant output regulated power supply of 5V
for successful working of the project.For this IC 7805 voltage regulator is used, which supplies
power to the entire circuitry after downgrading the voltage from 12V DC.The stored EEPROM
within the MCU helps us to modify the password every time we want. If the stored password
doesn’t matches with the given password, the buzzer connected to Pin 24 will start to make
noise, and the relay will not operate.
The entire circuit is divided into 4 modules:
• Power Section Module
• LCD Module
• Keypad Module
• Relay Section
All this modules are being interfaced with the ATmega8 microcontroller, which are being dis-
cussed as we move further in this report.
1
Electrically Erasable Programmable Read-Only Memory
8
Chapter 6
ATmega8
6.1 Why ATmega8?
• Added EEPROM to store data over a power off time.
• An internal oscillator and an internal power on reset make the AVR working without any
other components.
• Due to the EEPROM, we can change the passwords any number of time.
• The AVR is optimized for C-programming.
• It allows programming and serial communication over 1
USB.
6.2 Features
• High-performance, Low-power Atmel AVR 8-bit Microcontroller
• Advanced RISC Architecture
• Non-volatile Memory segments
• Internal Calibrated RC Oscillator(1 Mhz)
• Operating Voltages
4.5V - 5.5V (ATmega8)
1
Universal Serial Bus
9
• Speed Grades
0 - 16MHz (ATmega8)
• Power Consumption at 4Mhz, 3V, 25◦
C
Active: 3.6mA
Idle Mode: 1.0mA
6.3 Pin Configuration and Explanation
Figure 6.1: Pin Configuration
• Port B (PB7..PB0): It is a 8 bit Bi-directional,2
tri-stated I/O port with internal pull up
resistors.
• Port C (PC5..PC0): Used as an 7-bit bi-directional I/O port with internal pull-up resis-
tors.
• PC6: Used as an I/O pin, a low level on this pin for longer than the minimum pulse length
will generate a Reset.
• Port D (PD7..PD0): It is an 8-bit bi-directional I/O port with internal pull-up resistors.
2
Tri-state, or 3-state logic allows output ports to assume a high impedance state in addition to the fundamental
0 and 1 levels, effectively removing the output from the circuit. This allows multiple circuits to share the same
output line or lines (such as a bus).
10
• RESET: A low level on this pin for longer than the minimum pulse length will generate
a reset, even if the clock is not running.
• AREF: It is the analog reference pin for the A/D Converter.
6.4 Pin Mapping
Figure 6.2: Pin Mapping
• Port B (PB7..PB0): This pins are mapped to mapped to the pins of LCD, except PB6 and
PB7.
• Port C (PC5..PC0): PC0 and PC1 are used as an interfacing port to Buzzer and Relay
Pins, ports PC2 to PC5 are unused and can be used for further modifications.
• PC6: This is a reset pin
• Port D (PD7..PD0): This pins are mapped to the Keypad Module
• AREF and AVCC:They have an external LC Oscillator attached to it, which produces a
frequency for the MCU to work properly.
11
Chapter 7
Power Section
7.1 Source of Power
There were a few options available to us. We can either use batteries, a wall adapter, or a
1
SMPS. In our case we will be using a wall adapter, to power our whole circuitry, although
SMPS or a battery can be used in order to increase the portability.A 12V DC adapter is used in
this case, to power the circuit, proper arrangements were also made to protect the MCU from
high voltage over 5V.
Figure 7.1: Top view of the Power Section
1
Switched Mode Power Supply
12
7.2 Components
• Capacitor(0.1uF, 470uF)
• Diode
• Resistor(330Ω)
• LED (3.5V DC and 0.8 Amp)
• Push Switch
• Power Socket
• IC 7805
7.3 Circuit Diagram
Figure 7.2: Circuit Diagram
Here, IC 7805 plays a pivotal role, it downgrades the 12V DC supply from the mains to a
constant 5V DC thereby protects the micro-controller from damage against overflow of current.
Here in this circuit the capacitors are acts as an Filter in this circuit.The ceramic capacitor
opposes the AC signal to flow through or appear at the output terminal.Here the Capacitors are
used across regulator in-order to obtain the stability.Ceramic capacitors handle noise and fast
transients.
13
Chapter 8
LCD Module
8.1 Features
The main features of the LCD are as follows :
• 5 x 8 dots with cursor
• Built-in controller (KS 0066)
• 5V power supply
• 16 Characters * 2 Line Displays
• Display Mode and Backlight Variations
• RoHS Compliant
Figure 8.1: Top view of LCD display
14
8.2 LCD Display Interface
The dot-matrix liquid crystal display controller and driver LSI displays alphanumeric, charac-
ters, and symbols. It can be configured to drive a dot-matrix liquid crystal display under the
control of a 4 or 8-bit microprocessor. Since all the functions such as display RAM, character
generator, and liquid crystal driver, required for driving a dot-matrix liquid crystal display are
internally provided on one chip, a minimal system can be interfaced with this controller/driver.
A single HD44780U can display up to two 8-character lines (16 x 2).Micro controller send the
data signals through pin 11 through 18 (RC0-RC3) and control signal through 4,6 and 7 of the
micro controller. Pin no 3 of the LCD is used to control the contrast by using preset PR1.
Figure 8.2: Block Diagram along with Pin Connections
Figure 8.3: Interface Pin Description
15
8.3 Interfacing the LCD
Port PB0-PB5 is being interfaced with the pins of the LCD. The transistor Q1 acts as a pull up
transistor, which boosts the voltage from Pin 15 (Port PB1), to turn the LCD backlight ON. A
10 kΩ preset is adjusted to get a proper LED display.
Figure 8.4: LCD Interfacing
16
Chapter 9
Keypad Module
9.1 Interfacing the Keypad
The port PD0-PD7 is mapped with the eight interconnects of the Keypad.Port PD0-PD3 corre-
sponds to the row of the 4X3 matrix, whereas the port PD4-PD7 corresponds to the column of
the same matrix.
Figure 9.1: LCD Interfacing
17
9.2 Matrix Keypad Connection
The Keypad is the input device and it is connected in a matrix format so that the numbers of
ports needed are reduced.The matrix keypad is established in the following manner :
1. The rows R0 to R3 and C0 to C3 are connected to i/o pins of Micro-controller, by setting
the DDR they are connected and made Input/output.
2. At first Columns are kept at High Impedance State. And in their PORT value we set them
all as LOW.
3. One by One we make each Column LOW (from high Z state) and read state of R0 to R3.
Figure 9.2: Matrix Connection 1
4. C0 is made LOW while all other Columns are in HIGH Z State.
5. But when a key is pressed it is connected to LOW line from the column thus making it
LOW.
Figure 9.3: Matrix Connection 2
18
6. If ROWS are high the button is NOT pressed.
7. C0 High Z again and make C1 LOW. And read R0 to R3 again. This gives us status of
the second column of keys.
8. Similarly we can scan all columns C2 and C3
Figure 9.4: Matrix Connection 3
19
Chapter 10
Relay
10.1 What is a Relay?
It is an electrical device, typically incorporating an electromagnet, which is activated by a cur-
rent or signal in one circuit to open or close another circuit.The Electro-mechanical Relay is
an output device (actuator) which come in a whole host of shapes, sizes and designs, and have
many uses and applications in electronic circuits. But while electrical relays can be used to al-
low low power electronic or computer type circuits to switch relatively high currents or voltages
both “ON” or “OF”, some form of relay switch circuit is required to control it.
Figure 10.1: A simple Relay
20
10.2 Pin Description of a 5 pin Relay
There are four pins present in a Relay :
• NO : Normally Open (NO), or “make” contact. It is open when the coil is de-energized
and closes when the coil is energized. It is useful in applications that must switch a single
power source of high current from a remote location.
• NC : Normally Closed (NC), or “break” contact. It is closed in the de-energized position
and opens when the coil is energized. These contacts are useful in applications that require
the circuit to remain closed, and when the relay is activated, the circuit is shut off.
• Common:. At no input state, the common (COM) is connected to (NC). When the op-
erating voltage is applied the relay coil gets energized and the COM changes contact to
(NO).
• Coils: The coil generates magnetic field when a small voltage from an electronic circuit
is applied to it. This voltage is called the “Operating voltage”.
Figure 10.2: Pin Diagram of a Relay
21
10.3 How does it works?
An iron core is surrounded by a control coil. As shown, the power source is given to the
electromagnet through a control switch and through contacts to the load. When current starts
flowing through the control coil, the electromagnet starts energizing and thus intensifies the
magnetic field. Thus the upper contact arm starts to be attracted to the lower fixed arm and
thus closes the contacts causing a short circuit for the power to the load. On the other hand,
if the relay was already de-energized when the contacts were closed, then the contact move
oppositely and make an open circuit.As soon as the coil current is off, the movable armature
will be returned by a force back to its initial position. This force will be almost equal to half
the strength of the magnetic force. This force is mainly provided by two factors. They are the
spring and also gravity.
Relays are mainly made for two basic operations. One is low voltage application and the
other is high voltage. For low voltage applications, more preference will be given to reduce the
noise of the whole circuit. For high voltage applications, they are mainly designed to reduce a
phenomenon called arcing.
Figure 10.3: Relay Internal Wiring
22
10.4 Specifications and Circuit Diagram
• 1
SPDT:This type of a relay has a total of five terminals. Out f these two are the coil
terminals. A common terminal is also included which connects to either of two others.
• DC Rating: 12V DC, 10A
• AC Rating: 220V AC, 7A
Figure 10.4: Circuit Diagram
When the relay gets activated, after the password matches then the peripheral devices
connected to it also starts working, but only one device can be operated at a time, both DC and
AC
1
Single Pole Double Throw
23
Chapter 11
Buzzer Interfacing
A buzzer connected to PORT C1 (PIN 24) of the micro controller through a driver transistor.
The buzzer requires 5 volts at a current of around 50 ma, which cannot be provided by the micro
controller. So the driver transistor is added. As soon as pin of the micro controller goes high,
the buzzer operates, it only occurs when the password is not matched and the buzzer will beep
for roughly around 8 secs.
Figure 11.1: Circuit Diagram and Implementation
24
Chapter 12
Peripheral Devices
The peripheral devices connected with our project are as follows :
• 12V DC, 0.5 Amp fan
• 220V AC, 15W bulb
Figure 12.1: Peripheral Devices
All these peripheral devices are connected to the screw connector, which in turn is connected to
the pins of a Relay and will operate one at a time.
25
Chapter 13
Software Implementation
13.1 AVR Studio 5
Atmel AVR Studio 5 is the IDE for developing and debugging embedded Atmel AVR applica-
tions. The AVR Studio 5 IDE gives us a seamless and easy-to-use environment to write, build,
and debug your C/C++ and assembler code, in our project we have used AVR Studio 5 for
building our code, and further downloading it into the MCU.
13.2 Software Code
#include <avr/io.h>
#include <inttypes.h>
#include <util/delay.h>
#include "lcd.h"
#include “keypad.h”
#include “userinterface.h”
#include “passwordmanager.h”
//LCD Backlight i/o configuration
define LCDBLPORT PORB
define LCDBLDDR DDRB
define LCDBLPIN PB1
//Output relay i/o configuration
define RELAYPORT PORTC
26
define RELAYDDR DDRC
define RELAYPIN PC0
//Simple Delay Function
void Wait(uint8t n);
//Relay Control Functions
void RelayOn();
void RelayOff();
//System Functions
void SystemInit();
void main()
{
uint16t password;
//Initialize the system
SystemInit();
while(1)
{
password=InputNumber(“Enter Password”);
//Match Password if(password==ReadPassFromEEPROM())
{
LCDClear();
LCDWriteString(“Access Granted”);
//Now Activate Relay
RelayOn();
Wait(15);
LCDClear();
LCDWriteString(“Press Any Key”);
//Now wait for any key
while(GetKeyPressed()==255)
{
delayloop2(10);
}
//Now DeActivate Relay
27
RelayOff();
Wait(2);
}
else if(password==0)
If user enters 0000 as password it indicates to change password
LCDClear();
password=InputNumber(“Old Password”);
if(password==ReadPassFromEEPROM())
{
//Allowed to change password
uint16t NewPassword;
NewPassword=InputNumber(“New Password”);
WritePassToEEPROM(NewPassword);
LCDClear();
LCDWriteString(“Success !”);
Wait(15);
}
else
//Not Allowed to change password
LCDClear();
LCDWriteString(“Wrong Password !”);
Wait(15);
}
}
else
LCDClear();
LCDWriteString(“Access Denied”);
RelayOff();
DDRC=0x02;
28
PORTC=0x02;
Wait(20);
DDRC=0x02;
PORTC=0x00;
}
}
}
void SystemInit()
//Set LCD Backlight Pin as output
LCDBLDDR|=(1«LCDBLPIN);
//Set Relay Pin as output
RELAY DDR=(1«RELAYPIN);
//Wait for LCD To Start
delay loop2(0);
LCDInit(LSNONE);
LCDClear();
LCDWriteString(“Welcome!”);
LCDBacklightOn();
LCDWriteStringXY(4,1,“NITMAS”);
Wait(15);
LCDWriteStringXY(4,0,“GROUP:11”);
Wait(15);
if(ReadPassFromEEPROM()==25755)
{
WritePassToEEPROM(1334);
}
}
void Wait(uint8t n)
uint8t i;
for(i=0;i<n;i++)
29
delayloop2(0);
}
void RelayOn()
{
RELAYPORT=(1«RELAYPIN);
} void RelayOff()
{
RELAYPORT=(1«RELAYPIN);
}
13.3 Downloading the Hex File
13.3.1 Apparatus Required
• AVR 28 pin Development Board
• USB 2.0 AVR Programmer
• USB Cable
• ISP Cable
Figure 13.1: Development Board and Programmer
30
13.3.2 Steps Involved:
1. Step 1:At first all connections are made, the programmer and the developmet board are
connected by means of the 1
ISP Cable,and a 12V DC supply is given to the development
board
2. Step 2:The USB V 2.0 programmer is then connected to the Laptop by means of a ca-
ble,after all connections are made then a “GREEN” LED will blink as shown in the figure
below.
3. Step 3:At last the HEX file created by means of AVR Stuio 5.0 is then downloaded, by
means of Prog ISP Burner Software, during the time of downloading the “RED” led will
glow as shown in the figure below
Figure 13.2: Entire Procedure
1
In System Programming
31
Chapter 14
Conclusion
When we completed this project, we had learned and understood the process of constructing a
Digital Code lock which contained hardware and software development. We also came to knew
about the micro-controller ATmega 8 and how to implement it on our project.We succeeded
in determining the faults in our circuit and rectified it accordingly. Our digital code lock per-
formed as expected. We were able to implement all the functions specified in our proposal. The
biggest hurdle we had to overcome with this project was interfacing the micro-controller with
the hardware components. We feel that this digital code lock is marketable because it is easy to
use, comparatively inexpensive due to low power consumption and highly reliable and useful in
application in any household appliance.
32
Chapter 15
Future Aspects
There were many scope for improvement, but the three major modifications which stands out
tall are as follows :
• Circuit modifications can be made to control heavy household appliances
• Portability of the circuit can be increased, with the application of SMPS, battery, or any
secondary voltage source (Portable).
• Now we are able to control both AC and DC components, but they can be used one at a
time, but certain circuit modification can be made so that simultaneously more than one
appliances can be controlled.
33
Bibliography
[1] http://www.electonicsforum.com
[2] http://www.circuitstoday.com
[3] http://www.alldatasheet.com
[4] http://www.atmel.com
[5] http://www.google.co.in/patents/WO2013088275A1
[6] Embedded Systems by Rajkamal
[7] Ansi C by Balaguruswamy
34

More Related Content

What's hot

인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼
인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼
인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼HION IT
 
Motorola ap 7131 series access point product reference guide (part no. 72 e-1...
Motorola ap 7131 series access point product reference guide (part no. 72 e-1...Motorola ap 7131 series access point product reference guide (part no. 72 e-1...
Motorola ap 7131 series access point product reference guide (part no. 72 e-1...Advantec Distribution
 
Emf2192 ib _ethercat aif module__v3-1__en
Emf2192 ib _ethercat aif module__v3-1__enEmf2192 ib _ethercat aif module__v3-1__en
Emf2192 ib _ethercat aif module__v3-1__enCharles Santos
 
Video Jet 10 Manual
Video Jet 10 ManualVideo Jet 10 Manual
Video Jet 10 Manualguest0ea020
 
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Advantec Distribution
 
Manual Hardware CLP Schneider - M258
Manual Hardware CLP Schneider - M258Manual Hardware CLP Schneider - M258
Manual Hardware CLP Schneider - M258Claudio Alves
 
Smart classethernet user_manual_en
Smart classethernet user_manual_enSmart classethernet user_manual_en
Smart classethernet user_manual_enIkundu Gatambia
 
Netgear Aircard 785S Mobile Broadband Hotspot User Guide
Netgear Aircard 785S Mobile Broadband Hotspot User GuideNetgear Aircard 785S Mobile Broadband Hotspot User Guide
Netgear Aircard 785S Mobile Broadband Hotspot User GuideTelephones Online
 
Wireless m-bus-quick-start-guide
Wireless m-bus-quick-start-guideWireless m-bus-quick-start-guide
Wireless m-bus-quick-start-guide봉조 김
 
Design of an arm based microcontroller circuit board
Design of an arm based microcontroller circuit boardDesign of an arm based microcontroller circuit board
Design of an arm based microcontroller circuit boardtuanngoc253
 

What's hot (20)

인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼
인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼
인터맥산업용PC Intermec CV61 12.1인치 차량탑재용 산업용패널PC 매뉴얼
 
Motorola ap 7131 series access point product reference guide (part no. 72 e-1...
Motorola ap 7131 series access point product reference guide (part no. 72 e-1...Motorola ap 7131 series access point product reference guide (part no. 72 e-1...
Motorola ap 7131 series access point product reference guide (part no. 72 e-1...
 
Smart otdr JDSU
Smart otdr JDSUSmart otdr JDSU
Smart otdr JDSU
 
Emf2192 ib _ethercat aif module__v3-1__en
Emf2192 ib _ethercat aif module__v3-1__enEmf2192 ib _ethercat aif module__v3-1__en
Emf2192 ib _ethercat aif module__v3-1__en
 
Jdsu mts 2000_manual
Jdsu mts 2000_manualJdsu mts 2000_manual
Jdsu mts 2000_manual
 
Video Jet 10 Manual
Video Jet 10 ManualVideo Jet 10 Manual
Video Jet 10 Manual
 
Air cam ug
Air cam ugAir cam ug
Air cam ug
 
z_remy_spaan
z_remy_spaanz_remy_spaan
z_remy_spaan
 
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
 
Manual Hardware CLP Schneider - M258
Manual Hardware CLP Schneider - M258Manual Hardware CLP Schneider - M258
Manual Hardware CLP Schneider - M258
 
Smart classethernet user_manual_en
Smart classethernet user_manual_enSmart classethernet user_manual_en
Smart classethernet user_manual_en
 
Smart classethernet user_manual_en
Smart classethernet user_manual_enSmart classethernet user_manual_en
Smart classethernet user_manual_en
 
Netgear Aircard 785S Mobile Broadband Hotspot User Guide
Netgear Aircard 785S Mobile Broadband Hotspot User GuideNetgear Aircard 785S Mobile Broadband Hotspot User Guide
Netgear Aircard 785S Mobile Broadband Hotspot User Guide
 
Thesis Report
Thesis ReportThesis Report
Thesis Report
 
安川A1000系列英文版
安川A1000系列英文版安川A1000系列英文版
安川A1000系列英文版
 
Yaskawa V1000 Instuction Manuel
Yaskawa V1000 Instuction ManuelYaskawa V1000 Instuction Manuel
Yaskawa V1000 Instuction Manuel
 
FPGA
FPGAFPGA
FPGA
 
Wireless m-bus-quick-start-guide
Wireless m-bus-quick-start-guideWireless m-bus-quick-start-guide
Wireless m-bus-quick-start-guide
 
Design of an arm based microcontroller circuit board
Design of an arm based microcontroller circuit boardDesign of an arm based microcontroller circuit board
Design of an arm based microcontroller circuit board
 
Man hinh dieu khien
Man hinh dieu khienMan hinh dieu khien
Man hinh dieu khien
 

Viewers also liked

Introduction to Avr Microcontrollers
Introduction to Avr MicrocontrollersIntroduction to Avr Microcontrollers
Introduction to Avr MicrocontrollersMohamed Tarek
 
Atmel and pic microcontroller
Atmel and pic microcontrollerAtmel and pic microcontroller
Atmel and pic microcontrollerTearsome Llantada
 
Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypadPRADEEP
 
5x7 matrix led display
5x7 matrix led display 5x7 matrix led display
5x7 matrix led display Vatsal N Shah
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded SystemsMohamed Tarek
 
A PRESENTATION ON HALF WAVE RECTIFIER
A PRESENTATION ON  HALF WAVE RECTIFIERA PRESENTATION ON  HALF WAVE RECTIFIER
A PRESENTATION ON HALF WAVE RECTIFIERSimran Singh
 
Moving message display
Moving message displayMoving message display
Moving message displayviraj1989
 
Presentation on half and full wave ractifier.ppt
Presentation on half and full wave ractifier.pptPresentation on half and full wave ractifier.ppt
Presentation on half and full wave ractifier.pptKawsar Ahmed
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Boardswarnimmaurya
 
Project report on gsm based digital notice board
Project report on gsm based digital notice boardProject report on gsm based digital notice board
Project report on gsm based digital notice boardmanish katara
 

Viewers also liked (12)

Introduction to Avr Microcontrollers
Introduction to Avr MicrocontrollersIntroduction to Avr Microcontrollers
Introduction to Avr Microcontrollers
 
Atmel and pic microcontroller
Atmel and pic microcontrollerAtmel and pic microcontroller
Atmel and pic microcontroller
 
Lcd & keypad
Lcd & keypadLcd & keypad
Lcd & keypad
 
Interfacing keypad
Interfacing keypadInterfacing keypad
Interfacing keypad
 
5x7 matrix led display
5x7 matrix led display 5x7 matrix led display
5x7 matrix led display
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded Systems
 
A PRESENTATION ON HALF WAVE RECTIFIER
A PRESENTATION ON  HALF WAVE RECTIFIERA PRESENTATION ON  HALF WAVE RECTIFIER
A PRESENTATION ON HALF WAVE RECTIFIER
 
rectifiers
rectifiersrectifiers
rectifiers
 
Moving message display
Moving message displayMoving message display
Moving message display
 
Presentation on half and full wave ractifier.ppt
Presentation on half and full wave ractifier.pptPresentation on half and full wave ractifier.ppt
Presentation on half and full wave ractifier.ppt
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Board
 
Project report on gsm based digital notice board
Project report on gsm based digital notice boardProject report on gsm based digital notice board
Project report on gsm based digital notice board
 

Similar to Final Report

Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.NandaVardhanThupalli
 
Project Report Distance measurement system
Project Report Distance measurement systemProject Report Distance measurement system
Project Report Distance measurement systemkurkute1994
 
BE Project Final Report on IVRS
BE Project Final Report on IVRSBE Project Final Report on IVRS
BE Project Final Report on IVRSAbhishek Nadkarni
 
Smart Street System
Smart Street SystemSmart Street System
Smart Street SystemLibin Thomas
 
system on chip for telecommand system design
system on chip for telecommand system designsystem on chip for telecommand system design
system on chip for telecommand system designRaghavendra Badager
 
Simocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operaçãoSimocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operaçãoconfidencial
 
Affordable EMCS for GeenHouses
Affordable EMCS for GeenHousesAffordable EMCS for GeenHouses
Affordable EMCS for GeenHousesDumidu Nadeera
 
Accident reporting system using mems
Accident reporting system using memsAccident reporting system using mems
Accident reporting system using memsRohit Sinha
 
Motorola solutions ap6522 access point installation guide wi ng 5.5 version...
Motorola solutions ap6522 access point installation guide   wi ng 5.5 version...Motorola solutions ap6522 access point installation guide   wi ng 5.5 version...
Motorola solutions ap6522 access point installation guide wi ng 5.5 version...Advantec Distribution
 
Motorola solutions ap6522 m access point installation guide wing 5.5 versio...
Motorola solutions ap6522 m access point installation guide   wing 5.5 versio...Motorola solutions ap6522 m access point installation guide   wing 5.5 versio...
Motorola solutions ap6522 m access point installation guide wing 5.5 versio...Advantec Distribution
 
Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...
Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...
Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...Advantec Distribution
 

Similar to Final Report (20)

Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.
 
Aviation Control Unit
Aviation Control UnitAviation Control Unit
Aviation Control Unit
 
Project Report Distance measurement system
Project Report Distance measurement systemProject Report Distance measurement system
Project Report Distance measurement system
 
BE Project Final Report on IVRS
BE Project Final Report on IVRSBE Project Final Report on IVRS
BE Project Final Report on IVRS
 
Smart Street System
Smart Street SystemSmart Street System
Smart Street System
 
Plc report
Plc report Plc report
Plc report
 
cl3108.pdf
cl3108.pdfcl3108.pdf
cl3108.pdf
 
system on chip for telecommand system design
system on chip for telecommand system designsystem on chip for telecommand system design
system on chip for telecommand system design
 
2D ROBOTIC PLOTTER
2D ROBOTIC PLOTTER2D ROBOTIC PLOTTER
2D ROBOTIC PLOTTER
 
wronski_ugthesis[1]
wronski_ugthesis[1]wronski_ugthesis[1]
wronski_ugthesis[1]
 
Simocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operaçãoSimocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operação
 
Affordable EMCS for GeenHouses
Affordable EMCS for GeenHousesAffordable EMCS for GeenHouses
Affordable EMCS for GeenHouses
 
Tilak's Report
Tilak's ReportTilak's Report
Tilak's Report
 
Accident reporting system using mems
Accident reporting system using memsAccident reporting system using mems
Accident reporting system using mems
 
thesis
thesisthesis
thesis
 
PLC & SCADA
PLC & SCADA PLC & SCADA
PLC & SCADA
 
Motorola solutions ap6522 access point installation guide wi ng 5.5 version...
Motorola solutions ap6522 access point installation guide   wi ng 5.5 version...Motorola solutions ap6522 access point installation guide   wi ng 5.5 version...
Motorola solutions ap6522 access point installation guide wi ng 5.5 version...
 
VENDING_MACHINE_2023-2024
VENDING_MACHINE_2023-2024VENDING_MACHINE_2023-2024
VENDING_MACHINE_2023-2024
 
Motorola solutions ap6522 m access point installation guide wing 5.5 versio...
Motorola solutions ap6522 m access point installation guide   wing 5.5 versio...Motorola solutions ap6522 m access point installation guide   wing 5.5 versio...
Motorola solutions ap6522 m access point installation guide wing 5.5 versio...
 
Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...
Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...
Motorola solutions ap 6511 access point installation guide - wi ng 5.5 versio...
 

Final Report

  • 1. Microcontroller Based Password Protected Home Appliance A project report submitted in partial fulfillment of the requirements for the degree of Bachelor of Technology in Electronics and Communication Engineering by Susmit Sarkar (Roll No. 14400311114) Under the guidance of Prof. Biplab Roy Department of Electronics and Communication Engineering Neotia Institute of Technology, Management and Science West Bengal University of Technology
  • 2. Report Approval The project report entitled Microcontroller Based Password Protected Home Appliance by Susmit Sarkar (Roll No. 14400311114) is approved for the degree of Bachelor of Technology Examiner Examiner Supervisor Head of the Department Date: Place: NITMAS
  • 3. Abstract The micro-controller based digital lock is an access control system that allows only autho- rized persons to access any restricted division. The major components include a keypad, LCD, EEPROM and the micro-controller ATmega8A-PU which belongs to the 8159 8-bit series of micro-controllers. The electronic control assembly allows the system to unlock the device with a password. A four digit pre-defined password needs to be specified by the user. A 4x3 matrix KEYPAD have been used here to set the password which is stored in the EEPROM so that we can change it at any time. While unlocking, if the entered password from keypad matches with the stored password, then the lock opens and a message is displayed on the LCD. Also an output pin is made high to be used for further purposes. As the program starts, string “Enter Password” is displayed on LCD. The keypad is scanned for pressed digits one by one. Every time row and column of the key pressed is detected and the digit is displayed on LCD. If all the four digits match with set password, LCD displays “Access Granted” and the lock output pin goes high and the led glows. If the security code is wrong, “Access Denied” is displayed in the LCD and the buzzer rings which is connected to one of the pins of the micro-controller.A relay circuit is also present by means of which we are controlling one 12V DC fan and a 15W bulb (one at a time), which will operate when the password matches. ii
  • 4. Acknowledgments I would like to take this opportunity to express my gratitude to everyone who supported us throughout the course of this B.Tech final year project.I am thankful for their aspiring guidance, invaluably constructive criticism and friendly advice during the project work.I am sincerely grateful to them for sharing their truthful and illuminating views on a number of issues related to our project.I express my warm thanks to our project mentor Prof. Biplab Roy and our Head of the Department Dr. Sujoy Biswas for their support and guidance at NITMAS.I would also like to thank Prof. Biswarup Mukherjee for suggesting us with some modifications to make our project better. Date: 20th May, 2015 Susmit Sarkar
  • 5. Declaration of Academic Ethics I declare that this written submission represents our ideas in our own words and where oth- ers’ ideas or words have been included, our have adequately cited and referenced the original sources. I declare that we have properly and accurately acknowledged all sources used in the production of this report. Ialso declare that we have adhered to all principles of academic honesty and integrity and have not misrepresented or fabricated or falsified any idea/data/fact/source in our submission.I understand that any violation of the above will be a cause for disciplinary action by the Institute and can also evoke penal action from the sources which have thus not been properly cited or from whom proper permission has not been taken when needed. Date: 20th May, 2015 Susmit Sarkar (Roll No. 14400311114)
  • 6. Contents Abstract ii List of Figures vii 1 Introduction 1 2 Flowchart Design 2 3 Block Diagram 3 3.1 Description of Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 Hardware Components 4 4.1 ATmega8 Micro-controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.2 4-Pin Push Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.3 Liquid Crystal Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.4 IC 7805 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.5 Other Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5 Circuit Diagram 7 5.1 Explaination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6 ATmega8 9 6.1 Why ATmega8? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 6.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 6.3 Pin Configuration and Explanation . . . . . . . . . . . . . . . . . . . . . . . . 10 6.4 Pin Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 v
  • 7. 7 Power Section 12 7.1 Source of Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 7.2 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 7.3 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 8 LCD Module 14 8.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 8.2 LCD Display Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 8.3 Interfacing the LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 9 Keypad Module 17 9.1 Interfacing the Keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 9.2 Matrix Keypad Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 10 Relay 20 10.1 What is a Relay? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 10.2 Pin Description of a 5 pin Relay . . . . . . . . . . . . . . . . . . . . . . . . . 21 10.3 How does it works? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 10.4 Specifications and Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . 23 11 Buzzer Interfacing 24 12 Peripheral Devices 25 13 Software Implementation 26 13.1 AVR Studio 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 13.2 Software Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 13.3 Downloading the Hex File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 13.3.1 Apparatus Required . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 13.3.2 Steps Involved: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 14 Conclusion 32 15 Future Aspects 33 References 34 vi
  • 8. List of Figures 2.1 Flowchart Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3.1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4.1 4-pin push button Layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.2 Connection of positive and negative/ground terminals. . . . . . . . . . . . . . . 5 5.1 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6.1 Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 6.2 Pin Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 7.1 Top view of the Power Section . . . . . . . . . . . . . . . . . . . . . . . . . . 12 7.2 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 8.1 Top view of LCD display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 8.2 Block Diagram along with Pin Connections . . . . . . . . . . . . . . . . . . . 15 8.3 Interface Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 8.4 LCD Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 9.1 LCD Interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 9.2 Matrix Connection 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 9.3 Matrix Connection 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 9.4 Matrix Connection 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 10.1 A simple Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 10.2 Pin Diagram of a Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 10.3 Relay Internal Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 10.4 Circuit Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 vii
  • 9. 11.1 Circuit Diagram and Implementation . . . . . . . . . . . . . . . . . . . . . . . 24 12.1 Peripheral Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 13.1 Development Board and Programmer . . . . . . . . . . . . . . . . . . . . . . 30 13.2 Entire Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 viii
  • 10. Chapter 1 Introduction Security is a prime concern in our day-to-day life.Everyone wants to be as much secure as pos- sible.The Micro-controller Based Password Protected Home Appliance is an access control system that allows only authorized persons to access an appliance.The system is fully controlled by the 8 bit micro-controller ATmega8.There is a Keypad by which the password can be entered through it.When the entered password matches with the password stored in the memory then we get access to the appliance.Presence of a stored EEPROM within the MCU which helps us to modify the password everytime we want. If the stored password doesn’t matches with the given password, the buzzer will start to make noise, and the relay will not operate. The objectives of our project are listed as below: • To protect home appliances from unauthorized persons. • We can operate both AC and DC components one at a time. • To design a keyless lock system by using electronic digital lock code. 1
  • 11. Chapter 2 Flowchart Design Figure 2.1: Flowchart Design The password is entered through the keypad.If the password matches “Access Granted” is displayed and the led glows and the relay is opened else it displays “Access denied” and the buzzer gets activated. 2
  • 12. Chapter 3 Block Diagram Figure 3.1: Block Diagram 3.1 Description of Block Diagram There micro-controller controls four modules viz. : Power, Keypad, LCD and Buzzer.The power supply module is supplying +5V(via IC 7805)to the MCU and the LCD.Three interfacing pro- grammes for LCD, Keypad and User Interfacing have been incorporated in the1 MCU.The relay is mainly used to operate any household appliances (within a fixed power rating) one at a time. 1 Micro-controller Unit 3
  • 13. Chapter 4 Hardware Components 4.1 ATmega8 Micro-controller Features: • High-performance, Low-power Atmel AVR 8-bit Microcontroller • Advanced 1 RISC Architecture • Non-volatile Memory segments • Internal Calibrated RC Oscillator(1 Mhz) • Operating Voltages 4.5V - 5.5V (ATmega8) • Speed Grades 0 - 16MHz (ATmega8) • Power Consumption at 4Mhz, 3V, 25◦ C Active: 3.6mA Idle Mode: 1.0mA 1 Reduced instruction set computer 4
  • 14. 4.2 4-Pin Push Switch The 4 pin push button has two pairs of pins on opposite sides.In this case pin 1 and pin 2 are connected to the same switch and so is pin 3 and pin 4. Figure 4.1: 4-pin push button Layout. Figure 4.2: Connection of positive and negative/ground terminals. The switch (i) connects pin 1 and pin 2 and (ii) connects pin 3 and pin 4. The push button closes both switches at once, when pressed. 4.3 Liquid Crystal Display Features: • 5 x 8 dots with cursor • Built-in controller (KS 0066) • 5V power supply 5
  • 15. • 16 Characters * 2 Line Displays • Display Mode and Backlight Variations • 2 RoHS Compliant 4.4 IC 7805 7805 is a voltage regulator integrated circuit. The voltage source in a circuit may have fluctua- tions and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. Pin Description: Pin 1:Input voltage (5V-18V) Pin 2:Ground (0V) Pin 3:Regulated output; 5V (4.8V-5.2V) 4.5 Other Components 1. Capacitor (0.1uF, 470uF) 2. Diode 3. Resistor (110Ω,4.7kΩ,330Ω) 4. Preset (10KΩ) 5. LED(3.5V DC and 0.8 Amp) 6. KS 110 Vero Board 7. Buzzer (5-30V, 7W maximum at 12Vp-p 4.0kHz) 8. Transistor (BC 548) 2 Restriction of Hazardous Substances 6
  • 16. Chapter 5 Circuit Diagram Figure 5.1: Circuit Diagram 5.1 Explaination The Main Part of the above Circuit diagram is the micro-controller ATmega8. The Keypad is the input device and it is connected in a matrix format so that the numbers of ports needed are reduced. The micro-controller reads a four-digit password through the Keypad. Then the micro-controller compares the four digit password with the number which is pre-programmed and if it is equal then the micro-controller will switch on the relay for the appliance. The 7
  • 17. Password is stored in the 1 EEPROM and the password can be changed at any time using the same keypad.The power module should deliver constant output regulated power supply of 5V for successful working of the project.For this IC 7805 voltage regulator is used, which supplies power to the entire circuitry after downgrading the voltage from 12V DC.The stored EEPROM within the MCU helps us to modify the password every time we want. If the stored password doesn’t matches with the given password, the buzzer connected to Pin 24 will start to make noise, and the relay will not operate. The entire circuit is divided into 4 modules: • Power Section Module • LCD Module • Keypad Module • Relay Section All this modules are being interfaced with the ATmega8 microcontroller, which are being dis- cussed as we move further in this report. 1 Electrically Erasable Programmable Read-Only Memory 8
  • 18. Chapter 6 ATmega8 6.1 Why ATmega8? • Added EEPROM to store data over a power off time. • An internal oscillator and an internal power on reset make the AVR working without any other components. • Due to the EEPROM, we can change the passwords any number of time. • The AVR is optimized for C-programming. • It allows programming and serial communication over 1 USB. 6.2 Features • High-performance, Low-power Atmel AVR 8-bit Microcontroller • Advanced RISC Architecture • Non-volatile Memory segments • Internal Calibrated RC Oscillator(1 Mhz) • Operating Voltages 4.5V - 5.5V (ATmega8) 1 Universal Serial Bus 9
  • 19. • Speed Grades 0 - 16MHz (ATmega8) • Power Consumption at 4Mhz, 3V, 25◦ C Active: 3.6mA Idle Mode: 1.0mA 6.3 Pin Configuration and Explanation Figure 6.1: Pin Configuration • Port B (PB7..PB0): It is a 8 bit Bi-directional,2 tri-stated I/O port with internal pull up resistors. • Port C (PC5..PC0): Used as an 7-bit bi-directional I/O port with internal pull-up resis- tors. • PC6: Used as an I/O pin, a low level on this pin for longer than the minimum pulse length will generate a Reset. • Port D (PD7..PD0): It is an 8-bit bi-directional I/O port with internal pull-up resistors. 2 Tri-state, or 3-state logic allows output ports to assume a high impedance state in addition to the fundamental 0 and 1 levels, effectively removing the output from the circuit. This allows multiple circuits to share the same output line or lines (such as a bus). 10
  • 20. • RESET: A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. • AREF: It is the analog reference pin for the A/D Converter. 6.4 Pin Mapping Figure 6.2: Pin Mapping • Port B (PB7..PB0): This pins are mapped to mapped to the pins of LCD, except PB6 and PB7. • Port C (PC5..PC0): PC0 and PC1 are used as an interfacing port to Buzzer and Relay Pins, ports PC2 to PC5 are unused and can be used for further modifications. • PC6: This is a reset pin • Port D (PD7..PD0): This pins are mapped to the Keypad Module • AREF and AVCC:They have an external LC Oscillator attached to it, which produces a frequency for the MCU to work properly. 11
  • 21. Chapter 7 Power Section 7.1 Source of Power There were a few options available to us. We can either use batteries, a wall adapter, or a 1 SMPS. In our case we will be using a wall adapter, to power our whole circuitry, although SMPS or a battery can be used in order to increase the portability.A 12V DC adapter is used in this case, to power the circuit, proper arrangements were also made to protect the MCU from high voltage over 5V. Figure 7.1: Top view of the Power Section 1 Switched Mode Power Supply 12
  • 22. 7.2 Components • Capacitor(0.1uF, 470uF) • Diode • Resistor(330Ω) • LED (3.5V DC and 0.8 Amp) • Push Switch • Power Socket • IC 7805 7.3 Circuit Diagram Figure 7.2: Circuit Diagram Here, IC 7805 plays a pivotal role, it downgrades the 12V DC supply from the mains to a constant 5V DC thereby protects the micro-controller from damage against overflow of current. Here in this circuit the capacitors are acts as an Filter in this circuit.The ceramic capacitor opposes the AC signal to flow through or appear at the output terminal.Here the Capacitors are used across regulator in-order to obtain the stability.Ceramic capacitors handle noise and fast transients. 13
  • 23. Chapter 8 LCD Module 8.1 Features The main features of the LCD are as follows : • 5 x 8 dots with cursor • Built-in controller (KS 0066) • 5V power supply • 16 Characters * 2 Line Displays • Display Mode and Backlight Variations • RoHS Compliant Figure 8.1: Top view of LCD display 14
  • 24. 8.2 LCD Display Interface The dot-matrix liquid crystal display controller and driver LSI displays alphanumeric, charac- ters, and symbols. It can be configured to drive a dot-matrix liquid crystal display under the control of a 4 or 8-bit microprocessor. Since all the functions such as display RAM, character generator, and liquid crystal driver, required for driving a dot-matrix liquid crystal display are internally provided on one chip, a minimal system can be interfaced with this controller/driver. A single HD44780U can display up to two 8-character lines (16 x 2).Micro controller send the data signals through pin 11 through 18 (RC0-RC3) and control signal through 4,6 and 7 of the micro controller. Pin no 3 of the LCD is used to control the contrast by using preset PR1. Figure 8.2: Block Diagram along with Pin Connections Figure 8.3: Interface Pin Description 15
  • 25. 8.3 Interfacing the LCD Port PB0-PB5 is being interfaced with the pins of the LCD. The transistor Q1 acts as a pull up transistor, which boosts the voltage from Pin 15 (Port PB1), to turn the LCD backlight ON. A 10 kΩ preset is adjusted to get a proper LED display. Figure 8.4: LCD Interfacing 16
  • 26. Chapter 9 Keypad Module 9.1 Interfacing the Keypad The port PD0-PD7 is mapped with the eight interconnects of the Keypad.Port PD0-PD3 corre- sponds to the row of the 4X3 matrix, whereas the port PD4-PD7 corresponds to the column of the same matrix. Figure 9.1: LCD Interfacing 17
  • 27. 9.2 Matrix Keypad Connection The Keypad is the input device and it is connected in a matrix format so that the numbers of ports needed are reduced.The matrix keypad is established in the following manner : 1. The rows R0 to R3 and C0 to C3 are connected to i/o pins of Micro-controller, by setting the DDR they are connected and made Input/output. 2. At first Columns are kept at High Impedance State. And in their PORT value we set them all as LOW. 3. One by One we make each Column LOW (from high Z state) and read state of R0 to R3. Figure 9.2: Matrix Connection 1 4. C0 is made LOW while all other Columns are in HIGH Z State. 5. But when a key is pressed it is connected to LOW line from the column thus making it LOW. Figure 9.3: Matrix Connection 2 18
  • 28. 6. If ROWS are high the button is NOT pressed. 7. C0 High Z again and make C1 LOW. And read R0 to R3 again. This gives us status of the second column of keys. 8. Similarly we can scan all columns C2 and C3 Figure 9.4: Matrix Connection 3 19
  • 29. Chapter 10 Relay 10.1 What is a Relay? It is an electrical device, typically incorporating an electromagnet, which is activated by a cur- rent or signal in one circuit to open or close another circuit.The Electro-mechanical Relay is an output device (actuator) which come in a whole host of shapes, sizes and designs, and have many uses and applications in electronic circuits. But while electrical relays can be used to al- low low power electronic or computer type circuits to switch relatively high currents or voltages both “ON” or “OF”, some form of relay switch circuit is required to control it. Figure 10.1: A simple Relay 20
  • 30. 10.2 Pin Description of a 5 pin Relay There are four pins present in a Relay : • NO : Normally Open (NO), or “make” contact. It is open when the coil is de-energized and closes when the coil is energized. It is useful in applications that must switch a single power source of high current from a remote location. • NC : Normally Closed (NC), or “break” contact. It is closed in the de-energized position and opens when the coil is energized. These contacts are useful in applications that require the circuit to remain closed, and when the relay is activated, the circuit is shut off. • Common:. At no input state, the common (COM) is connected to (NC). When the op- erating voltage is applied the relay coil gets energized and the COM changes contact to (NO). • Coils: The coil generates magnetic field when a small voltage from an electronic circuit is applied to it. This voltage is called the “Operating voltage”. Figure 10.2: Pin Diagram of a Relay 21
  • 31. 10.3 How does it works? An iron core is surrounded by a control coil. As shown, the power source is given to the electromagnet through a control switch and through contacts to the load. When current starts flowing through the control coil, the electromagnet starts energizing and thus intensifies the magnetic field. Thus the upper contact arm starts to be attracted to the lower fixed arm and thus closes the contacts causing a short circuit for the power to the load. On the other hand, if the relay was already de-energized when the contacts were closed, then the contact move oppositely and make an open circuit.As soon as the coil current is off, the movable armature will be returned by a force back to its initial position. This force will be almost equal to half the strength of the magnetic force. This force is mainly provided by two factors. They are the spring and also gravity. Relays are mainly made for two basic operations. One is low voltage application and the other is high voltage. For low voltage applications, more preference will be given to reduce the noise of the whole circuit. For high voltage applications, they are mainly designed to reduce a phenomenon called arcing. Figure 10.3: Relay Internal Wiring 22
  • 32. 10.4 Specifications and Circuit Diagram • 1 SPDT:This type of a relay has a total of five terminals. Out f these two are the coil terminals. A common terminal is also included which connects to either of two others. • DC Rating: 12V DC, 10A • AC Rating: 220V AC, 7A Figure 10.4: Circuit Diagram When the relay gets activated, after the password matches then the peripheral devices connected to it also starts working, but only one device can be operated at a time, both DC and AC 1 Single Pole Double Throw 23
  • 33. Chapter 11 Buzzer Interfacing A buzzer connected to PORT C1 (PIN 24) of the micro controller through a driver transistor. The buzzer requires 5 volts at a current of around 50 ma, which cannot be provided by the micro controller. So the driver transistor is added. As soon as pin of the micro controller goes high, the buzzer operates, it only occurs when the password is not matched and the buzzer will beep for roughly around 8 secs. Figure 11.1: Circuit Diagram and Implementation 24
  • 34. Chapter 12 Peripheral Devices The peripheral devices connected with our project are as follows : • 12V DC, 0.5 Amp fan • 220V AC, 15W bulb Figure 12.1: Peripheral Devices All these peripheral devices are connected to the screw connector, which in turn is connected to the pins of a Relay and will operate one at a time. 25
  • 35. Chapter 13 Software Implementation 13.1 AVR Studio 5 Atmel AVR Studio 5 is the IDE for developing and debugging embedded Atmel AVR applica- tions. The AVR Studio 5 IDE gives us a seamless and easy-to-use environment to write, build, and debug your C/C++ and assembler code, in our project we have used AVR Studio 5 for building our code, and further downloading it into the MCU. 13.2 Software Code #include <avr/io.h> #include <inttypes.h> #include <util/delay.h> #include "lcd.h" #include “keypad.h” #include “userinterface.h” #include “passwordmanager.h” //LCD Backlight i/o configuration define LCDBLPORT PORB define LCDBLDDR DDRB define LCDBLPIN PB1 //Output relay i/o configuration define RELAYPORT PORTC 26
  • 36. define RELAYDDR DDRC define RELAYPIN PC0 //Simple Delay Function void Wait(uint8t n); //Relay Control Functions void RelayOn(); void RelayOff(); //System Functions void SystemInit(); void main() { uint16t password; //Initialize the system SystemInit(); while(1) { password=InputNumber(“Enter Password”); //Match Password if(password==ReadPassFromEEPROM()) { LCDClear(); LCDWriteString(“Access Granted”); //Now Activate Relay RelayOn(); Wait(15); LCDClear(); LCDWriteString(“Press Any Key”); //Now wait for any key while(GetKeyPressed()==255) { delayloop2(10); } //Now DeActivate Relay 27
  • 37. RelayOff(); Wait(2); } else if(password==0) If user enters 0000 as password it indicates to change password LCDClear(); password=InputNumber(“Old Password”); if(password==ReadPassFromEEPROM()) { //Allowed to change password uint16t NewPassword; NewPassword=InputNumber(“New Password”); WritePassToEEPROM(NewPassword); LCDClear(); LCDWriteString(“Success !”); Wait(15); } else //Not Allowed to change password LCDClear(); LCDWriteString(“Wrong Password !”); Wait(15); } } else LCDClear(); LCDWriteString(“Access Denied”); RelayOff(); DDRC=0x02; 28
  • 38. PORTC=0x02; Wait(20); DDRC=0x02; PORTC=0x00; } } } void SystemInit() //Set LCD Backlight Pin as output LCDBLDDR|=(1«LCDBLPIN); //Set Relay Pin as output RELAY DDR=(1«RELAYPIN); //Wait for LCD To Start delay loop2(0); LCDInit(LSNONE); LCDClear(); LCDWriteString(“Welcome!”); LCDBacklightOn(); LCDWriteStringXY(4,1,“NITMAS”); Wait(15); LCDWriteStringXY(4,0,“GROUP:11”); Wait(15); if(ReadPassFromEEPROM()==25755) { WritePassToEEPROM(1334); } } void Wait(uint8t n) uint8t i; for(i=0;i<n;i++) 29
  • 39. delayloop2(0); } void RelayOn() { RELAYPORT=(1«RELAYPIN); } void RelayOff() { RELAYPORT=(1«RELAYPIN); } 13.3 Downloading the Hex File 13.3.1 Apparatus Required • AVR 28 pin Development Board • USB 2.0 AVR Programmer • USB Cable • ISP Cable Figure 13.1: Development Board and Programmer 30
  • 40. 13.3.2 Steps Involved: 1. Step 1:At first all connections are made, the programmer and the developmet board are connected by means of the 1 ISP Cable,and a 12V DC supply is given to the development board 2. Step 2:The USB V 2.0 programmer is then connected to the Laptop by means of a ca- ble,after all connections are made then a “GREEN” LED will blink as shown in the figure below. 3. Step 3:At last the HEX file created by means of AVR Stuio 5.0 is then downloaded, by means of Prog ISP Burner Software, during the time of downloading the “RED” led will glow as shown in the figure below Figure 13.2: Entire Procedure 1 In System Programming 31
  • 41. Chapter 14 Conclusion When we completed this project, we had learned and understood the process of constructing a Digital Code lock which contained hardware and software development. We also came to knew about the micro-controller ATmega 8 and how to implement it on our project.We succeeded in determining the faults in our circuit and rectified it accordingly. Our digital code lock per- formed as expected. We were able to implement all the functions specified in our proposal. The biggest hurdle we had to overcome with this project was interfacing the micro-controller with the hardware components. We feel that this digital code lock is marketable because it is easy to use, comparatively inexpensive due to low power consumption and highly reliable and useful in application in any household appliance. 32
  • 42. Chapter 15 Future Aspects There were many scope for improvement, but the three major modifications which stands out tall are as follows : • Circuit modifications can be made to control heavy household appliances • Portability of the circuit can be increased, with the application of SMPS, battery, or any secondary voltage source (Portable). • Now we are able to control both AC and DC components, but they can be used one at a time, but certain circuit modification can be made so that simultaneously more than one appliances can be controlled. 33
  • 43. Bibliography [1] http://www.electonicsforum.com [2] http://www.circuitstoday.com [3] http://www.alldatasheet.com [4] http://www.atmel.com [5] http://www.google.co.in/patents/WO2013088275A1 [6] Embedded Systems by Rajkamal [7] Ansi C by Balaguruswamy 34