SlideShare una empresa de Scribd logo
1 de 69
Descargar para leer sin conexión
CHAPTER-1
INTRODUCTION
In this project there will be usage of the biometric material ―FINGER PRINT
MODULE‖ , ―GSM MODULE‖ and ―KEYPAD‖ and there will be XMEGA 256A3BU
microcontroller with the AVR dragon for this dragon is used for the dumping of the code and
here we are using ATMEL STUDIO 6.2 software and for the finger print module software
used is ―DOCKLIGHT‖.
1.1 AIM:
Our main aim our project is to give very high security to the important
materials because conventional locks are broken by the seasoned thieves and
they were stealing important materials.
1.2 MOTIVATION:
Since, so many robberies happening in and around world and so many important
things or materials are stolen and in a room if there is computer files are corrupted trough the
entering of that particular door. hence, we get motivated to design this particular project ,so
that unauthorized person can enter into that room without the permission of the authorized
person.
1.3 OBJECTIVE:
The main objective of our project is to design an intelligent and programmable system
by using FINGER PRINT MODULE and KEYPAD MODULE and also GSM MODE for
high security area, by using XMEGA 256A3BU microcontroller. Only authorized person can
enter into the room. In this project we are having three modules, Fingerprint module and GSM
mode with two level security. The main objective of this project is that it provides very high
security. The main documents will not be corrupted and also there will be protection to our
important things which are placed in the room.
1
Hence, we can allow only the authorized person to enter into the room and there will
be three modes in our project they are :
1.) Finger print mode.
2.) Keypad mode.
3.) GSM activated keypad mode.
And hence with these three modes person(i.e.Authorized person) can enter into the
room and if the person cannot enter into the room then the control goes to ―selection of the
mode‖ which will be displaying on screen.
This is the main objective of our project and it is mainly used for the very high
security purpose in which important things will not lost.
2
CHAPTER-2
INTRODUCTION TO THE EMBEDDED SYSTEMS
2.1 Embedded system:
An embedded system is a special-purpose system in which the computer is completely
encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose
computer, such as a personal computer, an embedded system performs one or a few
predefined tasks, usually with very specific requirements. Since the system is dedicated to
specific tasks, design engineers can optimize it, reducing the size and cost of the product.
Embedded systems are often mass-produced, benefiting from economies of scale. Personal
digital assistants (PDAs) or handheld computers are generally considered embedded devices
because of the nature of their hardware design, even though they are more expandable in
software terms. This line of definition continues to blur as devices expand. With the
introduction of the OQO Model 2 with the Windows XP operating system and ports such as a
USB port — both features usually belong to "general purpose computers", — the line of
nomenclature blurs even more Physically, embedded systems ranges from portable devices
such as digital watches and MP3 players, to large stationary installations like traffic lights,
factory controllers, or the systems controlling nuclear power plants. In terms of complexity
embedded systems can range from very simple with a single microcontroller chip, to very
complex with multiple units, peripherals and networks mounted inside a large chassis or
enclosure.
Fig 2.1. Embedded kit
3
2.2 Applications of Embedded System:
Embedded Systems has witnessed tremendous growth in the last one decade. Almost
all the fast developing sectors like automobile, aeronautics, space, rail, mobile
communications, and electronic payment solutions have witnessed increased use of Embedded
technologies. Greater value to mobility is one of the prominent reasons for the rise and
development of embedded technologies.
Initially, Embedded Systems were used for large, safety-critical and business-critical
applications that included
 Rocket & satellite control 

 Energy production control 

 Telephone switches 
Air Traffic Control Embedded Systems research and development is now concerned
with a very large proportion of the advanced products designed in the world. In one way,
Embedded technologies run global transport industry that includes avionics, space,
automotive, and trains. But, it is the electrical and electronic appliances like cameras, toys,
televisions, home appliances, audio systems, and cellular phones that really are the visual
interface of Embedded Systems for the common consumer.
Advanced Embedded Technologies are deployed in developing
 Process Controls (energy production and distribution, factory automation and
optimization) Telecommunications (satellites, mobile phones and telecom networks), 

 Energy management (production, distribution, and optimized use) 

 Security (e-commerce, smart cards) 
Health (hospital equipment and mobile monitoring) In the last few years the emphasis
of Embedded technologies was on achieving feasibility, but now the trend is towards
achieving optimality. Optimality or optimal design of embedded systems means
 Targeting a given market segment at the lowest cost and delivery time possible 

 Seamless integration with the physical and electronic environment. 

 Understanding the real-world constraints such as hard deadlines, reliability,
availability, robustness, power consumption, and cost. 
4
2.3 Automobile sector
Automobile sector has been in the forefront of acquiring and utilizing
Embedded technology to produce highly efficient electric motors. These electric motors
include brushless DC motors, induction motors and DC motors, that use electric/electronic
motor controllers. European automotive industry enjoys a prominent place in utilizing
Embedded technology to achieve better engine control. They have been utilizing the recent
Embedded innovations such as brake-by-wire and drive-by-wire. Embedded technology finds
immediate importance in electric vehicles, and hybrid vehicles. Here Embedded applications
bring about greater efficiency and ensure reduced pollution. Embedded technology has also
helped in developing automotive safety systems such as the
 Anti-lock braking system (ABS) 

 Electronic Stability Control (ESC/ESP) 

 Traction control (TCS) 

 Automatic four-wheel drive 

2.4 Aerospace & Avionics
Aerospace and Avionics demand a complex mixture of hardware, electronics, and
embedded software. For efficient working, hardware, electronics and embedded software must
interact with many other entities and systems. Embedded engineers confront major challenges,
 Creating Embedded systems on time 

 Taking the budgetary constraints into consideration 

 Ensuring that the complex software and hardware interactions are right 

 Assembling components that meet specifications and perform effectively together 

 Understanding the larger context of the embedded software 

 Adopting the latest in Embedded technology like the fly-by-wire 

2.5 Telecommunications
If ever there is an industry that has reaped the benefits to Embedded Technology, for
sure, it is only Telecommunications. The Telecom industry utilizes numerous embedded
systems from telephone switches for the network to mobile phones at the end-user. The
Telecom computer network also uses dedicated routers and network bridges to route data.
5
Embedded engineers help in ensuring high-speed networking. This is the most critical part of
embedded applications. The Ethernet switches and network interfaces are designed to provide
the necessary bandwidth. These will allow in rapidly incorporating Ethernet connections into
advanced Embedded applications.
2.6 Consumer Electronics
Consumer electronics has also benefited a lot from Embedded technologies. Consumer
electronics includes
 Personal Digital Assistants (PDAs) 

 MP3 players 

 Mobile phones 

 Videogame consoles 

 Digital cameras 

 DVD players 

 GPS receivers 

 Printers 
Even the household appliances, that include microwave ovens, washing machines and
dishwashers, are including embedded systems to provide flexibility, efficiency and features.
The latest in Embedded applications are seen as advanced HVAC systems that uses networked
thermostats to more accurately and efficiently control temperature. In the present times, home
automation solutions are being increasingly built on Embedded technologies. Home
automation includes wired and wireless-networking to control lights, climate, security,
audio/visual, surveillance, etc., all of which use embedded devices for sensing and controlling.
2.7 Railroad
Railroad signalling in Europe relies heavily on embedded systems that allows for
faster, safer and heavier traffic. Embedded technology has brought a sea of change in the way
Railroad Signals are managed and Rail traffic in large volumes is streamlined. The Embedded
technology enabled Railroad Safety Equipment is increasingly being adopted by Railway
networks across the globe, with an assurance of far lesser Rail disasters to report.
6
2.8 Electronic payment solutions sector
In the present times there is stiff competition amongst Embedded solutions providers
to deliver innovative, and high-performance electronic payment solutions that are easy to use
and highly secure. Embedded engineers knowledge able in trusted proprietary technology
develops the secure, encrypted transactions between payment systems and major financial
institutions. The market for mobile payments systems is growing rapidly. It is driven by
retailers, restaurants, and other businesses that want to service customers anywhere, anytime.
With the use of mobile devices, mostly mobile phones becoming very popular, Embedded
technologies compatible with mobile are being developed to promote payment systems.
7
CHAPTER-3
HARDWARE REQUIREMENTS
3.1 BLOCK DIAGRAM:
Power
supply
Finger print
module
XMEGA
256A3BUKeypad 4x3
Digital
lock
GSM
module
Fig .3.1. Block diagram of our project
This is the block diagram of ―programmable intelligent door locking system with two
level using biometrics‖ .In this block diagram there will be ATMEL ―XMEGA 256A3BU‖
microcontroller, ―POWER SUPPLY‖, ―FINGER PRINT MODULE‖, ―KEYPAD 4*3, ―GSM
MODULE‖ and ―DIGITAL LOCK‖.
Now let‘s see the brief explanation of each block and we will see its features in detail.
8
3.2 MICRO-CONTROLLER (XMEGA 256A3BU):
Fig 3.2. XMEGA 256A3BU Microcontroller
The Atmel AVR Xplained kits are great platforms for early evaluation of the
capabilities offered by the Atmel AVR microcontrollers. The XMEGA-A3BU Xplained
contain one QTouch button sensor, three mechanical buttons, two LEDs, 3 analog sensors, a
USB port, battery backup system and a 128x32 pixel FSTN LCD display.
The AVR Xplained expansion headers provide easy access to analog and digital I/O pins. The
board is powered by the USB cable and equipped with the standard 10-pin JTAG header that
connects to the full range of AVR debuggers.
Key features:
 Keep RTC running in the backup system while main power is absent 

 Display data on the 128x32 pixels of the FSTN LCD display 

 Read temperature sensor with the ADC 
9
 Read light sensor with the ADC 

 Use the Atmel QTouch library to detect touches on the touch button 

 Read/write data to the 64Mbit Atmel Data Flash 

 3 push buttons to interact with the microcontroller 

 4 LEDs to show status information 

 Program the kit via USB boot loader or an Atmel programmer 

 Expand the board with Xplained top modules. 
3.2.1 Operation of the microcontroller:
To be able to run the preprogrammed code, you need to connect the Atmel AVR
XMEGA-A3BU Xplained evaluation kit with a USB cable (standard A to mini-B or mini
AB) to a PC or USB hub. Once the kit is powered it is possible to browse the menu
system with the on-board mechanical buttons and the touch button. The functions for
the buttons are:
• Top left mechanical button (SW0): Enter a menu
• Bottom left touch button (QTB0): Return from a menu
• Top right mechanical button (SW1): Browse the menu up
• Bottom right mechanical button (SW2): Browse the menu down
The demo application allows also the XMEGA-A3BU Xplained board to communicate
with a computer using USB with a CDC (Communications Device Class) setup,
allowing the keyboard to be used to navigate in the demo application. When the
XMEGA-A3BU Xplained board is connected for the first time, Windows will try to
install a driver for ―Virtual CDC Com‖. A driver file, XPLAINED_Virtual_Com_Port.inf,
is located in the demo application directory or can be downloaded from the Atmel
If the driver is successfully installed, the board will show up in the Device Manager under
Ports (XPLAINED Virtual Com Port (COM**)). This COM port can now be interfaced
with your favorite terminal software. The connection parameters are as follows:
• Baud rate: 115200 baud
• Data bits: 8
• Parity: None
• Stop bits: 1
• Flow control: None
10
If the connection has been successfully established, you should be greeted by this
text on the screen of your terminal:
Welcome to the XMEGA-A3BU Xplained Demo CDC
interface! Key bindings for LCD menu control:
Enter : Enter
Backspace : Back
Arrow Up : Up Arrow
Arrow Down : Down Arrow
The demo application for the XMEGA-A3BU Xplained is available through the Atmel
AVR Software Framework (ASF), version 2.6.0 or later. The demo application is available as
an example project in AVR Studio® 5 and can be accessed by clicking:
File -> New -> Example Project, and selecting ―Demo application for XMEGA-A3BU
Xplained‖. In-depth documentation for the demo application is available in
the XMEGA-A3BU Xplained Software User Guide.
To modify the example code or write new code and compile it, you need a toolchain
for the Atmel AVR microcontrollers and an IDE to edit and debug code.
3.2.2 Connecting a kit:
Connect a USB cable between the board and a PC or a USB power supply to
power the kit. This is all that is needed. When power is applied the power/status LED will
light up in green.
Do not power the board without having the jumper next to the USB connector or
an Ampere meter mounted. Otherwise, the device may be damaged.
When connecting the Atmel XMEGA-A3BU Xplained to a PC, the operating system
will request a driver file for installing the serial communication driver. This driver file is
available in the zip-file associated with this document. The driver file supports both
32-bit and 64-bit versions of Windows® XP and Windows 7. Driver installs are not
necessary on Linux® operating systems.
11
3.3 FINGER PRINT MODULE R305:
In fingerprint we will be considering mainly two parts. They are
1) Ridges
2) Valleys
Ridges are the lines which are present on our fingers and the gaps between two ridges
are Valleys. Fingerprint ridges are formed during the third to fourth month of fatal
development. The ridges begin to develop on the skin of the thumbs and fingers.
The purpose of these ridges is to give the fingers a firmer grasp and to avoid slippage.
These ridges allow the fingers to grasp and pick up objects.
The friction ridges on the fingers arrange themselves in more or less regular patterns
with ridge characteristics. All fingerprints have a unique combination and arrangement of
patterns and ridge characteristics. These patterns of friction ridges contain rows of sweat pores
that allow sweat and or oil to exit from glands. Sweat mixed with other body oils and dirt
produces fingerprints on smooth surfaces.
Fingerprints are left by the transfer of oils or amino acids to a surface, from the
transfer of substances on the fingers like paint or blood or by leaving an impression print in a
soft substance.
No two prints have ever been found to be exactly alike. Even those of identical twins
are different. Fingerprints are not inherited. The general pattern may be the same in families
but the level 2 and 3 details will differ. After formation, the growing fingerprint ridges expand
uniformly in all directions while growth is occurring so the pattern never changes.
Finger prints cannot be altered without creating a new unique fingerprint. Even when
the skin tissue is injured, the skin that grows back will have the same print.
Prints remain the same throughout life. The prints that someone is born with won‘t change
until decomposition after death.
And this is the best biometric material in which we can use in the security system and
there will be different finger prints for each individual and no two finger prints will be same in
12
the world and this is this biometric material (finger print module) is used for the security
system.
Fig 3.3. Finger print module
Features:
 Complete embedded platform for robust products 

 Optical fingerprint sensors for reliability 

 Multiple module to select from as per your application needs 

 Full development support and reference designs 

 Low cost 

 Quick development and product launches 
13
3.4 KEYPAD 4x3:
Keypad used is 4x3 keypad, this is mainly used to type the password so that door
opens and the authorized person can enter into the room and in this keypad there will be four
rows and three columns .
Through this keypad the authorized person will be entering the password and if he/she
enters the correct password then the door will be opened and if authorized person enters
wrong password then the door will be not opened and the control enters into the ―selection of
the mode‖ which will be displayed on the screen.
Fig 3.4. Keypad 4x3
3.5 GSM MODULE:
GSM (Global System for Mobile) / GPRS (General Packet Radio Service) TTL –
Modem is SIM900 Quad-band GSM / GPRS device, works on frequencies 850 MHZ, 900
MHZ, 1800MHZ and 1900 MHZ. It is very compact in size and easy to use as plug in GSM
Modem. The Modem is designed with 3V3 and 5V DC TTL interfacing circuitry, which
allows User to directly interface with 5V Microcontrollers (PIC, AVR, Arduino, 8051, etc.) as
well as 3V 3Microcontrollers (ARM, ARM Cortex XX, etc.). The baud rate can be
14
configurable from 9600-115200 bps through AT (Attention) commands. This GSM/GPRS
TTL Modem has internal TCP/IP stack to enable User to connect with internet through GPRS
feature. It is suitable for SMSas well as DATA transfer application in mobile phone to mobile
phone interface.
The modem can be interfaced with a Microcontroller using USART (Universal
Synchronous Asynchronous Receiver and Transmitter) feature (serial communication).
The main operation of the GSM Module is that it is used to sending and receiving the
number of messages and even it is used for calling and for deactivate the call from any region
and there will be some of the AT(attention) commands for sending and receiving the messages
and for calling and deactivating the call and even there will be commands for holding the
current call .
This is about the GSM module.
Fig .3.5. GSM module
15
Features:
 Quad Band GSM/GPRS : 850 / 900 / 1800 / 1900 MHz 

 Built in RS232 to TTL or vice versa Logic Converter (MAX232) 

 Configurable Baud Rate 

 SMA (Sub Miniature version A) connector with GSM L Type Antenna 

 Built in SIM (Subscriber Identity Module) Card holder 

 Built in Network Status LED Inbuilt Powerful TCP / IP (Transfer Control Protocol
/ Internet Protocol) stack for internet data transfer through GPRS (General Packet
Radio Service) 

 Audio Interface Connectors (Audio in and Audio out) 

 Most Status and Controlling pins are available 

 Normal Operation Temperature : -20 °C to +55 °C 

 Input Voltage : 5V to 12V DC 

 LDB9 connector (Serial Port) provided for easy interface 
16
CHAPTER-4
SOFTWARE REQUIREMENTS
4.1 ATMEL STUDIO 6.2:
Starting Atmel Studio
Atmel Studio is started by clicking on the Atmel Studio 6.2 shortcut in the Start-Up menu.
Once started, the start page is displayed. From within this page you can create new projects
and reopen recently used projects, as well as browse through articles providing tutorials,
help and news.
The Start page can also be accessed from View→Start Page, or Alt+V+G.
Fig.4.1 The Project related section of the Start Page
17
The left section of the start page contains project-related items:
 New project - Use this to create a new project. If you are very new to the concept of
software development with Atmel Studio, refer to the step-by-step guides. The
project settings and available options are described in detail in Project Management 

 New example project - To take a step-by-step tour of the available Atmel platforms'
functionalities using the AVR Software Framework, click this button. 

 Open project - Load an existing project, not mentioned on the Recent projects pane
The Recent projects lists the most recently opened projects. Clicking on any of the links
will open the project, restoring it and the GUI to its last saved settings. You can select the
number of projects you would like to be shown in the Menus and settings. 
The Get Started section
The Get Started tab contains the Welcome page,
The Welcome page contains an overview, new features and some of the common Q&A
about the current Atmel Studio release.
Getting started: New project contains information about the AVR Software Framework
and the tutorials to get you proficient with the new and existing tools quickly.
Extending the Atmel studio allows you to browse and install extensions from an online
gallery of third-party extensions to the Atmel Studio IDE and from the updates catalog for the
IDE.
The Tutorials page lists a set of basic tutorials.
The Links and resources page leads to online resources for prototyping and product
ordering and information.The AVR Tools Help section
18
Fig.4.2. The AVR Tools Help section
The AVR Tools Help section contains help on AVR software and hardware platforms.
The following information‘s is found here:
 Starter kits tab contains information on starter kits. 

 Debuggers contains information on compatible debuggers. 

 Programmers contains information on AVR ISP mkII, the universal in-
system programmer for all AVR tools. 

 Touch kits contains information on touch sensor platforms. 

 Wireless kits contains information on platforms with RF transceivers. 

 Evaluation kits contains information on a large set of evaluation kits.. 

 Software contains help on Atmel Studio and other ATMEL installed
software components. 
19
4.2 Prerequisites
The following software and hardware are required for this training. Atmel
Studio 6.2 IDE Atmel Studio Terminal Extension XMEGA-A3BU Xplained
evaluation kit AVR Dragon Programmer/Debugger
One mini-B USB cable to connect XMEGA-A3BU Xplained kit and one USB
type B cable to connect AVR Dragon
4.3 Hardware Setup
This section explains about the hardware setup to be followed to accomplish
the training. This section assumes that the Atmel Studio 6.2 IDE has been installed on
the PC already.
TODO Unpack the AVR Dragon kit and connect the kit to PC using USB type
B cable as shown below.
Fig 4.3. AVR Dragon
20
Once connected, the required drivers for the AVR Dragon will be automatically installed.
Proper driver installation can be verified in the ‗Device Manager‘ window which should show
‗AVR Dragon‘ under ‗Jungo‘ as shown below.
Fig.4.4. Selecting AVR Dragon
The next step is to verify the firmware of the AVR Dragon tool to make
sure that it is up to date.
TODO Open Atmel Studio IDE and select the option ‗View‘ -> ‗Available
Atmel Tools‘ as shown below.
Fig.4.5. Connecting AVR Dragon
21
TODO Right click on the AVR Dragon tool in ‗Available Atmel Tools‘ and select
the option ‗Upgrade‘ as shown below.
Fig4.6. Upgrading AVR Dragon
This is done to ensure that the firmware on the AVR Dragon is up-to-date with the Atmel
Studio IDE. If the firmware is not up-to-date, Atmel Studio will prompt for upgrade as
shown below. Click on the ‗Upgrade‘ button to upgrade the firmware.
TODO Unpack the XMEGA-A3BU Xplained kit and connect it to computer
using mini-B USB cable as shown below.
Fig.4.7. USB Connection
22
The kit comes with a preprogrammed demo application and it also enumerates as USB
CDC device in computer. So when the kit is connected, CDC driver will be installed.
Fig.4.8. JTAG Connection
Open ‗Device Programming‘ window from ‗Tools‘ -> ‗Device Programming‘ as shown below.
Fig.4.9. Device programming
23
4.4 Opening Atmel Studio Project
This section explains how to open a simple Atmel Studio project and how to
configure the device selection.
TODO Open Atmel Studio 6.2 from start menu and select the option
‗File -> New Project‘ as shown below.
Fig.4.10. Opening Atmel project.
TODO Now select the option ‗AVRGCC C Executable Project‘. You may select a
project name and directory as needed. For this case let us use the project name
‗XMEGA_Training‘ and let the directory be the
Documents atmel studio6.2‘ as shown below.
Fig.4.11. Selecting executable project.
24
Now the device selection window will appear.
TODO In the search box, search for ‗xmega256a3bu‘ and select the device
‗ATxmega256A3BU‘ and click OK as shown below.
Fig.4.12. Selecting microcontroller.
This opens an Atmel Studio project with name ‗XMEGA_Training‘ and with a main C file
‗XMEGA_Training.c‘ which can be viewed from the ‗Solution Explorer‘ as shown below.
25
Fig.4.13. Solution explorer.
Double click on the ‗XMEGA_Training.c‘ file in the solution explorer which
opens the C file in the workspace. This file has a basic code snippet which
Includes a header file ‗avr/io.h‘ and has a main() function with an empty while(1) loop.
We will add code to this file in the upcoming sections.
 This section explains how the XMEGA PORT should be configured as general purpose
input/output and how to read/write values to GPIO pins. 
More specifically, in this handson, we will use one push button and one LED available on
the XMEGA-A3BU Xplained board.
Navigate to the path ‗Training_PackageDay_1XMEGA_A3BU_XPLD_Docs‘ and open
the ‗XMEGA_A3BU_XPLD_Schematics.zip‘ file. This file contains the PDF document of
theXMEGA-A3BU Xplained board schematics.
TODO Modify the ‗XMEGA_Training.c‘ file so that it looks as below.
26
#include <avr/io.h>
int main(void)
{
PORTE.DIRCLR = PIN5_bm;
PORTR.D
IRSET =
PIN0_bm;
while(1)
{
PORTR.OUT = (PORTE.IN >> 5);
}
}
Fig.4.14. Building solution.
Above figure shows how to bulid a solution.
TODO Select ‗Project‘ -> ‗XMEGA_Training Properties‘. Now select the
‗Tool‘ tab and configure the AVR Dragon tool as shown below.
27
Fig.4.15. Configuring AVR Dragon.
4.5. Handson II – Monochrome GFX on XMEGA
This section explains how to setup the Atmel Studio project and
configure the XMEGA device to make use of the on-board LCD display.
The on-board LCD display has a resolution of 128x32 pixels with X-Y co-
ordinate (0,0) starting at the top left position. This display is controlled through
SPI interface and is connected to USARTD0 peripheral configured as SPI master
in ATxmega256A3BU device.
TODO Clear all the port related code in ‗XMEGA_Training.c‘ file
and keep the main() function with while(1) loop as below.
#include <avr/io.h>
int main(void)
{
28
while(1)
{
}
}
TODO Copy the folder ‗gfx_library‘ and paste it in the project
directory where ‗XMEGA_Training.c‘ file exists.
This folder contains all the source code for the low level LCD driver, the
monochrome graphics library and the monochrome system font library.
This folder and the associated code should now be included in the project in
‗Solution Explorer‘.
TODO Click the ‗Show Files‘ icon in the solution explorer as shown below
which will list all the files/folders in the project directory. The files/folders
that are not included in the project will be shown as empty icons.
TODO Right click on folder ‗gfx_library‘ and click the option
‗Include in project‘ as shown below.
Fig.4.16. Selecting GFX library.
TODO The gfx library path should also be added in the project directories. Open
29
‗Project -> XMEGA Training properties ->Toolchain -> AVR/GNU C Compiler ->
Directories‘. Click the ‗Add item‘ button and type the
following ‗../gfx_library‘ (without codes) and click OK as shown below.
Fig.4.17. Directories.
Now common macro definitions for the graphics library has to be added in the project settings.
TODO Open ‗Project -> XMEGA Training properties ->Toolchain -> AVR/GNU C
Compiler -> Symbols‘. Click the ‗Add item‘ button and add the following macro definitions
one by one.
F_CPU=32000000UL
GFX_MONO_C12832_A1Z=1
The first macro is used by the delay routines to determine the number of CPU cycles per
microsecond used by the LCD driver and the second macro defines the LCD type used by
the graphics library.
TODO Now open ‗XMEGA_Training.c‘ file and include the following header files
next to io.h file include.
30
#include
"gfx_mono.h"
#include
"gfx_mono_text.h"
#include "sysfont.h"
These header files includes all the necessary graphics and system font library files.
The next step is to make the device running at 32MHz frequency (max speed). By default,
when the device is powered up, the device will start running at 2MHz frequency generated by
the internal 2MHz RC oscillator. Since the graphics library needs more CPU performance we
will make the CPU running at its full speed of 32MHz using the on-chip dedicated 32MHz ring
oscillator.
TODO Add the following code before while(1) loop in main() function.
OSC.CTRL |=
OSC_RC32MEN_bm;
while(!(OSC.STATUS &
OSC_RC32MRDY_bm)); CCP =
CCP_IOREG_gc;
CLK.CTRL = CLK_SCLKSEL_RC32M_gc;
The above code first enables the internal 32MHz oscillator through the oscillator control
register and then waits in a while loop until the corresponding ready bit in STATUS register
is set.
It then switches the main clock to 32MHz oscillator after writing the CCP register
(Configuration Change Protection register). Write to CCP register is mandatory when switching
the main clock otherwise the clock switch will not happen for security reason.
TODO Add the following code before while(1) loop and after clock switching
31
snippet.
gfx_mono_init();
PORTE.OUTSET
= PIN4_bm;
gfx_mono_draw_string("Hello World!", 0, 0, &sysfont);
The function ‗gfx_mono_init()‘ will initialize the graphics library as well as the low level
LCD drivers and the USART SPI module.
From the schematic document the backlight for LCD module is connected to PORTE pin 4 of
the ATxmega256A3BU device. Setting this pin to logic high state will enable the LCD
backlight and vice versa. The second line in the above snippet sets a logic high state on the
backlight pin.
The function ‗gfx_mono_draw_string()‘ is used to print a string on the LCD display. The
first argument is the actual string, the second and third arguments represent the X and Y co-
ordinates respectively and the fourth argument is the pointer to the system font structure.
The final code should look as below.
#include <avr/io.h>
#include "gfx_mono.h"
#include
"gfx_mono_text.h"
#include "sysfont.h"
int main(void)
32
{
OSC.CTRL |= OSC_RC32MEN_bm;
while(!(OSC.STATUS &
OSC_RC32MRDY_bm)); CCP =
CCP_IOREG_gc;
CLK.CTRL = CLK_SCLKSEL_RC32M_gc;
gfx_mono_init();
PORTE.OUTSET =
PIN4_bm;
gfx_mono_draw_string("Hello World!", 0, 0,
&sysfont); while(1)
{
;
}
}
TODO Run the project by hitting F5.
33
Fig.4.18. Displaying ―hello!world‖.
34
CHAPTER-5
RESULT
5.1 RESULT ANALYSIS:
In this project there will be three modes, they are:
1.) Mode 1: Finger print mode.
2.) Mode 2: keypad mode.
3.) Mode 3: GSM and keypad mode.
1.) Mode 1: Finger print mode.
Initially when we power ―ON‖ the supply then the LCD displays ―welcome!
select the mode‖ and then here we have to select the mode as mode 1from the keypad and then
it displays ―checking for mode‖ and it enters into the finger print mode then it displays ―please
scan your finger!‖ and immediately when person places finger it displays ―countdown
5,4,3,2,1‖ and it enrolls the finger and it displays ―enroll ok‖ and ―genchar ok‖ , ―successful
matching of finger print !‖ and it displays ―matched open the door !‖ if it does not matches then
the control goes to the selection mode that is it displays ―welcome ! select the mode‖.
Screen shot.5.1. Finger print mode
35
2.) Mode 2: Keypad mode.
When the person selects the mode 2 then the control goes to the keypad by
pressing 2 on the keypad now it displays ―Enter key!‖ ,if the key matches then the control
enters into the keypad and it displays ―Enter password now!‖and if password matches then the
LCD displays ―matched! Open the door‖ and if the password does not matches the controls
goes to the selection mode and it displays ―Welcome! Select the mode‖.
Screen shot..5.2. Keypad mode.
3.) Mode 3:GSM and keypad.
When the person selects mode 3 then the control goes to the GSM and then here
we have to press 3 on keypad and LCD displays ―waiting for owner‖ and then when
authorized person(owner) calls to the GSM module and if cell number matches with the
GSM then LCD displays ―Enter GSM password!‖ and if the password matches then
LCD displays ― GSM password accepted!‖ and it displays ―matched ! open the door‖
and if the password does not matches the control goes to the selection mode and it
displays ―welcome! Select mode.‖
36
Screen shot.5.3. GSM activated with Keypad mode.
37
CONCLUSION
In this way we have successfully implemented ―programmable intelligent door
locking system with two level of security.‖This project can be used at high security area such as
banks, homes, offices and corporate companies.
Here, we are two level security because, if unauthorized person hacks password then
that person may enter the room and stoles important things i.e..robbery Hence we are
keeping two levels of security.
38
FUTURE SCOPE
When person enters into the room in any case if that person is injured severely then
no one can know outside if there is only person in the room.
In this case there will be a camera inside the room so that owner can view when
a person got injured.
39
APPENDIX
Program code:
/*
* final.c
*
* Created: 12-02-2015 17:36:55
*
*/
#include <avr/io.h> #include
"gfx_mono.h" #include
"gfx_mono_text.h" #include
"sysfont.h" #include
"string.h"
#define F_CPU 32000000ul
#include <util/delay.h>
void Set_Clk_32MHz(void);
//Configuring UART on PORTC to connect Finger Print
Module void uart_init(void);
void send_char(char data);
void send_string(char *str);
char receive_data(void);
//Configuring UART on PORTE to connect GSM
void uart_init2(void);
void send_char2(char data);
void send_string2(char *str);
void receive_data2(void);
// Keypad scanning
unsigned char scan_key(void);
unsigned char scan_pass(void);
void print_pass (void);
40
// Mode-1: Function, Commands and variables required for Finger Print Module scanning
void fp_scan (void);
unsigned char i=0,fp[20],j=0,str[4],s=0,rec,dummy,fp_flag=0;
unsigned char enroll[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05};
unsigned char
generate_ch[13]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X04,0x02,0X02,0X00,0X09};
//unsigned char
store[15]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X06,0X06,0X01,0x00,0x01,0x0
0,0x0F};
//unsigned char
identify[17]={0xEF,0X01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x08,0x1B,0x01,0x00,0x00,0x01,
0x01,0x00,0x27};
unsigned char identify[17]={0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X08,0X04,0X02,0X00,0X00
,0X00,0X04,0X00,0X13};
//unsigned char identify[17]={0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X08,0X04,0X02,0X00,0X00
,0X00,0X08,0X00,0X17};
// Mode-2: Two layer password protection entering through
keypad unsigned char pass1[5]="147*", pass2[5]="369#";
// Mode-3: Password checking after getting approval through GSM
calling unsigned char passgsm[5]="2580";
unsigned char mynum1[11]="9014099933",
mynum2[11]="9032549675",mynum3[11]="8801133111";
unsigned char mynum4[11]="9347517427";
unsigned char gsm_flag = 0;
// Variable declaration for storing entered/received data through
keypad/GSM unsigned char pwdval[5];
unsigned char msg[52],chknum[11];
41
unsigned char pwd[4];
//unsigned char rx=0, key_count=0;
unsigned int rx=0, key_count=0;
unsigned char mykey, door_lock;
/****************************************************************************
********
main ()
*****************************************************************************
********/
int main(void)
{
unsigned char data;
Set_Clk_32MHz();
uart_init2(); // GSM Module
uart_init(); // Finger Print Module
// Relay output to control lock on/off
PORTA_DIRSET |= 0x01; // PA0 : Showing it through LED On/Off
PORTF_DIRCLR |= 1<<1; // SW1 on boards
PORTF_PIN1CTRL |= 0x18; // SW1 for direct open lock from inside house
PORTA_DIRSET=0xf0; // Keypad Rows as Output R1=PA4, R2=PA5,
R3=PA6, R4=PA7
PORTB_DIRCLR=0x0f; // Keypad Columns as Input C1=PB1, C2=PB2, C3=PB3;
// PB0 for FP scanning switch
// Setting INPUT pins as PULLUP
PORTB_PIN1CTRL |= 0x18;
PORTB_PIN2CTRL |= 0x18;
42
PORTB_PIN3CTRL |= 0x18;
PORTB_PIN0CTRL |= 0x18;
// Enabling LCD Backlight
PORTE.OUTSET = PIN4_bm;
again:
door_lock = 0;
PORTA_OUTCLR = PIN0_bm;
gfx_mono_init();
gfx_mono_draw_string("Welcome! Select Mode!",0, 0,
&sysfont); _delay_ms(2000);
while(1)
{
gfx_mono_init();
gfx_mono_draw_string("Welcome! Select Mode!",0, 0, &sysfont);
key_count = 0;
_delay_ms(100);
while (key_count<=0)
{
//mykey = scan_key();
mykey = scan_pass();
//gfx_mono_init();
//gfx_mono_draw_string("MyChar is ", 0, 0, &sysfont);
//gfx_mono_draw_char(key_count, 9, 18, &sysfont);
//gfx_mono_draw_char(mykey, 9, 18, &sysfont);
43
//_delay_ms(1000);
}
gfx_mono_init();
gfx_mono_draw_string("Checking for mode", 0, 0,
&sysfont); _delay_ms(2000);
if (mykey == '1') // Mode-1
{
gfx_mono_draw_string("Please scan your finger!",0, 0,
&sysfont); _delay_ms(2000);
gfx_mono_draw_string("Count down: 5",0, 0,
&sysfont); _delay_ms(1000);
gfx_mono_draw_string("Count down: 4",0, 0,
&sysfont); _delay_ms(1000);
gfx_mono_draw_string("Count down: 3",0, 0,
&sysfont); _delay_ms(1000);
gfx_mono_draw_string("Count down: 2",0, 0,
&sysfont); _delay_ms(1000);
gfx_mono_draw_string("Count down: 1",0, 0,
&sysfont); _delay_ms(1000);
fp_scan();
if (fp_flag == 1)
{
gfx_mono_init();
gfx_mono_draw_string("Successful matching of finger
Print!",0, 0, &sysfont);
door_lock = 1;
_delay_ms(1000);
}
44
}
else if (mykey == '2') // Mode-2
{
gfx_mono_init();
gfx_mono_draw_string("Enter Key!",0, 0, &sysfont);
_delay_ms(1000);
key_count = 0; while
(key_count<4)
{
//mykey = scan_key();
mykey = scan_pass();
//pwdval[key_count-1] = mykey;
//gfx_mono_init();
//gfx_mono_draw_string("MyChar Key is", 0, 0,
&sysfont); //gfx_mono_draw_char(mykey, 9, 18,
&sysfont); //_delay_ms(1000);
}
gfx_mono_init();
gfx_mono_draw_string(pwdval, 0, 0,
&sysfont); gfx_mono_draw_string(pass1, 9, 18,
&sysfont); _delay_ms(2000);
if (!(strncmp(pass1,pwdval,4)))
{
gfx_mono_init();
gfx_mono_draw_string("Enter Password Now!",0, 0,
&sysfont); _delay_ms(2000);
key_count = 0;
45
while (key_count<4)
{
//mykey = scan_key();
mykey = scan_pass();
//pwdval[key_count-1] = mykey;
//gfx_mono_init();
//gfx_mono_draw_string("MyChar is PWD", 0, 0,
&sysfont);
//gfx_mono_draw_char(mykey, 9, 18, &sysfont);
//_delay_ms(1200);
}
if (!(strncmp(pass2,pwdval,4)))
{
gfx_mono_init();
gfx_mono_draw_string("Your Password Accepted!",0,
0, &sysfont);
door_lock = 1;
_delay_ms(2000);
}
}
else
{
gfx_mono_init();
gfx_mono_draw_string("Your first key failed!",0, 0,
&sysfont); _delay_ms(2000);
goto again;
}
}
else if (mykey == '3') // Mode-3
{
gfx_mono_init();
46
gfx_mono_draw_string("Waiting for owner!",0, 0,
&sysfont); _delay_ms(1000);
receive_data2(); if
(gsm_flag == 1)
{
gfx_mono_init();
gfx_mono_draw_string("Enter GSM password!",0, 0,
&sysfont); _delay_ms(1000);
key_count = 0; while
(key_count<4)
{
mykey = scan_pass();
//mykey = scan_key();
//pwdval[key_count-1] = mykey;
//gfx_mono_init();
//gfx_mono_draw_string("MyChar GSM is ", 0,
0, &sysfont);
//gfx_mono_draw_char(mykey, 9, 18,
&sysfont); //_delay_ms(1200);
}
if (!(strncmp(passgsm,pwdval,4)))
{
door_lock = 1;
gfx_mono_init();
gfx_mono_draw_string("GSM password accepted!",0, 0,
&sysfont);
_delay_ms(1000);
}
else
{
47
gfx_mono_init();
gfx_mono_draw_string("Sorry, not matched!",0,
0, &sysfont);
_delay_ms(1000);
}
}
else
{
gfx_mono_init();
gfx_mono_draw_string("GSM authnty failed!",0, 0,
&sysfont); _delay_ms(3000);
}
}
else
{
goto again;
}
if (door_lock == 1)
{
gfx_mono_init();
gfx_mono_draw_string("Door is opening!",0, 0,
&sysfont); PORTA_OUTSET = PIN0_bm;
_delay_ms(5000);
}
//receive_data();
//_delay_ms(100);
//mykey = scan_key();
48
//gfx_mono_init();
//gfx_mono_draw_string("MyChar is ", 0, 0,
&sysfont); //gfx_mono_draw_char(mykey, 9, 18,
&sysfont); //_delay_ms(1000);
goto again;
}
}
/***************************************************************
Code for configuring Sys Clk at 32MHz
***************************************************************/
void Set_Clk_32MHz(void)
{
OSC_CTRL |= OSC_RC32MEN_bm; //Setup 32Mhz crystal
while(!(OSC_STATUS & OSC_RC32MRDY_bm));
CCP = CCP_IOREG_gc; //Trigger protection mechanism
CLK_CTRL = CLK_SCLKSEL_RC32M_gc; //Enable internal 32Mhz crystal
}
/****************************************************************************
*
Code to Initialize USART for Finger Print
*****************************************************************************
/
49
void uart_init(void)
{
PORTC_OUTSET = PIN3_bm; //Let's make PC7 as TX
PORTC_DIRSET = PIN3_bm; //TX pin as output
USARTC0_BAUDCTRLA = 207;
USARTC0_BAUDCTRLB = 0;
USARTC0_CTRLA = 0;
USARTC0_CTRLC = 0x03;
USARTC0_CTRLB = USART_TXEN_bm | USART_RXEN_bm;
}
/***************************************************************************
code for Sending a single char
*************************************************************************/
void send_char(char data)
{ USARTC0_DATA = data;
while ( !( USARTC0_STATUS & USART_DREIF_bm)
); //_delay_ms(50);
}
/**************************************************
code for sending a string
**************************************************/
void send_string(char *str)
{ while(1)
{
if( *str == '0' ) break;
send_char(*str++);
}
50
}
char receive_data(void)
{
char c;
while( !( USARTC0_STATUS & 0x80) );
c=USARTC0_DATA;
}
/****************************************************************************
*
Code for Initialize USART for GSM
*****************************************************************************
/
void uart_init2(void)
{
PORTE_OUTSET = PIN3_bm; //Let's make PC7 as TX
PORTE_DIRSET = PIN3_bm; //TX pin as output
USARTE0_BAUDCTRLA = 207;
USARTE0_BAUDCTRLB = 0;
USARTE0_CTRLA = 0;
USARTE0_CTRLC = 0x03;
USARTE0_CTRLB = USART_TXEN_bm | USART_RXEN_bm;
}
/***************************************************************************
code for Sending a single char
*************************************************************************/
51
void send_char2(char data)
{ USARTE0_DATA = data;
while ( !( USARTE0_STATUS & USART_DREIF_bm) );
_delay_ms(50);
}
/**************************************************
code for sending a string
**************************************************/
void send_string2(char *str)
{ while(1)
{
if( *str == '0' ) break;
send_char2(*str++);
}
}
void receive_data2(void)
{
unsigned int j;
for (rx=0;rx<=41;rx++)
` {
// Adding some code to terminate this loop in case call is not received in 5-10
seconds
// while ((!( USARTE0_STATUS & 0x80) || wdt_counter > 10)
// {
// }
52
while (!( USARTE0_STATUS &
0x80)); msg[rx]=USARTE0_DATA;
}
// +CLIP: "+919014099933",145,"",,"praveen",0
for (rx=0;rx<=41;rx++)
{
if ((msg[rx] == 'C') && (msg[rx+1] == 'L') && (msg[rx+2] == 'I') &&
(msg[rx+3] == 'P'))
{
for (j=0;j<10;j++)
{
chknum[j] = msg[rx+10+j];
}
}
}
send_string2("ATH");
_delay_ms(50);
send_string2("rn");
_delay_ms(100);
if (!(strncmp(chknum, mynum1, 10)))
{
//PORTA_OUTSET=0X02;
gsm_flag = 1;
_delay_ms(50);
}
else if (!(strncmp(chknum, mynum2, 10)))
{
//PORTA_OUTSET=0X02;
53
gsm_flag = 1;
_delay_ms(50);
}
else if (!(strncmp(chknum, mynum3, 10)))
{
//PORTA_OUTSET=0X02;
gsm_flag = 1;
_delay_ms(50);
}
else if (!(strncmp(chknum, mynum4, 10)))
{
//PORTA_OUTSET=0X02;
gsm_flag = 1;
_delay_ms(50);
}
else
{
//PORTA_OUTCLR=0X02;
gsm_flag = 0;
_delay_ms(50);
}
}
// Macros definition
//#define KCOLUMN PORTB_IN
//#define KROWS PORTA_OUT
54
unsigned char scan_key(void)
{
//gfx_mono_init();
unsigned char char_key;
_delay_ms(150);
PORTA_OUT = 0xe0;
_delay_ms(150);
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
//char_key = '1';
//gfx_mono_draw_string("1", 0, 0,
&sysfont); _delay_ms(150);
return '1';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
//char_key = '2';
//gfx_mono_draw_string("2", 0, 0,
&sysfont); _delay_ms(150);
return '2';
}
if ((PORTB_IN & (1<<3)) == 0x00)
{
key_count++;
//char_key = '3';
//gfx_mono_draw_string("3", 0, 0,
&sysfont); _delay_ms(150);
return '3';
55
}
_delay_ms(150);
PORTA_OUT = 0xd0;
_delay_ms(150);
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
//char_key = '4';
//gfx_mono_draw_string("4", 0, 0,
&sysfont); _delay_ms(150);
return '4';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
//char_key = '5';
//gfx_mono_draw_string("5", 0, 0,
&sysfont); _delay_ms(150);
return '5';
}
if ((PORTB_IN & (1<<3)) == 0x00)
{
key_count++;
//char_key = '6';
//gfx_mono_draw_string("6", 0, 0,
&sysfont); _delay_ms(150);
return '6';
}
56
_delay_ms(150);
PORTA_OUT = 0xb0;
_delay_ms(150);
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
//char_key = '7';
//gfx_mono_draw_string("7", 0, 0,
&sysfont); _delay_ms(150);
return '7';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
//char_key = '8';
//gfx_mono_draw_string("8", 0, 0,
&sysfont); _delay_ms(150);
return '8';
}
if ((PORTB_IN & (1<<3)) == 0x00)
{
key_count++;
//char_key = '9';
//gfx_mono_draw_string("9", 0, 0,
&sysfont); _delay_ms(150);
return '9';
}
_delay_ms(150);
PORTA_OUT = 0x70;
_delay_ms(150);
57
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
//char_key = '*';
//gfx_mono_draw_string("*", 0, 0,
&sysfont); _delay_ms(150);
return '*';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
//char_key = '0';
//gfx_mono_draw_string("0", 0, 0,
&sysfont); _delay_ms(150);
return '0';
}
if ((PORTB_IN & (1<<3)) == 0x00)
{
key_count++;
//char_key = '#';
//gfx_mono_draw_string("#", 0, 0,
&sysfont); _delay_ms(150);
return '#';
}
}
#define dly1 150
#define dly2 150
unsigned char scan_pass(void)
58
{
//gfx_mono_init();
unsigned char char_key;
_delay_ms(dly1);
PORTA_OUT = 0xe0;
_delay_ms(dly1);
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '1';
print_pass();
//char_key = '1';
//gfx_mono_draw_string("1", 0, 0,
&sysfont); _delay_ms(dly2);
return '1';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '2';
print_pass();
//char_key = '2';
//gfx_mono_draw_string("2", 0, 0,
&sysfont); _delay_ms(dly2);
return '2';
}
if ((PORTB_IN & (1<<3)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '3';
59
print_pass();
//char_key = '3';
//gfx_mono_draw_string("3", 0, 0,
&sysfont); _delay_ms(dly2);
return '3';
}
PORTA_OUT = 0xd0;
_delay_ms(dly1);
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '4';
print_pass();
//char_key = '4';
//gfx_mono_draw_string("4", 0, 0,
&sysfont); _delay_ms(dly2);
return '4';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '5';
print_pass();
//char_key = '5';
//gfx_mono_draw_string("5", 0, 0,
&sysfont); _delay_ms(dly2);
return '5';
}
if ((PORTB_IN & (1<<3)) == 0x00)
60
{
key_count++;
pwdval[key_count-1] = '6';
print_pass();
//char_key = '6';
//gfx_mono_draw_string("6", 0, 0,
&sysfont); _delay_ms(dly2);
return '6';
}
PORTA_OUT = 0xb0;
_delay_ms(dly1);
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '7';
print_pass();
//char_key = '7';
//gfx_mono_draw_string("7", 0, 0,
&sysfont); _delay_ms(dly2);
return '7';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '8';
print_pass();
//char_key = '8';
//gfx_mono_draw_string("8", 0, 0,
&sysfont); _delay_ms(dly2);
return '8';
61
}
if ((PORTB_IN & (1<<3)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '9';
print_pass();
//char_key = '9';
//gfx_mono_draw_string("9", 0, 0,
&sysfont); _delay_ms(dly2);
return '9';
}
PORTA_OUT = 0x70;
_delay_ms(dly1);
if ((PORTB_IN & (1<<1)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '*';
print_pass();
//char_key = '*';
//gfx_mono_draw_string("*", 0, 0,
&sysfont); _delay_ms(dly2);
return '*';
}
if ((PORTB_IN & (1<<2)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '0';
print_pass();
//char_key = '0'; //gfx_mono_draw_string("0",
0, 0, &sysfont);
62
_delay_ms(dly2);
return '0';
}
if ((PORTB_IN & (1<<3)) == 0x00)
{
key_count++;
pwdval[key_count-1] = '#';
print_pass();
//char_key = '#';
//gfx_mono_draw_string("#", 0, 0,
&sysfont); _delay_ms(dly2);
return '#';
}
}
void print_pass (void)
{
if (key_count == 1)
{
gfx_mono_init();
gfx_mono_draw_string("Password: *", 0, 0,
&sysfont); gfx_mono_draw_char(mykey, 9, 18,
&sysfont); _delay_ms(1000);
}
else if (key_count == 2)
{
gfx_mono_init();
gfx_mono_draw_string("Password: **", 0, 0, &sysfont);
gfx_mono_draw_char(mykey, 9, 18, &sysfont);
63
_delay_ms(1000);
}
else if (key_count == 3)
{
gfx_mono_init();
gfx_mono_draw_string("Password: ***", 0, 0,
&sysfont); gfx_mono_draw_char(mykey, 9, 18,
&sysfont); _delay_ms(1000);
}
else if (key_count == 4)
{
gfx_mono_init();
gfx_mono_draw_string("Password: ****", 0, 0,
&sysfont); gfx_mono_draw_char(mykey, 9, 18,
&sysfont); _delay_ms(1000);
}
}
/***************************************************************
Code for scanning finger prints
***************************************************************/
void fp_scan (void)
{
fp_flag = 0;
// Sending command for FP
scanning i=0;
while(i<12)
{
send_char(enroll[i]);
64
i++;
}
// Receiving acknowledge
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
dummy=receive_data();
dummy=receive_data();
if(!rec)
{
gfx_mono_init();
gfx_mono_draw_string("Enrolling ok",0, 0,
&sysfont); _delay_ms(5000);
// Sending command to convert image into
characters i=0;
while(i<13)
{
send_char(generate_ch[i]);
i++;
}
// Receiving acknowledge
rec=receive_data();
rec=receive_data();
rec=receive_data();
65
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
dummy=receive_data();
dummy=receive_data();
if(!rec)
{
gfx_mono_init();
gfx_mono_draw_string("genchar ok",0, 0, &sysfont);
_delay_ms(2000);
gfx_mono_draw_string("Entering to Identify",0, 0,
&sysfont);
_delay_ms(2000);
// Sending command to identify/compare FP with stored
FP image
i=0;
while(i<17)
{
send_char(identify[i]);
i++;
}
// Receiving acknowledge
rec=receive_data();
rec=receive_data();
rec=receive_data();
66
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
rec=receive_data();
dummy=receive_data();
dummy=receive_data();
dummy=receive_data();
dummy=receive_data();
dummy=receive_data();
dummy=receive_data();
if(!rec)
{
fp_flag=1; // Only in case of matching FP this
will be set to 1
gfx_mono_init();
gfx_mono_draw_string("Matched: Open the
door",0, 0, &sysfont);
_delay_ms(5000);
}
else
{
gfx_mono_init();
gfx_mono_draw_string("Not Matched",0, 0,
&sysfont);
_delay_ms(5000);
//goto again;
}
}
67
else
{
gfx_mono_init();
gfx_mono_draw_string("genchar not ok",0, 0,
&sysfont); gfx_mono_draw_char(rec,9,18, &sysfont);
_delay_ms(3000);
//goto again;
}
}
else
{
//goto again;
gfx_mono_init();
gfx_mono_draw_string("1: Enrolling not ok",0, 0, &sysfont);
_delay_ms(2000);
}
}
68
MAJOR_PROJECT

Más contenido relacionado

La actualidad más candente

IRJET- A Review on: Smart and Advanced Living Technology (SALT)
IRJET- A Review on: Smart and Advanced Living Technology (SALT)IRJET- A Review on: Smart and Advanced Living Technology (SALT)
IRJET- A Review on: Smart and Advanced Living Technology (SALT)IRJET Journal
 
Esd notes iae
Esd notes iaeEsd notes iae
Esd notes iaeMuru Gan
 
UBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATION
UBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATIONUBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATION
UBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATIONIJCNCJournal
 
Ethernet based home appliances control
Ethernet based home appliances controlEthernet based home appliances control
Ethernet based home appliances controlIAEME Publication
 
IRJET- Automated System for Office using Arduino and Android
IRJET-  	  Automated System for Office using Arduino and AndroidIRJET-  	  Automated System for Office using Arduino and Android
IRJET- Automated System for Office using Arduino and AndroidIRJET Journal
 
IRJET- Theft Control using IoT
IRJET-  	  Theft Control using IoTIRJET-  	  Theft Control using IoT
IRJET- Theft Control using IoTIRJET Journal
 
Design and implement a smart system to detect intruders and firing using IoT
Design and implement a smart system to detect intruders and firing using IoT Design and implement a smart system to detect intruders and firing using IoT
Design and implement a smart system to detect intruders and firing using IoT IJECEIAES
 
Future Trends of Embedded Systems - Technical Paper Presentation
Future Trends of Embedded Systems - Technical Paper PresentationFuture Trends of Embedded Systems - Technical Paper Presentation
Future Trends of Embedded Systems - Technical Paper PresentationKaushik Gupta
 
Energy Management with Disaster Intimation and Control using IoT
Energy Management with Disaster Intimation and Control using IoTEnergy Management with Disaster Intimation and Control using IoT
Energy Management with Disaster Intimation and Control using IoTIJEACS
 
A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...
A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...
A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...IOSR Journals
 
A New Intelligent Low Cost Mobile Phone Based Irrigation System using ARM
A New Intelligent Low Cost Mobile Phone Based Irrigation System using ARMA New Intelligent Low Cost Mobile Phone Based Irrigation System using ARM
A New Intelligent Low Cost Mobile Phone Based Irrigation System using ARMijsrd.com
 
IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...
IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...
IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...IRJET Journal
 
Home Automation using IOT and Mobile App
Home Automation using IOT and Mobile AppHome Automation using IOT and Mobile App
Home Automation using IOT and Mobile AppIRJET Journal
 
Sms based wireless appliances control
Sms based wireless appliances controlSms based wireless appliances control
Sms based wireless appliances controlSourabh Bhattacharya
 
IoT and connected devices
IoT and connected devicesIoT and connected devices
IoT and connected devicesPascal Bodin
 
IoT and connected devices: an overview
IoT and connected devices: an overviewIoT and connected devices: an overview
IoT and connected devices: an overviewPascal Bodin
 

La actualidad más candente (20)

IRJET- A Review on: Smart and Advanced Living Technology (SALT)
IRJET- A Review on: Smart and Advanced Living Technology (SALT)IRJET- A Review on: Smart and Advanced Living Technology (SALT)
IRJET- A Review on: Smart and Advanced Living Technology (SALT)
 
Esd notes iae
Esd notes iaeEsd notes iae
Esd notes iae
 
UBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATION
UBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATIONUBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATION
UBIQUITOUS SMART HOME SYSTEM USING ANDROID APPLICATION
 
Ethernet based home appliances control
Ethernet based home appliances controlEthernet based home appliances control
Ethernet based home appliances control
 
IRJET- Automated System for Office using Arduino and Android
IRJET-  	  Automated System for Office using Arduino and AndroidIRJET-  	  Automated System for Office using Arduino and Android
IRJET- Automated System for Office using Arduino and Android
 
IRJET- Theft Control using IoT
IRJET-  	  Theft Control using IoTIRJET-  	  Theft Control using IoT
IRJET- Theft Control using IoT
 
Embedded system seminar
Embedded system seminarEmbedded system seminar
Embedded system seminar
 
REPORTOF MEMS2
REPORTOF MEMS2REPORTOF MEMS2
REPORTOF MEMS2
 
Design and implement a smart system to detect intruders and firing using IoT
Design and implement a smart system to detect intruders and firing using IoT Design and implement a smart system to detect intruders and firing using IoT
Design and implement a smart system to detect intruders and firing using IoT
 
Future Trends of Embedded Systems - Technical Paper Presentation
Future Trends of Embedded Systems - Technical Paper PresentationFuture Trends of Embedded Systems - Technical Paper Presentation
Future Trends of Embedded Systems - Technical Paper Presentation
 
Energy Management with Disaster Intimation and Control using IoT
Energy Management with Disaster Intimation and Control using IoTEnergy Management with Disaster Intimation and Control using IoT
Energy Management with Disaster Intimation and Control using IoT
 
A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...
A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...
A Proposed Cost Effective Prototype Model for PLC Based GSM Remote Control in...
 
A New Intelligent Low Cost Mobile Phone Based Irrigation System using ARM
A New Intelligent Low Cost Mobile Phone Based Irrigation System using ARMA New Intelligent Low Cost Mobile Phone Based Irrigation System using ARM
A New Intelligent Low Cost Mobile Phone Based Irrigation System using ARM
 
IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...
IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...
IRJET - Home Appliance Controlling and Monitoring by Mobile Application based...
 
Home Automation using IOT and Mobile App
Home Automation using IOT and Mobile AppHome Automation using IOT and Mobile App
Home Automation using IOT and Mobile App
 
embedded systems
embedded systemsembedded systems
embedded systems
 
Sms based wireless appliances control
Sms based wireless appliances controlSms based wireless appliances control
Sms based wireless appliances control
 
IoT and connected devices
IoT and connected devicesIoT and connected devices
IoT and connected devices
 
Mechatronics for Homeland Security
Mechatronics for Homeland SecurityMechatronics for Homeland Security
Mechatronics for Homeland Security
 
IoT and connected devices: an overview
IoT and connected devices: an overviewIoT and connected devices: an overview
IoT and connected devices: an overview
 

Destacado

Fingerprint based physical access control vehicle immobilizer
Fingerprint based physical access control vehicle immobilizer Fingerprint based physical access control vehicle immobilizer
Fingerprint based physical access control vehicle immobilizer VIKAS SINGH BHADOURIA
 
Design of a gsm based biometric access control system
Design of a gsm based biometric access control systemDesign of a gsm based biometric access control system
Design of a gsm based biometric access control systemAlexander Decker
 
ABF Journal Editor's Letter (October 2014)
ABF Journal Editor's Letter (October 2014)ABF Journal Editor's Letter (October 2014)
ABF Journal Editor's Letter (October 2014)Jill Hoffman
 
Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...
Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...
Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...Roberto Peretta
 
The Gilded Age- Two Point Oh
The Gilded Age- Two Point OhThe Gilded Age- Two Point Oh
The Gilded Age- Two Point Ohmatthewganoe
 
Katalog Maret
Katalog MaretKatalog Maret
Katalog Maretopienoars
 
Ejercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITAL
Ejercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITALEjercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITAL
Ejercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITALJSIERRAP
 
Peoples Friend article
Peoples Friend articlePeoples Friend article
Peoples Friend articleSimone Unett
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security systempraful borad
 
Trabajo desarrollo mental
Trabajo desarrollo mentalTrabajo desarrollo mental
Trabajo desarrollo mentaledisonsuarez95
 
The Progressive Era
The Progressive EraThe Progressive Era
The Progressive Eramatthewganoe
 
marine coastal structures
marine coastal structuresmarine coastal structures
marine coastal structuresShirsak Mondal
 
Hist 12 online the sixties pdf
Hist 12 online   the sixties pdfHist 12 online   the sixties pdf
Hist 12 online the sixties pdfprofheisser
 

Destacado (20)

Fingerprint based physical access control vehicle immobilizer
Fingerprint based physical access control vehicle immobilizer Fingerprint based physical access control vehicle immobilizer
Fingerprint based physical access control vehicle immobilizer
 
Design of a gsm based biometric access control system
Design of a gsm based biometric access control systemDesign of a gsm based biometric access control system
Design of a gsm based biometric access control system
 
Educacion Digital
Educacion DigitalEducacion Digital
Educacion Digital
 
ABF Journal Editor's Letter (October 2014)
ABF Journal Editor's Letter (October 2014)ABF Journal Editor's Letter (October 2014)
ABF Journal Editor's Letter (October 2014)
 
Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...
Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...
Web Presence & Web Reputation as one of my 2016-2017 lectures at the Universi...
 
The Gilded Age- Two Point Oh
The Gilded Age- Two Point OhThe Gilded Age- Two Point Oh
The Gilded Age- Two Point Oh
 
Código qr
Código qrCódigo qr
Código qr
 
Updated Env. Res
Updated Env. ResUpdated Env. Res
Updated Env. Res
 
Katalog Maret
Katalog MaretKatalog Maret
Katalog Maret
 
Ejercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITAL
Ejercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITALEjercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITAL
Ejercicio practica _ presentacion CONSEJO TERRITORIAL DE PLANEACION DISTRITAL
 
Peoples Friend article
Peoples Friend articlePeoples Friend article
Peoples Friend article
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security system
 
Trabajo desarrollo mental
Trabajo desarrollo mentalTrabajo desarrollo mental
Trabajo desarrollo mental
 
охрана первоцветов
охрана первоцветовохрана первоцветов
охрана первоцветов
 
The Progressive Era
The Progressive EraThe Progressive Era
The Progressive Era
 
Conference 5è1st
Conference 5è1stConference 5è1st
Conference 5è1st
 
Fingerprint Based Biometric ATM Authentication System
Fingerprint Based Biometric ATM Authentication SystemFingerprint Based Biometric ATM Authentication System
Fingerprint Based Biometric ATM Authentication System
 
marine coastal structures
marine coastal structuresmarine coastal structures
marine coastal structures
 
Hist 12 online the sixties pdf
Hist 12 online   the sixties pdfHist 12 online   the sixties pdf
Hist 12 online the sixties pdf
 
A017430110
A017430110A017430110
A017430110
 

Similar a MAJOR_PROJECT

IR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docxIR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docxSaikiranBasuthkar
 
NEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeofficeNEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeofficemohammed shoaib uddin
 
Mini final docmtn final
Mini final docmtn finalMini final docmtn final
Mini final docmtn finalAyesha Mubeen
 
Embedded system ppt
Embedded system pptEmbedded system ppt
Embedded system pptP Srinivas
 
Cell phone based automation systems
Cell phone based automation systemsCell phone based automation systems
Cell phone based automation systemsManpreet Chandhok
 
A Short Review on the Perspective of Home Automation Technology
A Short Review on the Perspective of Home Automation TechnologyA Short Review on the Perspective of Home Automation Technology
A Short Review on the Perspective of Home Automation TechnologyIRJET Journal
 
NRF based wireless light and Fan dimmer controlling system.
NRF based wireless light and Fan dimmer controlling system.NRF based wireless light and Fan dimmer controlling system.
NRF based wireless light and Fan dimmer controlling system.IRJET Journal
 
Iirdem implementation of smart homes and industrial automation system with se...
Iirdem implementation of smart homes and industrial automation system with se...Iirdem implementation of smart homes and industrial automation system with se...
Iirdem implementation of smart homes and industrial automation system with se...Iaetsd Iaetsd
 
Keypad Based Bank Locker Security System Using Gsm Technology
Keypad Based Bank Locker Security System Using Gsm TechnologyKeypad Based Bank Locker Security System Using Gsm Technology
Keypad Based Bank Locker Security System Using Gsm TechnologyIJRES Journal
 
Smart Security and Home Automation System using Internet of things
Smart Security and Home Automation System using Internet of thingsSmart Security and Home Automation System using Internet of things
Smart Security and Home Automation System using Internet of thingsIRJET Journal
 
14983184 industrial-security-system-using-auto-dialer
14983184 industrial-security-system-using-auto-dialer14983184 industrial-security-system-using-auto-dialer
14983184 industrial-security-system-using-auto-dialera_subramaniyam
 
IRJET- Home Automation using IoT: Review
IRJET- Home Automation using IoT: ReviewIRJET- Home Automation using IoT: Review
IRJET- Home Automation using IoT: ReviewIRJET Journal
 
137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)Karteek Irukulla
 
Best Embedded Systems Projects Ideas In 2015
Best Embedded Systems Projects Ideas In 2015Best Embedded Systems Projects Ideas In 2015
Best Embedded Systems Projects Ideas In 2015elprocus
 
multiple input control by sms using GSM technology
multiple input control by sms using GSM technologymultiple input control by sms using GSM technology
multiple input control by sms using GSM technologySachin Singh
 
INDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ON
INDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ONINDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ON
INDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ONAnkitkumar Patel
 
smart street light system using IOT
smart street light system using IOTsmart street light system using IOT
smart street light system using IOTKarthikeyan T
 
It 443 lecture 1
It 443 lecture 1It 443 lecture 1
It 443 lecture 1elisha25
 

Similar a MAJOR_PROJECT (20)

IR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docxIR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docx
 
NEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeofficeNEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeoffice
 
Mini final docmtn final
Mini final docmtn finalMini final docmtn final
Mini final docmtn final
 
Embedded system ppt
Embedded system pptEmbedded system ppt
Embedded system ppt
 
Cell phone based automation systems
Cell phone based automation systemsCell phone based automation systems
Cell phone based automation systems
 
A Short Review on the Perspective of Home Automation Technology
A Short Review on the Perspective of Home Automation TechnologyA Short Review on the Perspective of Home Automation Technology
A Short Review on the Perspective of Home Automation Technology
 
NRF based wireless light and Fan dimmer controlling system.
NRF based wireless light and Fan dimmer controlling system.NRF based wireless light and Fan dimmer controlling system.
NRF based wireless light and Fan dimmer controlling system.
 
Iirdem implementation of smart homes and industrial automation system with se...
Iirdem implementation of smart homes and industrial automation system with se...Iirdem implementation of smart homes and industrial automation system with se...
Iirdem implementation of smart homes and industrial automation system with se...
 
Report
ReportReport
Report
 
Keypad Based Bank Locker Security System Using Gsm Technology
Keypad Based Bank Locker Security System Using Gsm TechnologyKeypad Based Bank Locker Security System Using Gsm Technology
Keypad Based Bank Locker Security System Using Gsm Technology
 
Smart Security and Home Automation System using Internet of things
Smart Security and Home Automation System using Internet of thingsSmart Security and Home Automation System using Internet of things
Smart Security and Home Automation System using Internet of things
 
14983184 industrial-security-system-using-auto-dialer
14983184 industrial-security-system-using-auto-dialer14983184 industrial-security-system-using-auto-dialer
14983184 industrial-security-system-using-auto-dialer
 
IRJET- Home Automation using IoT: Review
IRJET- Home Automation using IoT: ReviewIRJET- Home Automation using IoT: Review
IRJET- Home Automation using IoT: Review
 
137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)137.gsm, fprs ,keypad_based_atm_security_(doc)
137.gsm, fprs ,keypad_based_atm_security_(doc)
 
G010133748
G010133748G010133748
G010133748
 
Best Embedded Systems Projects Ideas In 2015
Best Embedded Systems Projects Ideas In 2015Best Embedded Systems Projects Ideas In 2015
Best Embedded Systems Projects Ideas In 2015
 
multiple input control by sms using GSM technology
multiple input control by sms using GSM technologymultiple input control by sms using GSM technology
multiple input control by sms using GSM technology
 
INDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ON
INDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ONINDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ON
INDUSTRIAL AUTOMATION AND SECURITY SYSTEM BASED ON
 
smart street light system using IOT
smart street light system using IOTsmart street light system using IOT
smart street light system using IOT
 
It 443 lecture 1
It 443 lecture 1It 443 lecture 1
It 443 lecture 1
 

MAJOR_PROJECT

  • 1. CHAPTER-1 INTRODUCTION In this project there will be usage of the biometric material ―FINGER PRINT MODULE‖ , ―GSM MODULE‖ and ―KEYPAD‖ and there will be XMEGA 256A3BU microcontroller with the AVR dragon for this dragon is used for the dumping of the code and here we are using ATMEL STUDIO 6.2 software and for the finger print module software used is ―DOCKLIGHT‖. 1.1 AIM: Our main aim our project is to give very high security to the important materials because conventional locks are broken by the seasoned thieves and they were stealing important materials. 1.2 MOTIVATION: Since, so many robberies happening in and around world and so many important things or materials are stolen and in a room if there is computer files are corrupted trough the entering of that particular door. hence, we get motivated to design this particular project ,so that unauthorized person can enter into that room without the permission of the authorized person. 1.3 OBJECTIVE: The main objective of our project is to design an intelligent and programmable system by using FINGER PRINT MODULE and KEYPAD MODULE and also GSM MODE for high security area, by using XMEGA 256A3BU microcontroller. Only authorized person can enter into the room. In this project we are having three modules, Fingerprint module and GSM mode with two level security. The main objective of this project is that it provides very high security. The main documents will not be corrupted and also there will be protection to our important things which are placed in the room. 1
  • 2. Hence, we can allow only the authorized person to enter into the room and there will be three modes in our project they are : 1.) Finger print mode. 2.) Keypad mode. 3.) GSM activated keypad mode. And hence with these three modes person(i.e.Authorized person) can enter into the room and if the person cannot enter into the room then the control goes to ―selection of the mode‖ which will be displaying on screen. This is the main objective of our project and it is mainly used for the very high security purpose in which important things will not lost. 2
  • 3. CHAPTER-2 INTRODUCTION TO THE EMBEDDED SYSTEMS 2.1 Embedded system: An embedded system is a special-purpose system in which the computer is completely encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs one or a few predefined tasks, usually with very specific requirements. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, benefiting from economies of scale. Personal digital assistants (PDAs) or handheld computers are generally considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand. With the introduction of the OQO Model 2 with the Windows XP operating system and ports such as a USB port — both features usually belong to "general purpose computers", — the line of nomenclature blurs even more Physically, embedded systems ranges from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. In terms of complexity embedded systems can range from very simple with a single microcontroller chip, to very complex with multiple units, peripherals and networks mounted inside a large chassis or enclosure. Fig 2.1. Embedded kit 3
  • 4. 2.2 Applications of Embedded System: Embedded Systems has witnessed tremendous growth in the last one decade. Almost all the fast developing sectors like automobile, aeronautics, space, rail, mobile communications, and electronic payment solutions have witnessed increased use of Embedded technologies. Greater value to mobility is one of the prominent reasons for the rise and development of embedded technologies. Initially, Embedded Systems were used for large, safety-critical and business-critical applications that included  Rocket & satellite control    Energy production control    Telephone switches  Air Traffic Control Embedded Systems research and development is now concerned with a very large proportion of the advanced products designed in the world. In one way, Embedded technologies run global transport industry that includes avionics, space, automotive, and trains. But, it is the electrical and electronic appliances like cameras, toys, televisions, home appliances, audio systems, and cellular phones that really are the visual interface of Embedded Systems for the common consumer. Advanced Embedded Technologies are deployed in developing  Process Controls (energy production and distribution, factory automation and optimization) Telecommunications (satellites, mobile phones and telecom networks),    Energy management (production, distribution, and optimized use)    Security (e-commerce, smart cards)  Health (hospital equipment and mobile monitoring) In the last few years the emphasis of Embedded technologies was on achieving feasibility, but now the trend is towards achieving optimality. Optimality or optimal design of embedded systems means  Targeting a given market segment at the lowest cost and delivery time possible    Seamless integration with the physical and electronic environment.    Understanding the real-world constraints such as hard deadlines, reliability, availability, robustness, power consumption, and cost.  4
  • 5. 2.3 Automobile sector Automobile sector has been in the forefront of acquiring and utilizing Embedded technology to produce highly efficient electric motors. These electric motors include brushless DC motors, induction motors and DC motors, that use electric/electronic motor controllers. European automotive industry enjoys a prominent place in utilizing Embedded technology to achieve better engine control. They have been utilizing the recent Embedded innovations such as brake-by-wire and drive-by-wire. Embedded technology finds immediate importance in electric vehicles, and hybrid vehicles. Here Embedded applications bring about greater efficiency and ensure reduced pollution. Embedded technology has also helped in developing automotive safety systems such as the  Anti-lock braking system (ABS)    Electronic Stability Control (ESC/ESP)    Traction control (TCS)    Automatic four-wheel drive   2.4 Aerospace & Avionics Aerospace and Avionics demand a complex mixture of hardware, electronics, and embedded software. For efficient working, hardware, electronics and embedded software must interact with many other entities and systems. Embedded engineers confront major challenges,  Creating Embedded systems on time    Taking the budgetary constraints into consideration    Ensuring that the complex software and hardware interactions are right    Assembling components that meet specifications and perform effectively together    Understanding the larger context of the embedded software    Adopting the latest in Embedded technology like the fly-by-wire   2.5 Telecommunications If ever there is an industry that has reaped the benefits to Embedded Technology, for sure, it is only Telecommunications. The Telecom industry utilizes numerous embedded systems from telephone switches for the network to mobile phones at the end-user. The Telecom computer network also uses dedicated routers and network bridges to route data. 5
  • 6. Embedded engineers help in ensuring high-speed networking. This is the most critical part of embedded applications. The Ethernet switches and network interfaces are designed to provide the necessary bandwidth. These will allow in rapidly incorporating Ethernet connections into advanced Embedded applications. 2.6 Consumer Electronics Consumer electronics has also benefited a lot from Embedded technologies. Consumer electronics includes  Personal Digital Assistants (PDAs)    MP3 players    Mobile phones    Videogame consoles    Digital cameras    DVD players    GPS receivers    Printers  Even the household appliances, that include microwave ovens, washing machines and dishwashers, are including embedded systems to provide flexibility, efficiency and features. The latest in Embedded applications are seen as advanced HVAC systems that uses networked thermostats to more accurately and efficiently control temperature. In the present times, home automation solutions are being increasingly built on Embedded technologies. Home automation includes wired and wireless-networking to control lights, climate, security, audio/visual, surveillance, etc., all of which use embedded devices for sensing and controlling. 2.7 Railroad Railroad signalling in Europe relies heavily on embedded systems that allows for faster, safer and heavier traffic. Embedded technology has brought a sea of change in the way Railroad Signals are managed and Rail traffic in large volumes is streamlined. The Embedded technology enabled Railroad Safety Equipment is increasingly being adopted by Railway networks across the globe, with an assurance of far lesser Rail disasters to report. 6
  • 7. 2.8 Electronic payment solutions sector In the present times there is stiff competition amongst Embedded solutions providers to deliver innovative, and high-performance electronic payment solutions that are easy to use and highly secure. Embedded engineers knowledge able in trusted proprietary technology develops the secure, encrypted transactions between payment systems and major financial institutions. The market for mobile payments systems is growing rapidly. It is driven by retailers, restaurants, and other businesses that want to service customers anywhere, anytime. With the use of mobile devices, mostly mobile phones becoming very popular, Embedded technologies compatible with mobile are being developed to promote payment systems. 7
  • 8. CHAPTER-3 HARDWARE REQUIREMENTS 3.1 BLOCK DIAGRAM: Power supply Finger print module XMEGA 256A3BUKeypad 4x3 Digital lock GSM module Fig .3.1. Block diagram of our project This is the block diagram of ―programmable intelligent door locking system with two level using biometrics‖ .In this block diagram there will be ATMEL ―XMEGA 256A3BU‖ microcontroller, ―POWER SUPPLY‖, ―FINGER PRINT MODULE‖, ―KEYPAD 4*3, ―GSM MODULE‖ and ―DIGITAL LOCK‖. Now let‘s see the brief explanation of each block and we will see its features in detail. 8
  • 9. 3.2 MICRO-CONTROLLER (XMEGA 256A3BU): Fig 3.2. XMEGA 256A3BU Microcontroller The Atmel AVR Xplained kits are great platforms for early evaluation of the capabilities offered by the Atmel AVR microcontrollers. The XMEGA-A3BU Xplained contain one QTouch button sensor, three mechanical buttons, two LEDs, 3 analog sensors, a USB port, battery backup system and a 128x32 pixel FSTN LCD display. The AVR Xplained expansion headers provide easy access to analog and digital I/O pins. The board is powered by the USB cable and equipped with the standard 10-pin JTAG header that connects to the full range of AVR debuggers. Key features:  Keep RTC running in the backup system while main power is absent    Display data on the 128x32 pixels of the FSTN LCD display    Read temperature sensor with the ADC  9
  • 10.  Read light sensor with the ADC    Use the Atmel QTouch library to detect touches on the touch button    Read/write data to the 64Mbit Atmel Data Flash    3 push buttons to interact with the microcontroller    4 LEDs to show status information    Program the kit via USB boot loader or an Atmel programmer    Expand the board with Xplained top modules.  3.2.1 Operation of the microcontroller: To be able to run the preprogrammed code, you need to connect the Atmel AVR XMEGA-A3BU Xplained evaluation kit with a USB cable (standard A to mini-B or mini AB) to a PC or USB hub. Once the kit is powered it is possible to browse the menu system with the on-board mechanical buttons and the touch button. The functions for the buttons are: • Top left mechanical button (SW0): Enter a menu • Bottom left touch button (QTB0): Return from a menu • Top right mechanical button (SW1): Browse the menu up • Bottom right mechanical button (SW2): Browse the menu down The demo application allows also the XMEGA-A3BU Xplained board to communicate with a computer using USB with a CDC (Communications Device Class) setup, allowing the keyboard to be used to navigate in the demo application. When the XMEGA-A3BU Xplained board is connected for the first time, Windows will try to install a driver for ―Virtual CDC Com‖. A driver file, XPLAINED_Virtual_Com_Port.inf, is located in the demo application directory or can be downloaded from the Atmel If the driver is successfully installed, the board will show up in the Device Manager under Ports (XPLAINED Virtual Com Port (COM**)). This COM port can now be interfaced with your favorite terminal software. The connection parameters are as follows: • Baud rate: 115200 baud • Data bits: 8 • Parity: None • Stop bits: 1 • Flow control: None 10
  • 11. If the connection has been successfully established, you should be greeted by this text on the screen of your terminal: Welcome to the XMEGA-A3BU Xplained Demo CDC interface! Key bindings for LCD menu control: Enter : Enter Backspace : Back Arrow Up : Up Arrow Arrow Down : Down Arrow The demo application for the XMEGA-A3BU Xplained is available through the Atmel AVR Software Framework (ASF), version 2.6.0 or later. The demo application is available as an example project in AVR Studio® 5 and can be accessed by clicking: File -> New -> Example Project, and selecting ―Demo application for XMEGA-A3BU Xplained‖. In-depth documentation for the demo application is available in the XMEGA-A3BU Xplained Software User Guide. To modify the example code or write new code and compile it, you need a toolchain for the Atmel AVR microcontrollers and an IDE to edit and debug code. 3.2.2 Connecting a kit: Connect a USB cable between the board and a PC or a USB power supply to power the kit. This is all that is needed. When power is applied the power/status LED will light up in green. Do not power the board without having the jumper next to the USB connector or an Ampere meter mounted. Otherwise, the device may be damaged. When connecting the Atmel XMEGA-A3BU Xplained to a PC, the operating system will request a driver file for installing the serial communication driver. This driver file is available in the zip-file associated with this document. The driver file supports both 32-bit and 64-bit versions of Windows® XP and Windows 7. Driver installs are not necessary on Linux® operating systems. 11
  • 12. 3.3 FINGER PRINT MODULE R305: In fingerprint we will be considering mainly two parts. They are 1) Ridges 2) Valleys Ridges are the lines which are present on our fingers and the gaps between two ridges are Valleys. Fingerprint ridges are formed during the third to fourth month of fatal development. The ridges begin to develop on the skin of the thumbs and fingers. The purpose of these ridges is to give the fingers a firmer grasp and to avoid slippage. These ridges allow the fingers to grasp and pick up objects. The friction ridges on the fingers arrange themselves in more or less regular patterns with ridge characteristics. All fingerprints have a unique combination and arrangement of patterns and ridge characteristics. These patterns of friction ridges contain rows of sweat pores that allow sweat and or oil to exit from glands. Sweat mixed with other body oils and dirt produces fingerprints on smooth surfaces. Fingerprints are left by the transfer of oils or amino acids to a surface, from the transfer of substances on the fingers like paint or blood or by leaving an impression print in a soft substance. No two prints have ever been found to be exactly alike. Even those of identical twins are different. Fingerprints are not inherited. The general pattern may be the same in families but the level 2 and 3 details will differ. After formation, the growing fingerprint ridges expand uniformly in all directions while growth is occurring so the pattern never changes. Finger prints cannot be altered without creating a new unique fingerprint. Even when the skin tissue is injured, the skin that grows back will have the same print. Prints remain the same throughout life. The prints that someone is born with won‘t change until decomposition after death. And this is the best biometric material in which we can use in the security system and there will be different finger prints for each individual and no two finger prints will be same in 12
  • 13. the world and this is this biometric material (finger print module) is used for the security system. Fig 3.3. Finger print module Features:  Complete embedded platform for robust products    Optical fingerprint sensors for reliability    Multiple module to select from as per your application needs    Full development support and reference designs    Low cost    Quick development and product launches  13
  • 14. 3.4 KEYPAD 4x3: Keypad used is 4x3 keypad, this is mainly used to type the password so that door opens and the authorized person can enter into the room and in this keypad there will be four rows and three columns . Through this keypad the authorized person will be entering the password and if he/she enters the correct password then the door will be opened and if authorized person enters wrong password then the door will be not opened and the control enters into the ―selection of the mode‖ which will be displayed on the screen. Fig 3.4. Keypad 4x3 3.5 GSM MODULE: GSM (Global System for Mobile) / GPRS (General Packet Radio Service) TTL – Modem is SIM900 Quad-band GSM / GPRS device, works on frequencies 850 MHZ, 900 MHZ, 1800MHZ and 1900 MHZ. It is very compact in size and easy to use as plug in GSM Modem. The Modem is designed with 3V3 and 5V DC TTL interfacing circuitry, which allows User to directly interface with 5V Microcontrollers (PIC, AVR, Arduino, 8051, etc.) as well as 3V 3Microcontrollers (ARM, ARM Cortex XX, etc.). The baud rate can be 14
  • 15. configurable from 9600-115200 bps through AT (Attention) commands. This GSM/GPRS TTL Modem has internal TCP/IP stack to enable User to connect with internet through GPRS feature. It is suitable for SMSas well as DATA transfer application in mobile phone to mobile phone interface. The modem can be interfaced with a Microcontroller using USART (Universal Synchronous Asynchronous Receiver and Transmitter) feature (serial communication). The main operation of the GSM Module is that it is used to sending and receiving the number of messages and even it is used for calling and for deactivate the call from any region and there will be some of the AT(attention) commands for sending and receiving the messages and for calling and deactivating the call and even there will be commands for holding the current call . This is about the GSM module. Fig .3.5. GSM module 15
  • 16. Features:  Quad Band GSM/GPRS : 850 / 900 / 1800 / 1900 MHz    Built in RS232 to TTL or vice versa Logic Converter (MAX232)    Configurable Baud Rate    SMA (Sub Miniature version A) connector with GSM L Type Antenna    Built in SIM (Subscriber Identity Module) Card holder    Built in Network Status LED Inbuilt Powerful TCP / IP (Transfer Control Protocol / Internet Protocol) stack for internet data transfer through GPRS (General Packet Radio Service)    Audio Interface Connectors (Audio in and Audio out)    Most Status and Controlling pins are available    Normal Operation Temperature : -20 °C to +55 °C    Input Voltage : 5V to 12V DC    LDB9 connector (Serial Port) provided for easy interface  16
  • 17. CHAPTER-4 SOFTWARE REQUIREMENTS 4.1 ATMEL STUDIO 6.2: Starting Atmel Studio Atmel Studio is started by clicking on the Atmel Studio 6.2 shortcut in the Start-Up menu. Once started, the start page is displayed. From within this page you can create new projects and reopen recently used projects, as well as browse through articles providing tutorials, help and news. The Start page can also be accessed from View→Start Page, or Alt+V+G. Fig.4.1 The Project related section of the Start Page 17
  • 18. The left section of the start page contains project-related items:  New project - Use this to create a new project. If you are very new to the concept of software development with Atmel Studio, refer to the step-by-step guides. The project settings and available options are described in detail in Project Management    New example project - To take a step-by-step tour of the available Atmel platforms' functionalities using the AVR Software Framework, click this button.    Open project - Load an existing project, not mentioned on the Recent projects pane The Recent projects lists the most recently opened projects. Clicking on any of the links will open the project, restoring it and the GUI to its last saved settings. You can select the number of projects you would like to be shown in the Menus and settings.  The Get Started section The Get Started tab contains the Welcome page, The Welcome page contains an overview, new features and some of the common Q&A about the current Atmel Studio release. Getting started: New project contains information about the AVR Software Framework and the tutorials to get you proficient with the new and existing tools quickly. Extending the Atmel studio allows you to browse and install extensions from an online gallery of third-party extensions to the Atmel Studio IDE and from the updates catalog for the IDE. The Tutorials page lists a set of basic tutorials. The Links and resources page leads to online resources for prototyping and product ordering and information.The AVR Tools Help section 18
  • 19. Fig.4.2. The AVR Tools Help section The AVR Tools Help section contains help on AVR software and hardware platforms. The following information‘s is found here:  Starter kits tab contains information on starter kits.    Debuggers contains information on compatible debuggers.    Programmers contains information on AVR ISP mkII, the universal in- system programmer for all AVR tools.    Touch kits contains information on touch sensor platforms.    Wireless kits contains information on platforms with RF transceivers.    Evaluation kits contains information on a large set of evaluation kits..    Software contains help on Atmel Studio and other ATMEL installed software components.  19
  • 20. 4.2 Prerequisites The following software and hardware are required for this training. Atmel Studio 6.2 IDE Atmel Studio Terminal Extension XMEGA-A3BU Xplained evaluation kit AVR Dragon Programmer/Debugger One mini-B USB cable to connect XMEGA-A3BU Xplained kit and one USB type B cable to connect AVR Dragon 4.3 Hardware Setup This section explains about the hardware setup to be followed to accomplish the training. This section assumes that the Atmel Studio 6.2 IDE has been installed on the PC already. TODO Unpack the AVR Dragon kit and connect the kit to PC using USB type B cable as shown below. Fig 4.3. AVR Dragon 20
  • 21. Once connected, the required drivers for the AVR Dragon will be automatically installed. Proper driver installation can be verified in the ‗Device Manager‘ window which should show ‗AVR Dragon‘ under ‗Jungo‘ as shown below. Fig.4.4. Selecting AVR Dragon The next step is to verify the firmware of the AVR Dragon tool to make sure that it is up to date. TODO Open Atmel Studio IDE and select the option ‗View‘ -> ‗Available Atmel Tools‘ as shown below. Fig.4.5. Connecting AVR Dragon 21
  • 22. TODO Right click on the AVR Dragon tool in ‗Available Atmel Tools‘ and select the option ‗Upgrade‘ as shown below. Fig4.6. Upgrading AVR Dragon This is done to ensure that the firmware on the AVR Dragon is up-to-date with the Atmel Studio IDE. If the firmware is not up-to-date, Atmel Studio will prompt for upgrade as shown below. Click on the ‗Upgrade‘ button to upgrade the firmware. TODO Unpack the XMEGA-A3BU Xplained kit and connect it to computer using mini-B USB cable as shown below. Fig.4.7. USB Connection 22
  • 23. The kit comes with a preprogrammed demo application and it also enumerates as USB CDC device in computer. So when the kit is connected, CDC driver will be installed. Fig.4.8. JTAG Connection Open ‗Device Programming‘ window from ‗Tools‘ -> ‗Device Programming‘ as shown below. Fig.4.9. Device programming 23
  • 24. 4.4 Opening Atmel Studio Project This section explains how to open a simple Atmel Studio project and how to configure the device selection. TODO Open Atmel Studio 6.2 from start menu and select the option ‗File -> New Project‘ as shown below. Fig.4.10. Opening Atmel project. TODO Now select the option ‗AVRGCC C Executable Project‘. You may select a project name and directory as needed. For this case let us use the project name ‗XMEGA_Training‘ and let the directory be the Documents atmel studio6.2‘ as shown below. Fig.4.11. Selecting executable project. 24
  • 25. Now the device selection window will appear. TODO In the search box, search for ‗xmega256a3bu‘ and select the device ‗ATxmega256A3BU‘ and click OK as shown below. Fig.4.12. Selecting microcontroller. This opens an Atmel Studio project with name ‗XMEGA_Training‘ and with a main C file ‗XMEGA_Training.c‘ which can be viewed from the ‗Solution Explorer‘ as shown below. 25
  • 26. Fig.4.13. Solution explorer. Double click on the ‗XMEGA_Training.c‘ file in the solution explorer which opens the C file in the workspace. This file has a basic code snippet which Includes a header file ‗avr/io.h‘ and has a main() function with an empty while(1) loop. We will add code to this file in the upcoming sections.  This section explains how the XMEGA PORT should be configured as general purpose input/output and how to read/write values to GPIO pins.  More specifically, in this handson, we will use one push button and one LED available on the XMEGA-A3BU Xplained board. Navigate to the path ‗Training_PackageDay_1XMEGA_A3BU_XPLD_Docs‘ and open the ‗XMEGA_A3BU_XPLD_Schematics.zip‘ file. This file contains the PDF document of theXMEGA-A3BU Xplained board schematics. TODO Modify the ‗XMEGA_Training.c‘ file so that it looks as below. 26
  • 27. #include <avr/io.h> int main(void) { PORTE.DIRCLR = PIN5_bm; PORTR.D IRSET = PIN0_bm; while(1) { PORTR.OUT = (PORTE.IN >> 5); } } Fig.4.14. Building solution. Above figure shows how to bulid a solution. TODO Select ‗Project‘ -> ‗XMEGA_Training Properties‘. Now select the ‗Tool‘ tab and configure the AVR Dragon tool as shown below. 27
  • 28. Fig.4.15. Configuring AVR Dragon. 4.5. Handson II – Monochrome GFX on XMEGA This section explains how to setup the Atmel Studio project and configure the XMEGA device to make use of the on-board LCD display. The on-board LCD display has a resolution of 128x32 pixels with X-Y co- ordinate (0,0) starting at the top left position. This display is controlled through SPI interface and is connected to USARTD0 peripheral configured as SPI master in ATxmega256A3BU device. TODO Clear all the port related code in ‗XMEGA_Training.c‘ file and keep the main() function with while(1) loop as below. #include <avr/io.h> int main(void) { 28
  • 29. while(1) { } } TODO Copy the folder ‗gfx_library‘ and paste it in the project directory where ‗XMEGA_Training.c‘ file exists. This folder contains all the source code for the low level LCD driver, the monochrome graphics library and the monochrome system font library. This folder and the associated code should now be included in the project in ‗Solution Explorer‘. TODO Click the ‗Show Files‘ icon in the solution explorer as shown below which will list all the files/folders in the project directory. The files/folders that are not included in the project will be shown as empty icons. TODO Right click on folder ‗gfx_library‘ and click the option ‗Include in project‘ as shown below. Fig.4.16. Selecting GFX library. TODO The gfx library path should also be added in the project directories. Open 29
  • 30. ‗Project -> XMEGA Training properties ->Toolchain -> AVR/GNU C Compiler -> Directories‘. Click the ‗Add item‘ button and type the following ‗../gfx_library‘ (without codes) and click OK as shown below. Fig.4.17. Directories. Now common macro definitions for the graphics library has to be added in the project settings. TODO Open ‗Project -> XMEGA Training properties ->Toolchain -> AVR/GNU C Compiler -> Symbols‘. Click the ‗Add item‘ button and add the following macro definitions one by one. F_CPU=32000000UL GFX_MONO_C12832_A1Z=1 The first macro is used by the delay routines to determine the number of CPU cycles per microsecond used by the LCD driver and the second macro defines the LCD type used by the graphics library. TODO Now open ‗XMEGA_Training.c‘ file and include the following header files next to io.h file include. 30
  • 31. #include "gfx_mono.h" #include "gfx_mono_text.h" #include "sysfont.h" These header files includes all the necessary graphics and system font library files. The next step is to make the device running at 32MHz frequency (max speed). By default, when the device is powered up, the device will start running at 2MHz frequency generated by the internal 2MHz RC oscillator. Since the graphics library needs more CPU performance we will make the CPU running at its full speed of 32MHz using the on-chip dedicated 32MHz ring oscillator. TODO Add the following code before while(1) loop in main() function. OSC.CTRL |= OSC_RC32MEN_bm; while(!(OSC.STATUS & OSC_RC32MRDY_bm)); CCP = CCP_IOREG_gc; CLK.CTRL = CLK_SCLKSEL_RC32M_gc; The above code first enables the internal 32MHz oscillator through the oscillator control register and then waits in a while loop until the corresponding ready bit in STATUS register is set. It then switches the main clock to 32MHz oscillator after writing the CCP register (Configuration Change Protection register). Write to CCP register is mandatory when switching the main clock otherwise the clock switch will not happen for security reason. TODO Add the following code before while(1) loop and after clock switching 31
  • 32. snippet. gfx_mono_init(); PORTE.OUTSET = PIN4_bm; gfx_mono_draw_string("Hello World!", 0, 0, &sysfont); The function ‗gfx_mono_init()‘ will initialize the graphics library as well as the low level LCD drivers and the USART SPI module. From the schematic document the backlight for LCD module is connected to PORTE pin 4 of the ATxmega256A3BU device. Setting this pin to logic high state will enable the LCD backlight and vice versa. The second line in the above snippet sets a logic high state on the backlight pin. The function ‗gfx_mono_draw_string()‘ is used to print a string on the LCD display. The first argument is the actual string, the second and third arguments represent the X and Y co- ordinates respectively and the fourth argument is the pointer to the system font structure. The final code should look as below. #include <avr/io.h> #include "gfx_mono.h" #include "gfx_mono_text.h" #include "sysfont.h" int main(void) 32
  • 33. { OSC.CTRL |= OSC_RC32MEN_bm; while(!(OSC.STATUS & OSC_RC32MRDY_bm)); CCP = CCP_IOREG_gc; CLK.CTRL = CLK_SCLKSEL_RC32M_gc; gfx_mono_init(); PORTE.OUTSET = PIN4_bm; gfx_mono_draw_string("Hello World!", 0, 0, &sysfont); while(1) { ; } } TODO Run the project by hitting F5. 33
  • 35. CHAPTER-5 RESULT 5.1 RESULT ANALYSIS: In this project there will be three modes, they are: 1.) Mode 1: Finger print mode. 2.) Mode 2: keypad mode. 3.) Mode 3: GSM and keypad mode. 1.) Mode 1: Finger print mode. Initially when we power ―ON‖ the supply then the LCD displays ―welcome! select the mode‖ and then here we have to select the mode as mode 1from the keypad and then it displays ―checking for mode‖ and it enters into the finger print mode then it displays ―please scan your finger!‖ and immediately when person places finger it displays ―countdown 5,4,3,2,1‖ and it enrolls the finger and it displays ―enroll ok‖ and ―genchar ok‖ , ―successful matching of finger print !‖ and it displays ―matched open the door !‖ if it does not matches then the control goes to the selection mode that is it displays ―welcome ! select the mode‖. Screen shot.5.1. Finger print mode 35
  • 36. 2.) Mode 2: Keypad mode. When the person selects the mode 2 then the control goes to the keypad by pressing 2 on the keypad now it displays ―Enter key!‖ ,if the key matches then the control enters into the keypad and it displays ―Enter password now!‖and if password matches then the LCD displays ―matched! Open the door‖ and if the password does not matches the controls goes to the selection mode and it displays ―Welcome! Select the mode‖. Screen shot..5.2. Keypad mode. 3.) Mode 3:GSM and keypad. When the person selects mode 3 then the control goes to the GSM and then here we have to press 3 on keypad and LCD displays ―waiting for owner‖ and then when authorized person(owner) calls to the GSM module and if cell number matches with the GSM then LCD displays ―Enter GSM password!‖ and if the password matches then LCD displays ― GSM password accepted!‖ and it displays ―matched ! open the door‖ and if the password does not matches the control goes to the selection mode and it displays ―welcome! Select mode.‖ 36
  • 37. Screen shot.5.3. GSM activated with Keypad mode. 37
  • 38. CONCLUSION In this way we have successfully implemented ―programmable intelligent door locking system with two level of security.‖This project can be used at high security area such as banks, homes, offices and corporate companies. Here, we are two level security because, if unauthorized person hacks password then that person may enter the room and stoles important things i.e..robbery Hence we are keeping two levels of security. 38
  • 39. FUTURE SCOPE When person enters into the room in any case if that person is injured severely then no one can know outside if there is only person in the room. In this case there will be a camera inside the room so that owner can view when a person got injured. 39
  • 40. APPENDIX Program code: /* * final.c * * Created: 12-02-2015 17:36:55 * */ #include <avr/io.h> #include "gfx_mono.h" #include "gfx_mono_text.h" #include "sysfont.h" #include "string.h" #define F_CPU 32000000ul #include <util/delay.h> void Set_Clk_32MHz(void); //Configuring UART on PORTC to connect Finger Print Module void uart_init(void); void send_char(char data); void send_string(char *str); char receive_data(void); //Configuring UART on PORTE to connect GSM void uart_init2(void); void send_char2(char data); void send_string2(char *str); void receive_data2(void); // Keypad scanning unsigned char scan_key(void); unsigned char scan_pass(void); void print_pass (void); 40
  • 41. // Mode-1: Function, Commands and variables required for Finger Print Module scanning void fp_scan (void); unsigned char i=0,fp[20],j=0,str[4],s=0,rec,dummy,fp_flag=0; unsigned char enroll[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05}; unsigned char generate_ch[13]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X04,0x02,0X02,0X00,0X09}; //unsigned char store[15]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X06,0X06,0X01,0x00,0x01,0x0 0,0x0F}; //unsigned char identify[17]={0xEF,0X01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x08,0x1B,0x01,0x00,0x00,0x01, 0x01,0x00,0x27}; unsigned char identify[17]={0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X08,0X04,0X02,0X00,0X00 ,0X00,0X04,0X00,0X13}; //unsigned char identify[17]={0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X08,0X04,0X02,0X00,0X00 ,0X00,0X08,0X00,0X17}; // Mode-2: Two layer password protection entering through keypad unsigned char pass1[5]="147*", pass2[5]="369#"; // Mode-3: Password checking after getting approval through GSM calling unsigned char passgsm[5]="2580"; unsigned char mynum1[11]="9014099933", mynum2[11]="9032549675",mynum3[11]="8801133111"; unsigned char mynum4[11]="9347517427"; unsigned char gsm_flag = 0; // Variable declaration for storing entered/received data through keypad/GSM unsigned char pwdval[5]; unsigned char msg[52],chknum[11]; 41
  • 42. unsigned char pwd[4]; //unsigned char rx=0, key_count=0; unsigned int rx=0, key_count=0; unsigned char mykey, door_lock; /**************************************************************************** ******** main () ***************************************************************************** ********/ int main(void) { unsigned char data; Set_Clk_32MHz(); uart_init2(); // GSM Module uart_init(); // Finger Print Module // Relay output to control lock on/off PORTA_DIRSET |= 0x01; // PA0 : Showing it through LED On/Off PORTF_DIRCLR |= 1<<1; // SW1 on boards PORTF_PIN1CTRL |= 0x18; // SW1 for direct open lock from inside house PORTA_DIRSET=0xf0; // Keypad Rows as Output R1=PA4, R2=PA5, R3=PA6, R4=PA7 PORTB_DIRCLR=0x0f; // Keypad Columns as Input C1=PB1, C2=PB2, C3=PB3; // PB0 for FP scanning switch // Setting INPUT pins as PULLUP PORTB_PIN1CTRL |= 0x18; PORTB_PIN2CTRL |= 0x18; 42
  • 43. PORTB_PIN3CTRL |= 0x18; PORTB_PIN0CTRL |= 0x18; // Enabling LCD Backlight PORTE.OUTSET = PIN4_bm; again: door_lock = 0; PORTA_OUTCLR = PIN0_bm; gfx_mono_init(); gfx_mono_draw_string("Welcome! Select Mode!",0, 0, &sysfont); _delay_ms(2000); while(1) { gfx_mono_init(); gfx_mono_draw_string("Welcome! Select Mode!",0, 0, &sysfont); key_count = 0; _delay_ms(100); while (key_count<=0) { //mykey = scan_key(); mykey = scan_pass(); //gfx_mono_init(); //gfx_mono_draw_string("MyChar is ", 0, 0, &sysfont); //gfx_mono_draw_char(key_count, 9, 18, &sysfont); //gfx_mono_draw_char(mykey, 9, 18, &sysfont); 43
  • 44. //_delay_ms(1000); } gfx_mono_init(); gfx_mono_draw_string("Checking for mode", 0, 0, &sysfont); _delay_ms(2000); if (mykey == '1') // Mode-1 { gfx_mono_draw_string("Please scan your finger!",0, 0, &sysfont); _delay_ms(2000); gfx_mono_draw_string("Count down: 5",0, 0, &sysfont); _delay_ms(1000); gfx_mono_draw_string("Count down: 4",0, 0, &sysfont); _delay_ms(1000); gfx_mono_draw_string("Count down: 3",0, 0, &sysfont); _delay_ms(1000); gfx_mono_draw_string("Count down: 2",0, 0, &sysfont); _delay_ms(1000); gfx_mono_draw_string("Count down: 1",0, 0, &sysfont); _delay_ms(1000); fp_scan(); if (fp_flag == 1) { gfx_mono_init(); gfx_mono_draw_string("Successful matching of finger Print!",0, 0, &sysfont); door_lock = 1; _delay_ms(1000); } 44
  • 45. } else if (mykey == '2') // Mode-2 { gfx_mono_init(); gfx_mono_draw_string("Enter Key!",0, 0, &sysfont); _delay_ms(1000); key_count = 0; while (key_count<4) { //mykey = scan_key(); mykey = scan_pass(); //pwdval[key_count-1] = mykey; //gfx_mono_init(); //gfx_mono_draw_string("MyChar Key is", 0, 0, &sysfont); //gfx_mono_draw_char(mykey, 9, 18, &sysfont); //_delay_ms(1000); } gfx_mono_init(); gfx_mono_draw_string(pwdval, 0, 0, &sysfont); gfx_mono_draw_string(pass1, 9, 18, &sysfont); _delay_ms(2000); if (!(strncmp(pass1,pwdval,4))) { gfx_mono_init(); gfx_mono_draw_string("Enter Password Now!",0, 0, &sysfont); _delay_ms(2000); key_count = 0; 45
  • 46. while (key_count<4) { //mykey = scan_key(); mykey = scan_pass(); //pwdval[key_count-1] = mykey; //gfx_mono_init(); //gfx_mono_draw_string("MyChar is PWD", 0, 0, &sysfont); //gfx_mono_draw_char(mykey, 9, 18, &sysfont); //_delay_ms(1200); } if (!(strncmp(pass2,pwdval,4))) { gfx_mono_init(); gfx_mono_draw_string("Your Password Accepted!",0, 0, &sysfont); door_lock = 1; _delay_ms(2000); } } else { gfx_mono_init(); gfx_mono_draw_string("Your first key failed!",0, 0, &sysfont); _delay_ms(2000); goto again; } } else if (mykey == '3') // Mode-3 { gfx_mono_init(); 46
  • 47. gfx_mono_draw_string("Waiting for owner!",0, 0, &sysfont); _delay_ms(1000); receive_data2(); if (gsm_flag == 1) { gfx_mono_init(); gfx_mono_draw_string("Enter GSM password!",0, 0, &sysfont); _delay_ms(1000); key_count = 0; while (key_count<4) { mykey = scan_pass(); //mykey = scan_key(); //pwdval[key_count-1] = mykey; //gfx_mono_init(); //gfx_mono_draw_string("MyChar GSM is ", 0, 0, &sysfont); //gfx_mono_draw_char(mykey, 9, 18, &sysfont); //_delay_ms(1200); } if (!(strncmp(passgsm,pwdval,4))) { door_lock = 1; gfx_mono_init(); gfx_mono_draw_string("GSM password accepted!",0, 0, &sysfont); _delay_ms(1000); } else { 47
  • 48. gfx_mono_init(); gfx_mono_draw_string("Sorry, not matched!",0, 0, &sysfont); _delay_ms(1000); } } else { gfx_mono_init(); gfx_mono_draw_string("GSM authnty failed!",0, 0, &sysfont); _delay_ms(3000); } } else { goto again; } if (door_lock == 1) { gfx_mono_init(); gfx_mono_draw_string("Door is opening!",0, 0, &sysfont); PORTA_OUTSET = PIN0_bm; _delay_ms(5000); } //receive_data(); //_delay_ms(100); //mykey = scan_key(); 48
  • 49. //gfx_mono_init(); //gfx_mono_draw_string("MyChar is ", 0, 0, &sysfont); //gfx_mono_draw_char(mykey, 9, 18, &sysfont); //_delay_ms(1000); goto again; } } /*************************************************************** Code for configuring Sys Clk at 32MHz ***************************************************************/ void Set_Clk_32MHz(void) { OSC_CTRL |= OSC_RC32MEN_bm; //Setup 32Mhz crystal while(!(OSC_STATUS & OSC_RC32MRDY_bm)); CCP = CCP_IOREG_gc; //Trigger protection mechanism CLK_CTRL = CLK_SCLKSEL_RC32M_gc; //Enable internal 32Mhz crystal } /**************************************************************************** * Code to Initialize USART for Finger Print ***************************************************************************** / 49
  • 50. void uart_init(void) { PORTC_OUTSET = PIN3_bm; //Let's make PC7 as TX PORTC_DIRSET = PIN3_bm; //TX pin as output USARTC0_BAUDCTRLA = 207; USARTC0_BAUDCTRLB = 0; USARTC0_CTRLA = 0; USARTC0_CTRLC = 0x03; USARTC0_CTRLB = USART_TXEN_bm | USART_RXEN_bm; } /*************************************************************************** code for Sending a single char *************************************************************************/ void send_char(char data) { USARTC0_DATA = data; while ( !( USARTC0_STATUS & USART_DREIF_bm) ); //_delay_ms(50); } /************************************************** code for sending a string **************************************************/ void send_string(char *str) { while(1) { if( *str == '0' ) break; send_char(*str++); } 50
  • 51. } char receive_data(void) { char c; while( !( USARTC0_STATUS & 0x80) ); c=USARTC0_DATA; } /**************************************************************************** * Code for Initialize USART for GSM ***************************************************************************** / void uart_init2(void) { PORTE_OUTSET = PIN3_bm; //Let's make PC7 as TX PORTE_DIRSET = PIN3_bm; //TX pin as output USARTE0_BAUDCTRLA = 207; USARTE0_BAUDCTRLB = 0; USARTE0_CTRLA = 0; USARTE0_CTRLC = 0x03; USARTE0_CTRLB = USART_TXEN_bm | USART_RXEN_bm; } /*************************************************************************** code for Sending a single char *************************************************************************/ 51
  • 52. void send_char2(char data) { USARTE0_DATA = data; while ( !( USARTE0_STATUS & USART_DREIF_bm) ); _delay_ms(50); } /************************************************** code for sending a string **************************************************/ void send_string2(char *str) { while(1) { if( *str == '0' ) break; send_char2(*str++); } } void receive_data2(void) { unsigned int j; for (rx=0;rx<=41;rx++) ` { // Adding some code to terminate this loop in case call is not received in 5-10 seconds // while ((!( USARTE0_STATUS & 0x80) || wdt_counter > 10) // { // } 52
  • 53. while (!( USARTE0_STATUS & 0x80)); msg[rx]=USARTE0_DATA; } // +CLIP: "+919014099933",145,"",,"praveen",0 for (rx=0;rx<=41;rx++) { if ((msg[rx] == 'C') && (msg[rx+1] == 'L') && (msg[rx+2] == 'I') && (msg[rx+3] == 'P')) { for (j=0;j<10;j++) { chknum[j] = msg[rx+10+j]; } } } send_string2("ATH"); _delay_ms(50); send_string2("rn"); _delay_ms(100); if (!(strncmp(chknum, mynum1, 10))) { //PORTA_OUTSET=0X02; gsm_flag = 1; _delay_ms(50); } else if (!(strncmp(chknum, mynum2, 10))) { //PORTA_OUTSET=0X02; 53
  • 54. gsm_flag = 1; _delay_ms(50); } else if (!(strncmp(chknum, mynum3, 10))) { //PORTA_OUTSET=0X02; gsm_flag = 1; _delay_ms(50); } else if (!(strncmp(chknum, mynum4, 10))) { //PORTA_OUTSET=0X02; gsm_flag = 1; _delay_ms(50); } else { //PORTA_OUTCLR=0X02; gsm_flag = 0; _delay_ms(50); } } // Macros definition //#define KCOLUMN PORTB_IN //#define KROWS PORTA_OUT 54
  • 55. unsigned char scan_key(void) { //gfx_mono_init(); unsigned char char_key; _delay_ms(150); PORTA_OUT = 0xe0; _delay_ms(150); if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; //char_key = '1'; //gfx_mono_draw_string("1", 0, 0, &sysfont); _delay_ms(150); return '1'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; //char_key = '2'; //gfx_mono_draw_string("2", 0, 0, &sysfont); _delay_ms(150); return '2'; } if ((PORTB_IN & (1<<3)) == 0x00) { key_count++; //char_key = '3'; //gfx_mono_draw_string("3", 0, 0, &sysfont); _delay_ms(150); return '3'; 55
  • 56. } _delay_ms(150); PORTA_OUT = 0xd0; _delay_ms(150); if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; //char_key = '4'; //gfx_mono_draw_string("4", 0, 0, &sysfont); _delay_ms(150); return '4'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; //char_key = '5'; //gfx_mono_draw_string("5", 0, 0, &sysfont); _delay_ms(150); return '5'; } if ((PORTB_IN & (1<<3)) == 0x00) { key_count++; //char_key = '6'; //gfx_mono_draw_string("6", 0, 0, &sysfont); _delay_ms(150); return '6'; } 56
  • 57. _delay_ms(150); PORTA_OUT = 0xb0; _delay_ms(150); if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; //char_key = '7'; //gfx_mono_draw_string("7", 0, 0, &sysfont); _delay_ms(150); return '7'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; //char_key = '8'; //gfx_mono_draw_string("8", 0, 0, &sysfont); _delay_ms(150); return '8'; } if ((PORTB_IN & (1<<3)) == 0x00) { key_count++; //char_key = '9'; //gfx_mono_draw_string("9", 0, 0, &sysfont); _delay_ms(150); return '9'; } _delay_ms(150); PORTA_OUT = 0x70; _delay_ms(150); 57
  • 58. if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; //char_key = '*'; //gfx_mono_draw_string("*", 0, 0, &sysfont); _delay_ms(150); return '*'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; //char_key = '0'; //gfx_mono_draw_string("0", 0, 0, &sysfont); _delay_ms(150); return '0'; } if ((PORTB_IN & (1<<3)) == 0x00) { key_count++; //char_key = '#'; //gfx_mono_draw_string("#", 0, 0, &sysfont); _delay_ms(150); return '#'; } } #define dly1 150 #define dly2 150 unsigned char scan_pass(void) 58
  • 59. { //gfx_mono_init(); unsigned char char_key; _delay_ms(dly1); PORTA_OUT = 0xe0; _delay_ms(dly1); if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; pwdval[key_count-1] = '1'; print_pass(); //char_key = '1'; //gfx_mono_draw_string("1", 0, 0, &sysfont); _delay_ms(dly2); return '1'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; pwdval[key_count-1] = '2'; print_pass(); //char_key = '2'; //gfx_mono_draw_string("2", 0, 0, &sysfont); _delay_ms(dly2); return '2'; } if ((PORTB_IN & (1<<3)) == 0x00) { key_count++; pwdval[key_count-1] = '3'; 59
  • 60. print_pass(); //char_key = '3'; //gfx_mono_draw_string("3", 0, 0, &sysfont); _delay_ms(dly2); return '3'; } PORTA_OUT = 0xd0; _delay_ms(dly1); if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; pwdval[key_count-1] = '4'; print_pass(); //char_key = '4'; //gfx_mono_draw_string("4", 0, 0, &sysfont); _delay_ms(dly2); return '4'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; pwdval[key_count-1] = '5'; print_pass(); //char_key = '5'; //gfx_mono_draw_string("5", 0, 0, &sysfont); _delay_ms(dly2); return '5'; } if ((PORTB_IN & (1<<3)) == 0x00) 60
  • 61. { key_count++; pwdval[key_count-1] = '6'; print_pass(); //char_key = '6'; //gfx_mono_draw_string("6", 0, 0, &sysfont); _delay_ms(dly2); return '6'; } PORTA_OUT = 0xb0; _delay_ms(dly1); if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; pwdval[key_count-1] = '7'; print_pass(); //char_key = '7'; //gfx_mono_draw_string("7", 0, 0, &sysfont); _delay_ms(dly2); return '7'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; pwdval[key_count-1] = '8'; print_pass(); //char_key = '8'; //gfx_mono_draw_string("8", 0, 0, &sysfont); _delay_ms(dly2); return '8'; 61
  • 62. } if ((PORTB_IN & (1<<3)) == 0x00) { key_count++; pwdval[key_count-1] = '9'; print_pass(); //char_key = '9'; //gfx_mono_draw_string("9", 0, 0, &sysfont); _delay_ms(dly2); return '9'; } PORTA_OUT = 0x70; _delay_ms(dly1); if ((PORTB_IN & (1<<1)) == 0x00) { key_count++; pwdval[key_count-1] = '*'; print_pass(); //char_key = '*'; //gfx_mono_draw_string("*", 0, 0, &sysfont); _delay_ms(dly2); return '*'; } if ((PORTB_IN & (1<<2)) == 0x00) { key_count++; pwdval[key_count-1] = '0'; print_pass(); //char_key = '0'; //gfx_mono_draw_string("0", 0, 0, &sysfont); 62
  • 63. _delay_ms(dly2); return '0'; } if ((PORTB_IN & (1<<3)) == 0x00) { key_count++; pwdval[key_count-1] = '#'; print_pass(); //char_key = '#'; //gfx_mono_draw_string("#", 0, 0, &sysfont); _delay_ms(dly2); return '#'; } } void print_pass (void) { if (key_count == 1) { gfx_mono_init(); gfx_mono_draw_string("Password: *", 0, 0, &sysfont); gfx_mono_draw_char(mykey, 9, 18, &sysfont); _delay_ms(1000); } else if (key_count == 2) { gfx_mono_init(); gfx_mono_draw_string("Password: **", 0, 0, &sysfont); gfx_mono_draw_char(mykey, 9, 18, &sysfont); 63
  • 64. _delay_ms(1000); } else if (key_count == 3) { gfx_mono_init(); gfx_mono_draw_string("Password: ***", 0, 0, &sysfont); gfx_mono_draw_char(mykey, 9, 18, &sysfont); _delay_ms(1000); } else if (key_count == 4) { gfx_mono_init(); gfx_mono_draw_string("Password: ****", 0, 0, &sysfont); gfx_mono_draw_char(mykey, 9, 18, &sysfont); _delay_ms(1000); } } /*************************************************************** Code for scanning finger prints ***************************************************************/ void fp_scan (void) { fp_flag = 0; // Sending command for FP scanning i=0; while(i<12) { send_char(enroll[i]); 64
  • 65. i++; } // Receiving acknowledge rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); dummy=receive_data(); dummy=receive_data(); if(!rec) { gfx_mono_init(); gfx_mono_draw_string("Enrolling ok",0, 0, &sysfont); _delay_ms(5000); // Sending command to convert image into characters i=0; while(i<13) { send_char(generate_ch[i]); i++; } // Receiving acknowledge rec=receive_data(); rec=receive_data(); rec=receive_data(); 65
  • 66. rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); dummy=receive_data(); dummy=receive_data(); if(!rec) { gfx_mono_init(); gfx_mono_draw_string("genchar ok",0, 0, &sysfont); _delay_ms(2000); gfx_mono_draw_string("Entering to Identify",0, 0, &sysfont); _delay_ms(2000); // Sending command to identify/compare FP with stored FP image i=0; while(i<17) { send_char(identify[i]); i++; } // Receiving acknowledge rec=receive_data(); rec=receive_data(); rec=receive_data(); 66
  • 67. rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); rec=receive_data(); dummy=receive_data(); dummy=receive_data(); dummy=receive_data(); dummy=receive_data(); dummy=receive_data(); dummy=receive_data(); if(!rec) { fp_flag=1; // Only in case of matching FP this will be set to 1 gfx_mono_init(); gfx_mono_draw_string("Matched: Open the door",0, 0, &sysfont); _delay_ms(5000); } else { gfx_mono_init(); gfx_mono_draw_string("Not Matched",0, 0, &sysfont); _delay_ms(5000); //goto again; } } 67
  • 68. else { gfx_mono_init(); gfx_mono_draw_string("genchar not ok",0, 0, &sysfont); gfx_mono_draw_char(rec,9,18, &sysfont); _delay_ms(3000); //goto again; } } else { //goto again; gfx_mono_init(); gfx_mono_draw_string("1: Enrolling not ok",0, 0, &sysfont); _delay_ms(2000); } } 68