Here I am discussing about a project that I had done during my graduation. I had to complete this project as a part of my college final year project. I had teamed up with two others, my classmates to complete it in the mentioned deadline.
The project describes how to implement a car security system using a finger print technology. Basically the procedure is to access the car using a finger (finger print). The car access security is so designed that it can be accessed by anyone whose finger is registered with the device. The car is loaded with a master fingerprint (MFP) that has access to all the functions of the device, full access to car’s features so on. The other (not mandatory) member’s finger prints registered not as master (SFP) can access limited features of the car. The master can add, remove or deactivate a slave member.
Basic modules in the project are:
• Finger print scanner.
• Module control unit.
A much powerful renases R8C25 IC [features] is used for this project. The reason why I preferred to use this particular IC was just with a mere intention to learn about this new chip. One can use any cheaper IC with similar features.
Let us go through the details:
Now, I will take you through a deeper explanation of the project, features, its advantages and disadvantages. As I mentioned the device is fully controlled by a master. In the project designed, the master can access the car doors, the bonnet (hood), the boot, start engine and drive the car. The slave members can access only those parts authorized and permitted by the master. The device understands the identifies the user and thus activates the profile as Master or as slave.
The device which can be fitted inside the car, does not allow the vehicle to start without the verification of fingerprint, even though the right key is used. It immobilizes the car in the driver’s absence and thus reduces thefts possibilities.
The control unit is normally installed inside the deck. The scanner can be installed in any convenient location in the vehicle with the keypad and scanner slots.
A brief description about the IDE, modules and source code development:
IDE:
The IDE (Integrated Development Environment) HEW (High Performance Embedded Workshop) is used to program the Renases R8C25. HEW enables the use of the right tool for each process. HEW supports multiple tool chain integration enabling development for any number of projects under a single user interface. HEW also eliminates the need to switch environments between coding and debugging operations.
The feature of the finger print module:
Hardware connections:
The hardware connection is via serial interface. The module may communicate with MCU of 3.3V or 5V power. TD connects with RXD of MCU, RD connects with TXD of MCU. Should the computer be in RS-232 mode, add level converting circuit like MAX 232 between module and PC.
UART or serial communication is made use of for communication of the module with the computer. The baud rate may be set between 9600 and 115200
LCD
Display:
A STN type 16X2 LCD display is used in the circuit. Further details about how to use a LCD display is described in relevant post.
Power Supply:
LM7805 for 5V supply required in control unit and LM117 for 3.3V supply required in Finger Print Module is used.
Advantages:
- The natural uniqueness of finger print of a person increases the level of security.
- The locked car can be accessed only by the registered members.
- The user friendly features and flexibility helps one to control the slave member’s user access.
-
The car cannot be used by friends in case of emergency.
Source Code:
// HEADER FILES
#include "sfr_R825.h"
//Definition
of R8C/25 SFR
#include
"hd4478_8b.h"
// INITIALIZATIONS AND
FUNCTIONS
int i=0;
void delay(int x);
void Hold_Parent(void);
void enroll_fp(void);
void initial_display(void);
void scanning(void);
void enrolled(void);
void fp_not_recognized(void);
void access_vehicle(void);
void enroll_completed(void);
void Parent_mode(void);
void fp_recognized(void);
void hold_child(void);
void init(void);
void lock(void);
void fp_recognization(void);
void child_mode(void);
void parent_or_child(void);
int
i,h,k,d,w,timer=0,count,image_create_enable=0;
int store_location_select=0;
char
flag=0,msg_format[25]={"BWD<SEND INFORMATION>"};
int
enroll_count,enroll_act=0,library_check = 0;
int library_check2=0,sens=0;
int
enable,Number_of_bytes=0,array_count=0;
void finger_print_scan(void);
void uart_transmit(const char
b[100]);
void
finger_print_module_initialisation(void);
void store_location(int x);
void beep(void);
void short_beep(void);
void enroll_finger_print(void);
void
Command_for_collecting_the_image_from_the_scanner_1st_time(void);
void
Moves_the_image_in_to_char_buffer1_(void);
void
Command_for_collecting_the_image_from_the_scanner_2nd_time(void);
void
Moves_the_image_in_to_char_buffer2_(void);
void
Creating_Finger_Templates_(void);
void
Store_the_templates_into_the_flash_0th_Location_(void);
void empty_library_(void);
void uart_transmit_array(char
*b);
void delay_ms(unsigned long int
ms);
void delay_us(unsigned long int
uS);
void delay(int);
void init(void);
void _empty_library_(void);
void
_enroll_finger_print_(void);
void hold_your_fgr(void);
void _finger_print_scan_(void);
unsigned char
finger_print_initialisation[100]={0xFB,0x0D,0xFA,0x27,0xFC,0xFC,0xD0,0x12,0xEC,0x3F,0xFF,0xFF,0x10,0xB1,0x10,0x10,0xB0,0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x07,0x13,0x00,0x00,0x00,0x00,0x00,0x1B,0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01};
unsigned char
device_open[100]={0xFB,0x0D,0xFA,0x27,0xFC,0xFC,0xD0,0x12,0xEC,0x3F,0xFF,0xFF,0x10,0xB1,0x10,0x10,0xB0,0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x07,0x13,0x00,0x00,0x00,0x00,0x00,0x1B};
unsigned char
command_for_collecting_the_image[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x01,0x00,0x05};
unsigned char
Moves_the_image_in_to_buffer1[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x04,0x02,0x01,0x00,0x08};
unsigned char
Moves_the_image_in_to_buffer2[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x04,0x02,0x02,0x00,0x09};
unsigned char
Creating_Finger_Templates[12]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x05,0x00,0x09};
unsigned char
Store_the_templates_into_the_flash_0th_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x00,0x00,0x0F};
unsigned char
Store_the_templates_into_the_flash_1st_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x01,0x00,0x10};
unsigned char
Store_the_templates_into_the_flash_2nd_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x02,0x00,0x11};
unsigned char
Store_the_templates_into_the_flash_3rd_Location[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x06,0x06,0x02,0x00,0x03,0x00,0x12};
unsigned char
search_library[20]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x08,0x1B,0x01,0x00,0x00,0x01,0x01,0x00,0x27};
unsigned char
capture[50]={0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05,0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X0A,0X00,0X0E,0XEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X0A,0X00,0X0E};
unsigned char
finger_collection_success[12]={0xef,0x01,0XFF,0XFF,0XFF,0XFF,0x07,0x00,0x03,0x00,0x00,0x0a};
unsigned char
send[50]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0X00,0X03,0X16,0X00,0X1A};
unsigned char
finger_presence_checking_array[12]={0xef,0x01,0xff,0xff,0xff,0xff,0x07,0x00,0x03,0x00,0x00,0x0a};
unsigned char
send_acknowledgement[1000];
unsigned char
empty_finger_library[12]={0xef,0x01,0XFF,0XFF,0XFF,0XFF,0x01,0x00,0x03,0x0d,0x00,0x11};
unsigned char
empty_finger_library_acknowledgement[12];
unsigned char
device_open_acknowledgement[10];
unsigned char
command_for_collecting_the_image_acknowledgement_for_search[12];
unsigned char
Creating_Finger_Templates_acknowledgement[12];
unsigned char
command_for_collecting_the_image_acknowledgement[12];
unsigned char
command_for_collecting_the_image_acknowledgement2[12];
unsigned char
Store_the_templates_into_the_flash_0th_Location_acknowledgement[12];
unsigned char Store_the_templates_into_the_flash_1st_Location_acknowledgement[12];
unsigned char
Store_the_templates_into_the_flash_2nd_Location_acknowledgement[12];
unsigned char
Store_the_templates_into_the_flash_3rd_Location_acknowledgement[12];
unsigned char buffer1_acknowledgement[12];
unsigned char
buffer1_acknowledgement_for_search[12];
unsigned char
buffer2_acknowledgement[12];
unsigned char
search_library_acknowledgement[18];
// MAIN
void main(void)
{
asm("FCLR I");
//Interrupt disable
prc0=1; //Protect off
selected.(cm14=1)
cm13=1;cm05=0;cm14=0; //Main
Clock selected(cm0 bit 5, cm1 bit 3 and 4)
for(i=0; i<10; i++);
cm15=1; //High Drive Capacity
selected(cm1 bit 5)
ocd2=0; //Main Clock
selected(ocd bit 2)
cm16=0;cm17=0;cm06=0; //No
division selected(cm0 bit 6,cm1 bit 6 and 7)
prc0=0; //Protect on
// Inital setting
asm("FSET I");
Hardware_Setup (); //Interrupt enabled
init();
initial_display();
delay(1500);
finger_print_module_initialisation()
while(1)
{
if(enroll_act == 0)
{
_empty_library_();
enroll_fp();
delay(500);
_enroll_finger_print_();
enroll_act = 1;
}
access_vehicle();
delay(500);
_finger_print_scan_();
}
}
// END OF MAIN
// FUNCTION DEFENITIONS
void initial_display(void)
{
Lcd_clear();
Print_RAMstring ("FINGER
PRINT",2,0);
Print_RAMstring ("VEHICLE
ACCESS",1,1);
}
void enroll_fp(void)
{
Lcd_clear();
Print_RAMstring ("Press
SW1",3,0);
Print_RAMstring ("To
Enroll FP",2,1);
}
void Hold_Parent(void)
{
Lcd_clear();
Print_RAMstring ("Hold
Parent's Fngr",0,0);
Print_RAMstring ("On
Optical Scanr",0,1);
}
void scanning(void)
{
Lcd_clear();
Print_RAMstring
("Scanning......",1,0);
}
void enrolled(void)
{
Lcd_clear();
Print_RAMstring
("Enrolled",4,0);
}
void enroll_completed(void)
{
Lcd_clear();
Print_RAMstring
("Enrollment",3,0);
Print_RAMstring
("Completed",3,1);
}
void access_vehicle(void)
{
Lcd_clear();
Print_RAMstring ("Press
SW2",3,0);
Print_RAMstring ("To
Access Vehicle",0,1);
}
void hold_child(void)
{
Lcd_clear();
Print_RAMstring ("Hold
Child's Fngr",0,0);
Print_RAMstring ("On
Optical Scanr",0,1);
}
void hold_your_fgr(void)
{
Lcd_clear();
Print_RAMstring ("Hold
Your Finger",0,0);
Print_RAMstring ("On
Optical Scanr",0,1);
}
void fp_not_recognized(void)
{
Lcd_clear();
Print_RAMstring
("Finger",5,0);
Print_RAMstring ("Not
Recognized",1,1);
}
void fp_recognized(void)
{
Lcd_clear();
Print_RAMstring
("Finger",5,0);
Print_RAMstring
("Recognized",3,1);
}
// Finger Print Module
void uart_transmit(const char
b[100])
{
for(k = 0; k <
Number_of_bytes; k++)
{
d = b[k];
while(ti_u0c1 == 0);
u0tb = d;
}
}
void uart_transmit_array(char
*b)
{
for(k = 0; k <
Number_of_bytes; k++)
{
d = b[k];
while(ti_u0c1 == 0);
u0tb = d;
delay_ms(1);
}
}
void
Moves_the_image_in_to_char_buffer1_(void)
{
Number_of_bytes = 13;
uart_transmit_array(Moves_the_image_in_to_buffer1);
array_count = 0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
buffer1_acknowledgement[array_count]
= u0rb;
array_count++;
}
delay_ms(9000);
}
void
void
Store_the_templates_into_the_flash_2nd_Location_(void)
{
Number_of_bytes = 15;
uart_transmit_array(Store_the_templates_into_the_flash_2nd_Location);
array_count = 0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
Store_the_templates_into_the_flash_2nd_Location_acknowledgement[array_count]
= u0rb;
array_count++;
}
}
void beep(void)
{
BUZZER_PIN_DIR = SET_AS_OUTPUT;
BUZZER = ACTIVATE;
delay_ms(20000);
BUZZER = DEACTIVATE;
delay_ms(100000);
}
void enroll_finger_print(void)
{
beep();
Command_for_collecting_the_image_from_the_scanner_1st_time();
Moves_the_image_in_to_char_buffer1_();
delay_ms(90000);
beep();
Command_for_collecting_the_image_from_the_scanner_2nd_time();
Moves_the_image_in_to_char_buffer2_();
if(image_create_enable == 2)
{
Creating_Finger_Templates_();
image_create_enable = 0;
store_location_select++;
store_location(store_location_select);
}
}
void finger_print_scan(void)
{
beep();
Number_of_bytes = 12;
uart_transmit_array(command_for_collecting_the_image);
array_count=0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
command_for_collecting_the_image_acknowledgement_for_search[array_count]
= u0rb;
array_count++;
}
Number_of_bytes = 13;
uart_transmit_array(Moves_the_image_in_to_buffer1);
array_count=0;
while(array_count < 12)
{
while(ri_u0c1 == 0);
buffer1_acknowledgement_for_search[array_count]
= u0rb;
array_count++;
}
delay_ms(9000);
Number_of_bytes = 17;
uart_transmit_array(
search_library);
array_count=0;
while(array_count < 16)
{
while(ri_u0c1 == 0);
search_library_acknowledgement[array_count]
= u0rb;
array_count++;
}
}
void _empty_library_(void)
{
//if(SWITCH1 == ON)
//{
//short_beep();
empty_library_();
delay_ms(10);
while(SWITCH1 == ON);
//}
}
void fp_recognization(void)
{
//if(library_check == 0)
// {
if(search_library_acknowledgement[9]
== 0)
{
//rec_activation=1;
for(sens=0;sens<2;sens++)
{
fp_recognized();
delay(700);
Lcd_clear();
delay(400);
library_check2 = 1;
}
}
else
{
for(sens=0;sens<2;sens++)
{
fp_not_recognized();
delay(700);
Lcd_clear();
delay(400);
}
}
//library_check = 1;
}
}
Disclaimer:
You may use this piece of code, however the author is not responsible for any
hardware of software damage caused by this code on your computer.
***