You are on page 1of 25

Table of Contents

I. Abstract..................................................................................................................2
II. Introduction and overview................................................................................3
B. Purpose of our product:....................................................................................3
III. Approach to the project problem......................................................................4
A. Structure of our system.....................................................................................4
B. Hardware...........................................................................................................5
C. Software............................................................................................................5
IV. Details about partial devices..............................................................................6
A. ATMEGA 8.......................................................................................................6
B. LCD 16x2.........................................................................................................7
C. Relay.................................................................................................................8
D. Transistor BJT NPN C1815..............................................................................9
Features..............................................................................................................9
E. Electronic Lock..............................................................................................10
F. H-bridge circuit with 4 Relays.......................................................................10
V. System design.....................................................................................................12
A. Hardware........................................................................................................12
Block diagram of master unit..............................................................................17
VI. Result of our system design............................................................................24
VII. Conclusion.....................................................................................................24
VII. Reference.......................................................................................................24

Chapter I. Abstract
Digital design is an very important subject on this semester . The subject consist of
many knowledge of other subject like : electronics , microprocessor, algorithm for
engineer . In order to practice what we have learn, the project give us a chance to
get familiar and understand our theory in digital design subject. Because of all that
reason, my group have choose a project required many skill and included many
object in digital design subject. After finished this project , we feel very confident
with our skill, and think that we still can development our project further.

Chapter II.

Introduction and overview

A. Introduction about code lock :

Digital Code Lock using ATMEGA8 is a basic control system with an ability that
allows the rightful user to deploy platform to any property that require simple
password protection.
This code can be changed by the user. This circuit is eminently suitable as a digital
code lock.
Digital code lock is a type of lock in which a sequence numbers is used to open
the lock.
This type of lock use numerical code for authentication where the correct code
must be entered in order for the lock to deactivate.
The lock can be use with an outdoor gate or a normal door. The functionality of
this lock implemented in software.

B. Purpose of our product:

There are great varieties of digital code locks. Generally speaking, they can be
classified into scores of type, such as electronic lock, fingerprint lock, card lock
biological lock, etc.
This kind of lock can avoiding the problems caused by the copying of keys.
It is because the keys people carry have become burden most of the time, but by
contrast people need only to remember a set of codes for electronics locks and
dont have to carry any key, thus freeing themselves from worries.
On the premise that its safety is high, its another feature without key is getting
more and more favour of people.
Among them the most practical and the most popularized one come to digital code
lock.

C. Application
The term access control refers to the practice of restricting entrance to a property, a
building or a room to authorized persons. Integrated and controller based access control
numeric and alphabetic keyless entry keypads with programmable features for the access
control of single openings. The various applications are asfollows :
Industrial facilities, Long term care facilities
Commercial buildings,
Airports, civil transportation
Convention halls
Psychiatric care centres, Drug rehabilitation centres
Museums and fine art galleries, Government and military
Ware houses, Technology centres

Chapter III. Approach to the project problem


A. Structure of our system

In our system we design an electronic lock can protect any electrical device. The user
must enter a correct password to gain access . The password is entered using the built in
44 keypad matrix. The main LCD Module is used to display messages to the user. As
soon as correct password is entered the relay is activated. This is indicated by a LED
which is placed near the relay. The relay remains on as long as the user wishes. You just
need to press a key to deactivate the relay.
After typing four digit password you must press the "OK" button . At anytime you may
press the "Cancel" key to clear the input (e.g. when you enter any incorrect digit)
The smart code lock has the feature to change the password too. For this enter a special
password which is 0000, as soon as the system receives this special password it
switches to change password mode. Here you need to enter the old password to gain
permission, then enter the new password.

B. Hardware
ATmega8 microprocessor ( cheap, popular, have many peripheral interface)
LCD 16x2 display
Keypad 4x4
Electronic Lock
4 Relays
Transistor BJT NPN C 1815

C. Software
Complier : AVR studio
PCB designer : Altium design

Chapter IV. Details about partial devices


A. ATMEGA 8
The AtmelAVR ATmega8 is a low-power CMOS 8-bit microcontroller based on the
AVR RISC architecture. By executing powerful instructions in a single clock cycle, the
ATmega8 achieves throughputs approaching 1MIPS per MHz, allowing the system
designer to optimize power consumption versus processing speed.
Features
High-performance, Low-power AtmelAVR 8-bit Microcontroller
Advanced RISC Architecture
130 Powerful Instructions Most Single-clock Cycle Execution
32 8 General Purpose Working Registers
Fully Static Operation
Up to 16MIPS Throughput at 16MHz
On-chip 2-cycle Multiplier
I/O and Packages
23 Programmable I/O Lines
28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF
Operating Voltages
2.7V - 5.5V (ATmega8L)
4.5V - 5.5V (ATmega8)
Speed Grades
0 - 8MHz (ATmega8L)
0 - 16MHz (ATmega8)
Power Consumption at 4Mhz, 3V, 250 C
Active: 3.6mA
Idle Mode: 1.0mA
Power-down Mode: 0.5A

B. LCD 16x2

Description
- The HD44780U dot-matrix liquid crystal display controller and driver LSI displays
alphanumerics, Japanese kana characters, 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 one 8-character line or two 8-character lines.
Registers
-The HD44780U has two 8-bit registers, an instruction register (IR) and a data register
(DR).
-The IR stores instruction codes, such as display clear and cursor shift, and address
information for display data RAM (DDRAM) and character generator RAM (CGRAM).
The IR can only be written from the MPU.
-The DR temporarily stores data to be written into DDRAM or CGRAM and temporarily
stores data to be read from DDRAM or CGRAM. Data written into the DR from the
MPU is automatically written into DDRAM or CGRAM by an internal operation. The
DR is also used for data storage when reading data from DDRAM or CGRAM. When
address information is written into the IR, data is read and then stored into the DR from
DDRAM or CGRAM by an internal operation. Data transfer between the MPU is then
completed when the MPU reads the DR. After the read, data in DDRAM or CGRAM at
the next address is sent to the DR for the next read from the MPU. By the register
selector (RS) signal, these two registers can be selected (Table 1).
Busy Flag (BF)
-When the busy flag is 1, the HD44780U is in the internal operation mode, and the next
instruction will not be accepted. When RS = 0 and R/W = 1 (Table 1), the busy flag is
output to DB7. The next instruction must be written after ensuring that the busy flag is 0.

Address Counter (AC)


- The address counter (AC) assigns addresses to both DDRAM and CGRAM. When an
address of an instruction is written into the IR, the address information is sent from the IR
to the AC. Selection of either DDRAM or CGRAM is also determined concurrently by
the instruction.
- After writing into (reading from) DDRAM or CGRAM, the AC is automatically
incremented by 1
(decremented by 1). The AC contents are then output to DB0 to DB6 when RS = 0 and
R/W = 1 (Table 1).

C. Relay

An electromagnetic relay is a type of electrical switch controlled


by an electromagnet. It is used in a variety of applications,
including alarms and sensors, signal switching, and the detection
and control of faults on electrical distribution lines. This device
was invented in 1835, and its straightforward function has not
changed much since. Consumers interact with electromagnetic
relays in a variety of forms daily, from timed office lights to test
buttons and other quality control devices.
The core of the electromagnetic relay, naturally, is an
electromagnet, formed by winding a coil around an iron core.
When the coil is energized by passing current through it, the core
in turn becomes magnetized, attracting a pivoting iron armature.
As the armature pivots, it operates one or more sets of contacts,
thus affecting the circuit. When the magnetic charge is lost, the
armature and contacts are released. Demagnetization can cause
a leap of voltage across the coil, damaging other components of
8

the device when turned off. Therefore, the relay usually makes
use of a diode to restrict the flow of the charge, with the cathode
connected at the most positive end of the coil.
Contacts on an electromagnetic relay can take three forms.
Normally opened contacts connect the circuit when the device is
activated and disconnect it when the device is not active, like a
light switch. Normally closed contacts disconnect the circuit when
the relay is magnetized, and a change-over incorporates one of
each type of contact. The configuration of the contacts is
dependant upon the intended application of the device.
The electromagnetic relay is capable of controlling an output of
higher power than the input, and it is often used as a buffer to
isolate circuits of varying energy potentials as a result. When a
low current is applied to the electromagnet, throwing the switch,
the device is capable of allowing a higher current to flow through
it. This is advantageous in some applications, such as tripping
alarms and other safety devices, because a safer low current can
be used to activate an application requiring more energy.

D. Transistor BJT NPN C1815

Features
Collector-Emitter Volt (Vceo): 50V
Collector-Base Volt (Vcbo): 60V
Collector Current (Ic): 0.15A
hfe: 70-700 @ 2mA
9

Power Dissipation (Ptot): 400mW


Current-Gain-Bandwidth (ftotal): 80MHz
Type: NPN

E. Electronic Lock
F. H-bridge circuit with 4 Relays
H-Bridge with switches:

Do not make circuit A. It can easily create a SHORT-CIRCUIT. It is only a


demonstration circuit.
Switch A and D will make the motor rotate clockwise.
Switch B and C will make the motor rotate anti-clockwise.
Switch A and B will create a BRAKE.
Do not close switch A and C at the same time.
Do not close switch B and D at the same time.
An improved design is shown in Circuit C. It does not create any short-circuit:

10

H-bridge circuit with 4 Relays

11

Chapter V. System design


A.

Hardware

We set up our system into 3 part : Suply , Micro controller , Electronic Lock.
Suply

The LM2576 Series of regulators are monolithic integrated circuits that provide all
the active functions for a step-down (buck) switching regulator, capable of driving
3A load with excellent line and load regulation. These devices are available in
fixed output voltages of 3.3V, 5V, 12V, 15V, and an adjustable output version.
Requiring a minimum number of external components, these regulators are simple
to use and include internal frequency compensation and a fixedfrequency
oscillator.
The LM2576 series offers a high-efficiency replacement for popular three-terminal
linear regulators. It substantially reduces the size of the heat sink, and in some
cases no heat sink is required.
A standard series of inductors optimized for use with the LM2576 are available
from several different manufacturers. This feature greatly simplifies the design of
switch-mode power supplies.
Other features include a specified 4% tolerance on output voltage within
specified input voltages and output load conditions, and 10% on the oscillator
frequency. External shutdown is included, featuring 50 A (typical) standby
current. The output switch includes cycle-by-cycle current limiting, as well as
thermal shutdown for full protection under fault conditions.

12

Micro controller

Microcontroller
Definition:
An embedded microcontroller is chip which has a computer processor with all its support
functions (clock & reset), memory (both program and data), and I/O(including bus
interface) built in to the device. These built in function minimize the need for external
circuitsand devices to be designed in the final application.
Types of Microcontroller
Creating application for microcontrollers is completely different than any other
development job in computing and electronics. In most other application one probably
have a number of subsystems and interface already available for his/her use. This is not
the case with a microcontroller where one is responsible forPower distribution
System clocking
Interface design and wiring
System programming
Application programming
Device programming

13

PCB:
Power Suply Board

14

Micro Controller Board

15

16

Block diagram of master unit

17

B. Software
1. KeyPad

18

2. H bridge circuit with 4 Relays to change direction of the current

19

3. Declare the default value of the initial password


uint16_t EEMEM pass1 = 1111;

4. Main Program

20

21

22

23

5. Flow Chart (The way its work )

24

Chapter VI. Result of our system design


Our system design work well on both simulation and real pcb circuit. All video
recorded our project result have added to project file.

Chapter VII. Conclusion


In order to get those results, we would like to express our deep gratitude to
Professor Nguyn Cnh Quang Dung for putting the group together and helping us
throughout the project. Beside his diligent and easily-understand instructions,
meticulous preparation, and top-quality support and information, his attitude also
lent us a fresh perspective to the subject of Digital design subject. After finished
our project , we got more knowledge about Thermo measurement system and
microprocessor AVR and many peripheral interface , and have the chances to
practice what we learn in lectures This is very useful experience for us to work
well in the future.

Reference
-

www.alldatasheet.com/LCD+datasheet
www.alldatasheet.com/Atmega8+datasheet
www.alldatasheet.com/C1815+datasheet

25

You might also like