The main aim of this project to provide secure banking system, by taking fingerprints as authorized identity at banks. The purpose of the project is to provide a secured and reliable environment to the customers for their banking transactions by providing a unique identity to every user using the finger print identification technology. Here in this project we are going provide the at most security since it is taking the finger prints as the authentication for our account. So whenever we want to access our account first we have to press the finger on the finger print scanner. Scanner is interfaced to the PIC controller with the serial interfacing. The PIC controller reads the data from the scanner. The PIC controller allows those users, who are authorized to operate the account. If any unauthorized user tries to operate the account the PIC controller switches on the security alarm. Touchpad is used to enter the password to operate the account or Locker. In this project we are also using the swap card reader as another identification technique, which has unique code for every user.
LIST OF TABLES
Table No Table Description Page no
Table 4.1 LCD Pin Description 8
Table 4.2 Port A description 12
Table 4.3 Port B description 14
Table 4.4 Port C description 15
Table 4.5 Port D description 16
Table 4.6 Port E description 17
LIST OF FIGURES
Figure No Figure Description Page No
Fig 2.1 Block Diagram of Bank Locker System 2
Fig 4.1 Circuit Diagram of Bank Locker System 6
Fig 4.2 Power Supply 7
Fig 4.3 LCD Display 7
Fig 4.4 Finger Print Sensor 9
Fig 4.5 Pin Diagram of PIC16F877A 11
Fig 4.6 Stepper Motor 19
Fig 4.7 Unipolar Stepper Motor 19
Fig 4.8 ULN2003A 20
Fig4.9 MOC7811 20
Fig4.10 Touch Screen 21
TABLE OF CONTENTS
Acknowledgement i
Abstract ii
List of table iii
List of figure iv
Table of content v
Chapter 1 Introduction 1
Chapter 2 Block diagram of bank locker system 2
2.1 Block diagram explanation 2
Chapter 3 Work planning 5
3.1 Steps taken during the course of completion of the project 5
Chapter 4 Circuit diagram 6
4.1 Power supply 6
4.2 LCD display 7
4.3 Finger print sensor 9
4.4 PIC controller 11
4.5 Stepper motor 19
4.6 ULN2003A 20
4.7 MOC7811 20
4.8 Touch screen 21
Chapter 5 Flow of project 23
Chapter 6 Conclusion 24
Appendix 25
Reference 53
CHAPTER:1 INTRODUCTION
Here in this project we are going provide the at most security since it is taking the finger prints as the authentication for our account. So whenever we want to access our account first we have to press the finger on the finger print scanner. Scanner is interfaced to the PIC controller with the serial interfacing. The PIC controller reads the data from the scanner. The PIC controller allows those users, who are authorized to operate the account. If any unauthorized user tries to operate the account the PIC controller switches on the security alarm. Touch keypad is used to enter the password to operate the account or Locker.
In present days, computer becomes a main part of human beings for storing information. This information is up to some extent is a secured one. For example the details of employees and students etc… The authority person may only change the details. For this protection we are going to provide a password for the PCs. This is secure up to some extent only because there may be a chance of revealing the password or sometimes the authorized person may forgot the password. So we have to provide security for PCs with a unique and simple to remember identification. One of such identification is the finger print.
The project modern secure bank locker system has three security level such as:
1.Finger print sensor
2.Touchpad
3.Swap card reader
CHAPTER:2 BLOCK DIAGRAM OF BANK
LOCKER SYSTEM
Fig.: 2.1 Block diagram of Bank Locker System
2.1BLOCK DIAGRAM EXPLANATION:
‘ POWER SUPPLY
A variable regulated power supply, also called a variable bench power supply, is one where you can continuously adjust the output voltage to your requirements. Varying the output of the power supply is the recommended way to test a project after having double checked parts placement against circuit drawings and the parts placement guide. This type of regulation is ideal for having a simple variable bench power supply. Actually this is quite important because one of the first projects a hobbyist should undertake is the construction of a variable regulated power supply. While a dedicated supply is quite handy e.g. 5V or 12V, it’s much handier to have a variable supply on hand, especially for testing. Most digital logic circuits and processors need a 5 volt power supply. To use these parts we need to build a regulated 5 volt source. Usually you start with an unregulated power supply ranging from 9 volts to 24 volts DC (A 12 volt power supply is included with the Beginner Kit and the Microcontroller Beginner Kit). To make a 5 volt power supply, we use a LM7805 voltage regulator IC.
The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the Output pin.
‘ FINGER PRINT SCANNER:
A fingerprint sensor is an electronic device used to capture a digital image of the fingerprint pattern. The captured image is called a live scan. This live scan is digitally processed to create a biometric template (a collection of extracted feature) which is stored and used for matching. It supports wide range of fingerprint sensor interoperability giving you a freedom to select suitable sensor that most fits to your application. Furthermore, the fingerprint data for enrollment and verification are compatible among different sensors, even if they are based on different technologies. This feature of unification presents application manufacturers and system integrators with much more flexibility than ever before.
‘ PIC CONTROLLER:
A PIC controller consists of a powerful CPU tightly coupled with memory RAM, ROM or EPROM), various I / O features such as Serial ports, Parallel Ports, Timer/Counters, Interrupt Controller, Data Acquisition interfaces-Analog to Digital Converter (ADC), Digital to Analog Converter (ADC), everything integrated onto a single Silicon Chip.
In this project all the component is connected to the PIC controller. Finger print, password and swap card code is stored in the PIC controller. To verify the authorized user PIC controller is match finger print, password and swap card code with previously stored data. If data is match bank locker is open else PIC will give the instruction to the buzzer and buzzer is on.
‘ TOUCH PAD:
In this project we are using touch screen key pad. We are using Touch pad for entering the password.
‘ LCD:
This is the widely used output device to indicate the status. Here the transaction details are clearly displayed on the LCD.
‘ BUZZER:
This is the output device which we are using to indicate the unauthorized person.
‘ LOCKER SYSTEM:
Here we are demonstrating a Stepper motor as the Locker for the authorized persons in the Locker system mode.
CHAPTER 3:PLAN OF WORK
3.1 Steps taken during the course of completion of the project:
3.1.1 Study of PIC controller:
We are using PIC controller PIC 16F877A as a central processing unit of our project. We arrived at the conclusion that the PIC controller PIC 16F877A was our best choice due to its simplicity and economical viability.
3.1.2 Designing of the BLOCK DIAGRAM or OVERVIEW of the
Bank Locker System:
When the main units had been decided, we designed the basic block diagram or the basic overview of the project. This block diagram is the basic form of this project and it is designed so that it becomes easier to understand the project and to design the circuit schematic.
3.1.3 Study about the Designing tools EXPRESS PCB, MULTI SIM,
and MPLAB:
The next step was to design the circuit schematic. But for that we first needed to learn the software required for this. Multisim was used to design and simulate the circuit schematic. Express PCB was used to design the layout of the PCB MPLAB was used to write the program and convert it to hex format.
3.1.4 Designing the PCB:
We successfully designed the PCB for this project.
3.1.5 Printing of the PCB:
The next step was then to get the PCB printed.
3.1.6 Implementation of the designs on hardware:
The penultimate step was to assemble the hardware. All the components were placed on the PCB and then soldered. Then, the PCB was placed on the chassis.
3.1.7 Testing:
The final step for the completion of any project is the testing of the circuit.
CHAPTER:4 CIRCUIT DIAGRAM
Fig.:4.1 circuit diagram of Bank Locker System
4.1 Power Supply:
Here is a 5V power supply circuit using LM 7805 IC. LM7805 is a famous positive voltage regulator IC comes in three terminal provides fixed 5V DC output. This IC has many built in features like internal current limiting, thermal shut down, operating area protection etc. A 9V transformer steps down the main voltage, 1A bridge rectifies it and capacitor C1 filters it and 7805 regulates it to produce a steady 5Volt DC. The circuit schematic is given below.
Transformer in this circuit is 230V AC to 9V 2A DC, output current of this circuit is upto 1A. The IC will become hot during the operation so it is essential to use a good heat sink.
Here, as an indicator we are using LED. When power supply is on LED is ON, and when power supply is off LED is OFF.
Fig.:.4.2 power supply[1]
4.2 LCD Display:
Fig.:.4.3 LCD display[2]
‘ Product Overview:
Innovators LCD 2×16 A Module provides versatile display functions. Through its simple connections, it can be controlled by Innovator’s BASIC Commander for a wide
range of LCD applications. In this module, two display lines, each with 16 characters on each line can be displayed. By using the cursor control command, the position of the character to be displayed on the screen can be arbitrarily changed. In this module, the backlight function can be used to change the backlight to allow the message to be read easily. In addition, it can be configured to display user defined characters to "LCD2x16A" as the module object name in program.
Table 4.1: LCD pin description
‘ Application:
‘ Together with an RTC Module, it can be used to display a real time clock or a simple electronic clock.
‘ It can be used to display the operating status at any time for various applications.
‘ It can display status or error messages directly on the screen without using the PC.
‘ With the user-defined characters, special patterns can be created to produce creative message.
‘ Product Features:
‘ It can be used to display corresponding characters in ASCII code.
‘ The module will automatically convert and display the data according to its data type.
‘ 255 steps backlight control.
‘ For continuous inputs, the module will carriage return automatically.
‘ Cursor position assignment and Tab function with conFig.:urable Tab steps and HOME function.
‘ Destructive backspace, clear to end of line or end of screen from the cursor posi-tion.
‘ Set the user defined characters to display various creative characters. Display off command to reduce power consumption.
4.3 Finger Print Sensor:
Fig.:.4.4 finger print sensor[8]
The fingerprint sensor can read different fingerprints and store in its own flash memory. The sensor can perform three functions namely Add(Enrol) , Empty Database or Search Database and return the ID of stored fingerprint.
Any of three functions can be called simply by making the pin low of the sensor or pressing onboard three switches. The response is either error or ok which is indicated by onboard LED. The response is also returned as single serial data byte. The return byte is a valid ID or error code. The response byte is a single byte at 9600 bps thus making whole sensor very easy to use. We have provided indicating LEDs and function switch already so it’s ready to use when you receive it. Just give power and start using the sensor using onboard switches. Then you can move on making external application using these functions.
‘ Features:
‘ Easy to use
‘ Status LEDs
‘ Function Switches
‘ Single byte response
‘ Works at 5V
‘ UART 9600bps response
‘ Inputs and outputs of sensors:
Input:
Two ways to trigger the function of fingerprint sensor
‘ Onboard switch: Add, Empty or Search.
‘ Make pin low from external microcontroller for 5ms as per function required to be executed.
Outputs(Response):
Two ways to monitor output response after a function is executed
‘ Onboard LEDs: ERROR or OK
‘ Read byte after executing function
‘ Types of function:
There are namely three functions you can call for the fingerprint sensor. We will see each in brief.
Add(Enroll) Function:
Adds a fingerprint to database and return a byte of newly added ID. Return values are from 0x00 to 0xFE. In case of error like no finger placed, return code is 0xFF. Here 0xFF means error executing function.
Search Function:
When a finger is put and search function is called, it returns a matching ID if found in its existing memory. Return values are from 0x00 to 0xFE. In case of error like no finger placed, return code is 0xFF. Here 0xFF means error executing function.
Empty Function:
When you wish to empty all fingerprint data stored on sensor you can use this function. After executing this function, you will get 0xCC as OK or 0xFF in case of error.
‘ Application Example
We will use an example of AT89S52 MCU to interface but can be any MCU like AT89C51 or AVR or PIC. Since the code is in PIC. The logic will remain same across all C compilers.
The sample code is given on page below.
All three functions of fingerprint sensor are trigged by simply making the sensor’s pin low for 5 millisecond and waiting for answer of single byte. If function executes fine we switch on OK LED for 1 second If error then we switch on ERROR led for 1 second.
You can further expand this example code to send data to PC using MCU TX pin or add an LCD to show various functions and IDs returned.
4.4PIC Controller:
Fig.:.4.5 Pin diagram of PIC16F877A[6]
Table 4.2:- PIC16F874A/877A PINOUT DESCRIPTION
Pin Name PDIP
Pin# PLCC
Pin# TQFP
Pin# QFN
Pin# I/O/P
Type Buffer
Type Description
OSC1/CLKI
OSC1
CLKI 13 14 30 32 I
I ST/CMOS(4) Oscillator crystal or external clock input.
Oscillator crystal input or external clock source
input. ST buffer when configured in RC mode; otherwise CMOS.
External clock source input. Always associated
with pin function OSC1 (see OSC1/CLKI,
OSC2/CLKO pins).
OSC2/CLKO
OSC2
CLKO 14 15 31 33 O
O ‘ Oscillator crystal or clock output.
Oscillator crystal output.
Connects to crystal or resonator in Crystal
Oscillator mode.
In RC mode, OSC2 pin outputs CLKO, which
has 1/4 the frequency of OSC1 and denotes the
instruction cycle rate.
MCLR/VPP
MCLR
VPP 1 2 18 18 I
P ST Master Clear (input) or programming voltage (output).
Master Clear (Reset) input. This pin is an active
low Reset to the device.
Programming voltage input.
RA0/AN0
RA0
AN0
2
3
19
19
I/O
I
TTL
PORTA is a bidirectional I/O port.
Digital I/O.
Analog input 0.
RA1/AN1
RA1
AN1 3
4
20
20
I/O
I
TTL
Digital I/O.
Analog input 1.
RA2/AN2/VREF-/CVREF
RA2
AN2
VREFCVREF
4
5
21
21
I/O
I
I
O
TTL
Digital I/O.
Analog input 2.
A/D reference voltage (Low) input.
Comparator VREF output.
RA3/AN3/VREF+
RA3
AN3
VREF+
5
6
22
22
I/O
TTL
Digital I/O.
Analog input 3.
A/D reference voltage (High) input.
RA4/T0CKI/C1OUT
RA4
T0CKI
C1OUT
RA5/AN4/SS/C2OUT
RA5
AN4
SS C2OUT 6
7 7
8 23
24 23
24
I/O
I
O
I/O
I
I
O ST
TTL Digital I/O ‘ Open-drain when configured as output.
Timer0 external clock input. Comparator 1 output.
Digital I/O.
Analog input 4.
SPI slave select input.
Comparator 2 output.
Table 4.3:- PIC16F874A/877A PORT B DESCRIPTION
Table 4.4:- PIC16F874A/877A PORT C DESCRIPTION
Pin Name PDIP
Pin# PLCC
Pin# TQFP
Pin# QFN
Pin# I/O/P
Type Buffer
Type Description
RC0/T1OSO/T1CKI
RC0
T1OSO
T1CKI
15
16
32
34
I/O
O
I
ST PORTC is a bidirectional I/O port.
Digital I/O.
Timer1 oscillator output.
Timer1 external clock input.
RC1/T1OSI/CCP2
RC1
T1OSI
CCP2 16 18 35 35 I/O
I
I/O ST Digital I/O.
Timer1 oscillator input.
Capture2 input, Compare2 output, PWM2 output.
RC2/CCP1
RC2
CCP1 17 19 36 36 I/O
I/O ST Digital I/O.
Capture1 input, Compare1 output, PWM1 output.
RC3/SCK/SCL
RC3
SCK
SCL 18 20 37 37 I/O
I/O
I/O ST Digital I/O.
Synchronous serial clock input/output for SPI
mode.
Synchronous serial clock input/output for I2C
mode.
RC4/SDI/SDA
RC4
SDI
SDA 23 25 42 42 I/O
I
I/O ST Digital I/O.
SPI data in.
I2C data I/O
RC5/SDO
RC5
SDO 24 26 43 43 I/O
O ST Digital I/O.
SPI data out.
RC6/TX/CK
RC6
TX
CK 25 27 44 44 I/O
O
I/O ST Digital I/O.
USART asynchronous transmit.
USART1 synchronous clock.
RC7/RX/DT
RC7
RX
DT 26 29 1 1 I/O
I
I/O ST Digital I/O.
USART asynchronous receive.
USART synchronous data.
Table 4.5:- PIC16F874A/877A PORT D DESCRIPTION
Pin Name PDIP
Pin# PLCC
Pin# TQFP
Pin# QFN
Pin# I/O/P
Type Buffer
Type Description
RD0/PSP0
RD0
PSP0
19
21
38
38
I/O
I/O
ST/TTL(3) PORTD is a bidirectional I/O port or Parallel Slave
Port when interfacing to a microprocessor bus.
Digital I/O.
Parallel Slave Port data.
RD1/PSP1
RD1
PSP1 20 22 39 39 I/O
I/O ST/TTL(3) Digital I/O.
Parallel Slave Port data.
RD2/PSP2
RD2
PSP2 21 23 40 40 I/O
I/O ST/TTL(3) Digital I/O.
Parallel Slave Port data.
RD3/PSP3
RD3
PSP3 22 24 41 41 I/O
I/O ST/TTL(3) Digital I/O.
Parallel Slave Port data.
RD4/PSP4
RD4
PSP4 27 30 2 2 I/O
I/O ST/TTL(3) Digital I/O.
Parallel Slave Port data.
RD5/PSP5
RD5
PSP5 28 31 3 3 I/O
I/O ST/TTL(3) Digital I/O.
Parallel Slave Port data.
RD6/PSP6
RD6
PSP6 29 32 4 4 I/O
I/O ST/TTL(3) Digital I/O.
Parallel Slave Port data.
RD7/PSP7
RD7
PSP7 30 33 5 5 I/O
I/O ST/TTL(3) Digital I/O.
Parallel Slave Port data.
Table 4.6:- PIC16F874A/877A PORT E DESCRIPTION
Pin Name PDIP
Pin# PLCC
Pin# TQFP
Pin# QFN
Pin# I/O/P
Type Buffer
Type Description
RE0/RD/AN5
RE0
RD
AN5
8
9
25
25
I/O
I
I
ST/TTL(3) PORTE is a bidirectional I/O port.
Digital I/O.
Read control for Parallel Slave Port.
Analog input 5.
RE1/WR/AN6
RE1
WR
AN6 9 10 26 26 I/O
I
I ST/TTL(3) Digital I/O.
Write control for Parallel Slave Port.
Analog input 6.
RE2/CS/AN7
RE2
CS
AN7 10 11 27 27 I/O
I
I ST/TTL(3) Digital I/O.
Chip select control for Parallel Slave Port.
Analog input 7.
VSS 12, 31 13, 34 6, 29 6, 30,
31 P ‘ Ground reference for logic and I/O pins.
VDD 11, 32 12, 35 7, 28 7, 8,
28, 29 P ‘
Positive supply for logic and I/O pins.
NS ‘ 1, 17,
28, 40 12,13,
33, 34 13 ‘ ‘ These pins are not internally connected. These pins
should be left unconnected.
Legend: I = input O = output I/O = input/output P = power
‘ = Not used TTL = TTL input ST = Schmitt Trigger input
Note 1: This buffer is a Schmitt Trigger input when configured as the external interrupt.
2: This buffer is a Schmitt Trigger input when used in Serial Programming mode.
3: This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
4.5 Stepper motor:
Fig.:.4.6 stepper motor(Ref no.4)
A unipolar stepper motor has one winding with center tap per phase. Each section of windings is switched on for each direction of magnetic field. Since in this arrangement a magnetic pole can be reversed without switching the direction of current, the commutation circuit can be made very simple (e.g., a single transistor) for each winding. Typically, given a phase, the center tap of each winding is made common: giving three leads per phase and six leads for a typical two phase motor. Often, these two phase commons are internally joined, so the motor has only five leads.
Fig.:4.7 Unipolar stepper motor(Ref no.9)
A stepper motor controller can be used to activate the drive transistors in the right order, and this ease of operation makes unipolar motors popular with hobbyists; they are probably the cheapest way to get precise angular movements.
‘ Features:
‘ Step Angle 1,8??
‘ Ambient Temperature Range -20??C ~ +40??C
‘ Improved performance by using latest technology.
‘ 4.6 ULN2003A:
Fig.:4.8 ULN2003A(Ref no.7)
‘ DESCRIPTION:
The ULN2001A, ULN2002A, ULN2003 and ULN2004A are high voltage, high current darlington arrays each containing seven open collector Darlington pairs with common emitters. Each channel rated at 500mA and can withstand peak currents of 600mA. Suppression diodes are included for inductive load driving and the inputs are pinned opposite the outputs to simplify board layout.
4.7 MOC7811:
‘ Feature:
‘ Low profile
‘ PCB mount
‘ Transistor mount
Fig.: 4.9 MOC7811(Ref no.5)
The MOC70PX consists of an infrared emitting diode coupled to an NPN silicon phototransistor packaged into an injection molded housing. The housing is designed for wide gap, non contact sensing.
‘ Notes:
‘ Derate power dissipation linearly, on each component, 1.67 mW/??C above 25??C.
‘ RMA flux is recommended.
‘ Methanol or isopropyl alcohols are recommended as cleaning agents.
‘ Soldering iron tip 1/16’ (1.6mm) from housing.
4.9Touch Screen :
Fig.: 4.10 Touch Screen(Ref no.3)
‘ Introduction
Touch-screen interfaces are effective in many information appliances, in personal digital assistants (PDAs), and as generic pointing devices for instrumentation and control applications. Getting the information from a touch screen into a microprocessor can be challenging. This article introduces the basics of how resistive touch screens work and how to best convert these analog inputs into usable digital data. Issues such as settling time, noise filtering, and speed trade-offs are addressed.
‘ Resistive touch screens
Resistive touch screens consist of a glass or acrylic panel that is coated with electrically conductive and resistive layers made with indium tin oxide (ITO). The thin layers are separated by invisible spacers. Resistive screens are generally the most affordable type of touch screen, which explains their success in high-use applications like PDAs and Internet appliances. Although clarity is not as good as with other touch-screen types, resistive screens are very durable. The only concern is that the resistive layers can be damaged by a very sharp object.
The two most popular resistive architectures use 4-wire or 5-wire configurations.
‘ Resistive touch-screen controllers
When a position is measured on a 4-wire touch screen, voltage is applied across the screen in the Y direction; and a touch presses the layers together, where a voltage can be read from one of the X electrodes. The contact made as a result of the touch creates a voltage divider at that point, so the Y coordinate can be determined; the process then repeats with the X direction being driven, and a reading is taken from one of the Y electrodes. A touch-screen controller is simply an ADC that has built-in switches to control which electrodes are driven and which electrodes are used as the input to the ADC. The ADC can often be operated with different reference modes: single-ended or differential.
CHAPTER:5 FLOW OF PROJECT
CHAPTER:6 CONCLUSION
A step by step approaching designing the PIC controller based system for securing the transactions of the user and providing the security for the locker system using a finger print scanner has been followed and even more to enter the password touch screen is used. The result obtained in providing the security is quite reliable in all the three modes. The system has successfully overcome some of the aspects existing with the present technologies, by the use of finger print Biometric as the authentication Technology.
All these functions which are performed by the user are simultaneously displayed on the LCD. In case any of the finger print is not matched with the data the Locker system is not opened and the Keypad is not enabled at all by giving the indication in the form of buzzer.
ADVANTAGES
‘ High secure
‘ Number of users can be accessed.
‘ Data can be stored and displayed
‘ Password can be changed as for our requirement
APPLICATION
‘ ATM Machines
‘ Voting Machines
‘ Residence door lock.
‘ Finger print attendance system.
‘ Biometric Applications
APPENDIX
#include <pic.h>
unsigned char fngr_found_ID[3],id,debugger;
unsigned int char_recieved,i;
unsigned char sec,min,hr,fiftymilliseccounter;
unsigned char char_counter,temperory;
bit message_started,message_ended;
#define STEP1 RD0=0; RD1=1; RD2=1; RD3=1
#define STEP2 RD0=1; RD1=0; RD2=1; RD3=1
#define STEP3 RD0=1; RD1=1; RD2=0; RD3=1
#define STEP4 RD0=1; RD1=1; RD2=1; RD3=0
#define STEPPER_OFF RD0=1; RD1=1; RD2=1; RD3=1
const unsigned char name1[17] ="Hello Neha……";
const unsigned char name2[17] ="Hello Twinkal…";
const unsigned char name3[17] ="Hello HOD sir…";
const unsigned char title1[17] = " Bank Locker ";
const unsigned char title2[17] = "Security System ";
const unsigned char title3[17] = "FP-Touch screen ";
const unsigned char title4[17] = "Swap card By–";
const unsigned char title5[17] = "Neha and Twinkal";
const unsigned char title6[17] = "of SRI Group2014";
#define LCD PORTB // P2
#define RS RC0 // P0_0
#define RW RC1 // P0_1
#define EN RC2 // P0_2
#define BUZZER RC3
#define BUTTON RC4 // pull up is required
#define ON 0
#define OFF 1
void MSDelay (unsigned int itime)
{
unsigned int i,j;
for(i=0; i<itime; i++)
{
for(j=0; j<100; j++)
{;}
}
}
void lcdcmd (unsigned char value)
{
LCD = value; // put value on the pins
RS = 0;
RW = 0;
EN = 1; // strobe the enable pin
MSDelay(1);
EN = 0;
return;
}
void lcddata (unsigned char value)
{
LCD = value; // put the value on the pins
RS = 1;
RW = 0;
EN = 1; // strobe the enable pin
MSDelay(1);
EN = 0;
return;
}
unsigned char test[17]="Put ur finger…",response;
unsigned char fail[17]="Process fail….";
unsigned char char_counter,temperory1,temperory2;
bit is_new_char_arrived;
#define YES 1
#define NO 0
#define HIGH 1
#define LOW 0
void interrupt receive(void)
{
if(RCIF == 1)
{
response = RCREG;
is_new_char_arrived = YES;
}
}
#define GND 1
#define VCC 2
#define HIZ 3
#define ADI 4
void x_pluse_pin_conFig.:uration(unsigned char );
void x_minus_pin_conFig.:uration(unsigned char );
void y_pluse_pin_conFig.:uration(unsigned char );
void y_minus_pin_conFig.:uration(unsigned char );
const unsigned char fixed_password[3][5]={"76ED","A41B","C235"};
unsigned char code_digit_index;
unsigned char code_buffer[4];
const unsigned char enter_pwd[17] ="Enter Password..";
const unsigned char enter_card[17]="Enter your card ";
#define SWAP_CARD_0 ((RD4==1)&&(RD5==0)&&(RD6==0)&&(RD7==1))
#define SWAP_CARD_1 ((RD4==0)&&(RD5==1)&&(RD6==0)&&(RD7==1))
#define SWAP_CARD_2 ((RD4==0)&&(RD5==1)&&(RD6==1)&&(RD7==0))
#define UNMATCHED 5
unsigned char card_no;
const unsigned char permission[17]="You are welcome.";
const unsigned char denial[17]="No Permission…";
const unsigned char empty[17]="Memory is empty.";
void main()
{
unsigned char line,character,loop,thou,hund,ten,unit;
unsigned int i,x_coordinate,y_coordinate,temp;
RBPU = 0; // portB pullups enabled
PSPMODE = 0; // to make RE0,RE1,RE2 digital
PCFG0 = 0; // AN0 for analog ip,AN1-AN7 are set for digital io
PCFG1 = 1; // do
PCFG2 = 1;// do
PCFG3 = 1;// do
TRISC = 0xF0;// input button and LCD cmd
TRISB = 0x00; // LCD data
STEPPER_OFF;
BUZZER = OFF;
//**************************************************************
TRISD = 0xF0; // upper nibble ip for swap card , lower nibble op for stepper
//**************************************************************
// ******************** start of setting serial comm with baud rates 9600
//(Asynchronous) Baud Rate = FOSC/(64 (X + 1))
// X = value in SPBRG (0 to 255)
// 9600 = 11059200/(64(x + 1))
// x + 1 = 11059200/9600 = (110592/96)/64 = 18
// x = 18 – 1
// x = 17
// SPBRG = 17
SPBRG = 17
TX9 = 0; // 8 bit transmission
TXEN = 1;// transmission enabled
SPEN = 1; // serial port enabled
RX9 = 0; // 8 bit reception
CREN = 1; // continuous reception enabled
TXIE = 0; // trans interrupt disabled
char_counter = 0;
// ******************** end of setting serial comm with baud rates 9600
lcdcmd(0x38); // 5*7 matrix
MSDelay(5);
lcdcmd(0x0C); // display on cursor off
MSDelay(5);
lcdcmd(0x01);
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i =0; i<16; i++)
{
lcddata(title1[i]);
}
lcdcmd(0xC0);
MSDelay(5);
for(i =0; i<16; i++)
{
lcddata(title2[i]);
}
MSDelay(8000);
lcdcmd(0x01);
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i =0; i<16; i++)
{
lcddata(title3[i]);
}
lcdcmd(0xC0);
MSDelay(5);
for(i =0; i<16; i++)
{
lcddata(title4[i]);
}
MSDelay(8000);
lcdcmd(0x01);
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i =0; i<16; i++)
{
lcddata(title5[i]);
}
lcdcmd(0xC0);
MSDelay(5);
for(i =0; i<16; i++)
{
lcddata(title6[i]);
}
MSDelay(8000);
while(1)// super
{
STARTPOINT:
lcdcmd(0x01); // clear display screen
MSDelay(5);
lcdcmd(0x80); // line 1, position 0
MSDelay(5);
for(i=0; i<16; i++)
{
lcddata(test[i]);// put your finger
MSDelay(50);
}
while(is_new_char_arrived == NO);//
lcdcmd(0x01); // clear display screen
MSDelay(5);
lcdcmd(0x80); // line 1, position 0
MSDelay(5);
if(response == 0)
{
for(i=0; i<16; i++)
{
lcddata(name1[i]);
MSDelay(50);
}
MSDelay(5000);
}
if(response == 1)
{
for(i=0; i<16; i++)
{
lcddata(name2[i]);
MSDelay(50);
}
MSDelay(5000);
}
if(response == 2)
{
for(i=0; i<16; i++)
{
lcddata(name3[i]);
MSDelay(50);
}
MSDelay(5000);
}
if(response == 0xFF)
{
lcdcmd(0x01); // clear display screen
MSDelay(5);
lcdcmd(0x80); // line 1, position 0
MSDelay(5);
for(i=0; i<16; i++)
{
lcddata(fail[i]);
MSDelay(50);
}
MSDelay(1000);
for(i=0; i<5; i++)
{
BUZZER = ON;
MSDelay(500);
BUZZER = OFF;
MSDelay(500);
}
goto STARTPOINT;
}
if((response == 0xCC))
{
lcdcmd(0x01); // clear display screen
MSDelay(5);
lcdcmd(0x80); // line 1, position 0
MSDelay(5);
for(i=0; i<16; i++)
{
lcddata(empty[i]);
MSDelay(50);
}
MSDelay(2000);
goto STARTPOINT;
}
// start of codes for swap card
lcdcmd(0x01);
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i=0;i<16;i++)
{
lcddata(enter_card[i]);
MSDelay(5);
}
while(BUTTON == OFF);
card_no = UNMATCHED;
if((response==0)&&(SWAP_CARD_0))
card_no = 0;
if((response==1)&&(SWAP_CARD_1))
card_no = 1;
if((response==2)&&(SWAP_CARD_2))
card_no = 2;
if(card_no == UNMATCHED)
{
lcdcmd(0x01); // debug
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i=0;i<16;i++)
{
lcddata(denial[i]);
MSDelay(5);
}
MSDelay(1000);
for(i=0;i<5;i++)
{
BUZZER = ON;
MSDelay(500);
BUZZER = OFF;
MSDelay(500);
}
goto STARTPOINT;
}
// end of codes for swap card
// start of entering password
code_digit_index = 0;
lcdcmd(0x01);
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i=0;i<16;i++)
{
lcddata(enter_pwd[i]);
MSDelay(5);
}
lcdcmd(0xC0);
MSDelay(5);
while(1)// password while
{
// *************** start of codes for ADC for x_coordinate **************
// for exiting Y plane and measuring analog on X
x_pluse_pin_conFig.:uration(ADI);
x_minus_pin_conFig.:uration(HIZ);
y_pluse_pin_conFig.:uration(VCC);
y_minus_pin_conFig.:uration(GND);
ADIF = 0;// adc flag clear
// ADIF: A/D Converter Interrupt Flag bit
// 1 = An A/D conversion completed
// 0 = The A/D conversion is not complete
ADON = 1; // power on to adc module
MSDelay(1);
CHS2 = 0; // to select AN0 adc input
CHS1 = 0; // do
CHS0 = 0; // do
MSDelay(1);
while(ADIF == 0);
x_coordinate = ADRESH;
// ***************end of codes for ADC for x_coordinate **************
// *******************start of codes for ADC for y_coordinate***********************
// for exiting X plane and measuring analog on Y
x_pluse_pin_conFig.:uration(VCC);
x_minus_pin_conFig.:uration(GND);
y_pluse_pin_conFig.:uration(ADI);
y_minus_pin_conFig.:uration(HIZ);
ADIF = 0;// adc flag clear
// ADIF: A/D Converter Interrupt Flag bit
// 1 = An A/D conversion completed
// 0 = The A/D conversion is not complete
ADON = 1; // power on to adc module
MSDelay(1);
CHS2 = 0; // to select AN3 adc input
CHS1 = 1; // do
CHS0 = 1; // do
MSDelay(1);
//ADCON0 = 0x0D; // 0000 1101 start of conversion of ADC AN1
while(ADIF == 0);
y_coordinate = ADRESH;
if((x_coordinate > 450) && (x_coordinate < 650) &&
(y_coordinate > 480) && (y_coordinate < 700) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘0’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 110) && (x_coordinate < 250) &&
(y_coordinate > 56) && (y_coordinate < 250) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘4’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 110) && (x_coordinate < 250) &&
(y_coordinate > 250) && (y_coordinate < 480) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘8’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 650) && (x_coordinate < 815) &&
(y_coordinate > 700) && (y_coordinate < 915) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘C’;
if(code_digit_index<3)
code_digit_index++;
MSDelay(5);
}
if((x_coordinate > 650) && (x_coordinate < 815) &&
(y_coordinate > 56) && (y_coordinate < 250) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘1’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 650) && (x_coordinate < 815) &&
(y_coordinate > 250) && (y_coordinate < 480) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘5’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 650) && (x_coordinate < 815) &&
(y_coordinate > 480) && (y_coordinate < 700) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘9’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 450) && (x_coordinate < 650) &&
(y_coordinate > 700) && (y_coordinate < 915) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘D’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 450) && (x_coordinate < 650) &&
(y_coordinate > 56) && (y_coordinate < 250) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘2’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 450) && (x_coordinate < 650) &&
(y_coordinate > 250) && (y_coordinate < 480) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘6’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 250) && (x_coordinate < 450) &&
(y_coordinate > 480) && (y_coordinate < 700) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘A’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 250) && (x_coordinate < 450) &&
(y_coordinate > 700) && (y_coordinate < 915) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘E’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 250) && (x_coordinate < 450) &&
(y_coordinate > 110) && (y_coordinate < 250) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘3’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 250) && (x_coordinate < 450) &&
(y_coordinate > 250) && (y_coordinate < 480) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘7’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 110) && (x_coordinate < 250) &&
(y_coordinate > 480) && (y_coordinate < 700) )
{
lcddata(‘*’);
MSDelay(5);
code_buffer[code_digit_index] = ‘B’;
if(code_digit_index<3)
code_digit_index++;
}
if((x_coordinate > 110) && (x_coordinate < 250) &&
(y_coordinate > 700) && (y_coordinate < 915) )
{
MSDelay(5);
goto OUT;
}
// *******************end of codes for ADC for y_coordinate***********************
MSDelay(1500);
} // end of password while
// end of entering password
OUT:
// now compare the code
for(i=0;i<4;i++)
{
if(code_buffer[i]!=fixed_password[response][i])
break;
}
if(i==4)// if code is correct
{
lcdcmd(0x01); // debug
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i=0;i<16;i++)
{
lcddata(permission[i]);
MSDelay(5);
}
//RELAY = ON;
for(i=0;i<16;i++)
{
STEP1;
MSDelay(100);
STEP2;
MSDelay(100);
STEP3;
MSDelay(100);
STEP4;
MSDelay(100);
}
STEPPER_OFF;
MSDelay(5000);
// RELAY = OFF;
for(i=0;i<16;i++)
{
STEP4;
MSDelay(100);
STEP3;
MSDelay(100);
STEP2;
MSDelay(100);
STEP1;
MSDelay(100);
}
STEPPER_OFF;
}
else
{
lcdcmd(0x01); // debug
MSDelay(5);
lcdcmd(0x80);
MSDelay(5);
for(i=0;i<16;i++)
{
lcddata(denial[i]);
MSDelay(5);
}
MSDelay(1000);
for(i=0;i<5;i++)
{
BUZZER = ON;
MSDelay(500);
BUZZER = OFF;
MSDelay(500);
}
}
MSDelay(3000);
} // end of super while
} // end of main
void x_pluse_pin_conFig.:uration(unsigned char x)
{ if(x == VCC)
{
RE0 = 1;// 5 v on RA0
}
if(x == ADI)
{
TRISE0 = 1;// RB1 HIZ
}
}
void x_minus_pin_conFig.:uration(unsigned char x)
{
if(x == GND)
{
RE1 = 0; // GND on RA1
}
if(x == HIZ)
{
TRISE1 = 1;
}
}
void y_pluse_pin_conFig.:uration(unsigned char x)
{
if(x == ADI)
{
TRISE2 = 1;
}
if(x == VCC)
{
RE2 = 1;
}
}
void y_minus_pin_conFig.:uration(unsigned char x)
{
if(x == HIZ)
{
TRISA2 = 1;
}
if(x == GND)
{
RA2 = 0;
}
}
OUTCOME
REFRENCES
1. http://www.koratharackal.heliohost.org/other/images/5V_PS_7805_Circuit.jpg
2. http://www.fujitsu.com/downloads/MICRO/fma/pdf/LCD_Backgrounder.pdf
3. http://www.ti.com/lit/an/slyt209a/slyt209a.pdf
4. http://en.wikipedia.org/wiki/Stepper_motor
5. http://datasheet.octopart.com/MOC70P2-Fairchild-datasheet-8378515.pdf
6. http://ww1.microchip.com/downloads/en/DeviceDoc/39582C.pdf
7. http://www.datasheetcatalog.com/datasheets_pdf/U/L/N/2/ULN2003A.shtml
8. www.sunrom.com/p-1122.html
9.http://www.adinco.nl/site/media/downloads/aandrijftechniek/B25-26_H3-17H_Hybrid_stepping_motor_rev0.pdf
10.Mohammed Ali Mazidi, Jalica Gillispie Mazidi, Rolin D. McKinllay, The 8051 Microcontroller & Embedded Systems Using Assembly and C, 2nd ed., India: Manipal Press Ltd., 2008