Vous êtes sur la page 1sur 10

PROJECT REPORT

DIGITAL CODE LOCK SYSTEM


INDEX

SERIAL NO. TOPIC PAGE NO.


1 INTRODUCTION 2

2 BLOCK DIAGRAM 3

3 AT89C2051 MICROCONTROLLER 4

4 16X2 LCD 5

5 4X3 KEY PAD 6

6 CIRCUIT DIAGRAM 8

7 RESULT 14

8 BIBLIOGRAPHY 14
INTRODUCTION:

I simple project with efficient hacking prevention from Brute Force etc. The basic
user lock is of 5 Digits and Master Lock is of 10 digits so its not easy for an
intruder to break the lock unless you keep the code simple.
The input is taken from a 4x3 Keypad (please see the schematic for more
information) and Display the user input on a 2x16 LCD. A pin is assigned as
output for activating and deactivating the lock. For demonstration I have connected
an LED to that pin.

User Side working:


The user has two options either he/she can use its own 5 digit code or use the
default 5 digit code. If user has to do setup his own code, then he has to enter
“12345” and press ‘#’. After this.. controller will ask for 10 Digit master password
which is preprogrammed in the controller. Entering master lock, user can enter the
new 5 digit code for the lock and press ‘#’ to save it.

Using the Keypad:


Keypad has 12 keys (4x3) starting from 1,2,3,4,5,6,7,8,9,*,0,# (please see the
schematic for layout). Numeric keys are used for entering numbers. ‘*’ is used as
the Cancel key and ‘#’ is used as the Enter key.
BLOCK DIAGRAM:

USER ENTER
MASTER PASSWORD 3 USER ENTERS PASSWORD
PASSWORD TIMES PASSWORD INCORRECT
INCORRECT

PASSWORD
USER ENTER CORRECT
PASSWORD

LOCK OPEN
AND LED ON
AT 89C2051 MICROCONTROLLER

The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcontroller


with 2K bytes of Flash programmable and erasable read-only memory (PEROM).
The device is manufactured using Atmel’s high-density nonvolatile memory
technology and is compatible with the industry-standard MCS-51 instruction set.
By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel
AT89C2051 is a powerful microcomputer which provides a highly-flexible and
cost-effective solution to many embedded control applications. The AT89C2051
provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15
I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a
full duplex serial port, a precision analog comparator, on-chip oscillator and clock
circuitry. In addition, the AT89C2051 is designed with static logic for operation
down to zero frequency and supports two software selectable power saving modes.
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 hardware reset.

PIN DESCRIPTION
16X2 LCD
The most commonly used Character based LCDs are based on Hitachi's HD44780 controller or
other which are compatible with HD44580. In this tutorial, we will discuss about character based
LCDs, their interfacing with various microcontrollers, various interfaces (8-bit/4-bit),
programming, special stuff and tricks you can do with these simple looking LCDs which can
give a new look to your application.

Pin Description

The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs
which have only 1 controller and support at most of 80 characters, whereas LCDs supporting
more than 80 characters make use of 2 HD44780 controllers. Most LCDs with 1 controller has
14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in both for back-light LED
connections). Pin description is shown in the table below.

Pin No. Name


Description
Pin no. 1 D7Data bus line 7 (MSB)
Pin no. 2 D6Data bus line 6
Pin no. 3 D5Data bus line 5
Pin no. 4 D4Data bus line 4
Pin no. 5 D3Data bus line 3
Pin no. 6 D2Data bus line 2
Pin no. 7 D1Data bus line 1
Pin no. 8 D0Data bus line 0 (LSB)
Pin no. 9 Enable signal for row 0 and 1 (1stcontroller)
EN1
0 = Write to LCD module
Pin no. 10 R/W
1 = Read from LCD module
0 = Instruction input
Pin no. 11 RS
1 = Data input
Pin no. 12 VEE Contrast adjust
Pin no. 13 VSS Power supply (GND)
Pin no. 14 VCC Power supply (+5V)
Pin no. 15 EN2 Enable signal for row 2 and 3 (2ndcontroller)
Pin no. 16 NC Not Connected

Character LCD pins with 2 Controller


4X3 KEYPAD
Introduction

Keypads are a part of HMI or Human Machine Interface and play really important
role in a small embedded system where human interaction or human input is
needed. Martix keypads are well known for their simple architecture and ease of
interfacing with any microcontroller. In this part of tutorial we will learn how to
interface a 4x4 matrix keypad with AVR and 8051 microcontroller. Also we will
see how to program then in Assembly and C.

Constructing a Matrix Keypad

Construction of a keypad is really simple. Here we give an example of 4*4 keypad


although the construction of 4*3 keypad is also the same one. The last column is
missing in 4*3 keypad. As per the outline shown in the figure below we have four
rows and four columns. In between each overlapping row and column line there is
a key.

So keeping this outline we can construct a keypad using simple SPST Switches as
shown below:
Now our keypad is ready, all we have to do is connect the rows and columns to a
port of microcontroller and program the controller to read the input.

Scanning a Matrix Keypad

There are many methods depending on how you connect your keypad with your
controller, but the basic logic is same. We make the coloums as i/p and we drive
the rows making them o/p, this whole procedure of reading the keyboard is called
scanning.

In order to detect which key is pressed from the matrix, we make row lines low one
by one and read the columns. Lets say we first make Row1 low, then read the
columns. If any of the key in row1 is pressed will make the corresponding column
as low i.e. if second key is pressed in Row1, then column2 will give low. So we
come to know that key 2 of Row1 is pressed. This is how scanning is done.

.
CIRCUIT DIAGRAM:
RESULT

When user enters correct password then lock system is deactivated and lock is
open. When user enters incorrect password then lock does not open and user has to
enter password again to open lock. If user enters incorrect password three times
then user has to enter master password which is 10 digit long and then password is
enter again to open the lock.

BIBLIOGRAPHY

1. The 8088 and 8086 Microprocessor(programming, Software, Hardware, and


Applications) By Walter A. Triebel and Avtar Singh.
2. The 8051 Microcontroller By Scott Mackenzie.
3. Wikipedia (www.wikipedia.org).
4. Google (www.google.com.pk).

Click the link below to download the code and other attachments

Vous aimerez peut-être aussi