fbpx

Interface Fingerprint With ARM7

Description

Fingerprint module is a biometric sensor with TTL UART interface. It is used for authentication to identify individuals and verify their identity. The fingerprint sensor used to capture a digital image of the fingerprint pattern, this captured image is stored and used for matching.

Features

  • Power DC: 3.6V-6.0V
  • Working curent: 100mA
  • Baud rate (9600*N)bps, N=1-12 (default N=6)
  • Matching Mode:1:1 and 1:N
  • Interface: UART(TTL logical level)/ USB 1.1
  • Character file size:256 bytes
  • Image acquiring time:<0.5s
  • Storage capacity:120
  • Template size:512 bytes
  • Security level: 5
  • Average searching time: < 0.8s (1:880)
  • Window dimension: 18mm*22mm

Hardware Required

  • FingerPrint Sensor .
  • LCD 16×2
  • LPC21xx MicroController.

Circuit

Code

 #include<LPC214X.h>
 #include "uart1_arm.c"
 #include "uart0_arm.c"
 unsigned char finger_print_enroll(void);
 unsigned char finger_print_identify(void);
 unsigned char get_image(void);
 unsigned char generate_char(unsigned char );
 unsigned char create_template(void);
 unsigned char store_template(unsigned char );
 unsigned char search(unsigned char );
 void lcdcmd(unsigned char);
 void lcd_init(void);
 void lcddata(unsigned char*);
 void delay(unsigned int);
 unsigned char a;
 int main(void)
 {
 lcd_init();
 uart1_init();
 uart0_init();
 lcddata("welcome");
 delay(10000);
 lcdcmd(0x01);
 lcddata("Finger Print ");
 lcdcmd(0xC0);
 lcddata(" enrollment");
 delay(2000);
 a=finger_print_enroll();
 if(a!=1)
 while(1);
 lcdcmd(0x01);
 lcddata("Finger Print ");
 lcdcmd(0xC0);
 lcddata(" identification");
 delay(5000);
 a=finger_print_identify();
 while(1);
 }
 unsigned char finger_print_enroll(void)
 {
 unsigned char a;
 lcdcmd(0x01);
 lcdcmd(0x80);
 lcddata("Place the Finger ");
 lcdcmd(0xc0);
 lcddata("on the module");
 gim1:
 a=get_image();
 if(a==0x00)
 {
 lcdcmd(0x01);
 lcdcmd(0x80);
 lcddata("Scanning.");
 a=generate_char(0x01);
 if(a==0x00)
 {
 // lcdcmd(0x01);
 // lcdcmd(0x80);
 lcddata(".");
 a=get_image();
 if(a==0x00)
 {
 // lcdcmd(0x01);
 // lcdcmd(0x80);
 lcddata(".");
 a=generate_char(0x02);
 if(a==0x00)
 {
 // lcdcmd(0x01);
 // lcdcmd(0x80);
 lcddata("..");
 a=create_template();
 if(a==0x00)
 {
 // lcdcmd(0x01);
 // lcdcmd(0x80);
 lcddata("..");
 a=store_template(0x01);
 if(a==0x00)
 {
 lcdcmd(0x01);
 lcdcmd(0x80);
 lcddata("Success in ");
 lcdcmd(0xc0);
 lcddata("enrolling the finger");
 delay(10000);
 return 1;
 }
 else
 {
 lcdcmd(0x01);
 lcddata("error");
 lcdcmd(0xc0);
 lcddata("Try Again");
 return 0;
 }
 }
 else
 {
 lcdcmd(0x01);
 lcddata("error");
 lcdcmd(0xc0);
 lcddata("Try Again");
 return 0;
 }
 }
 else
 {
 lcdcmd(0x01);
 lcddata("error");
 lcdcmd(0xc0);
 lcddata("Try Again");
 return 0;
 }
 }
 else
 {
 lcdcmd(0x01);
 lcddata("error");
 lcdcmd(0xc0);
 lcddata("Try Again");
 return 0;
 }
 }
 else
 {
 lcdcmd(0x01);
 lcddata("error");
 lcdcmd(0xc0);
 lcddata("Try Again");
 return 0;
 }
 }
 else if(a==0x02)
 goto gim1;
 else
 {
 lcdcmd(0x01);
 lcdcmd(0x80);
 lcddata("Error in Scanning");
 lcdcmd(0xc0);
 lcddata("try again");
 goto gim1;
 }
 }
 unsigned char finger_print_identify(void)
 {
 unsigned char a;
 lcdcmd(0x01);
 lcddata("Place the finger");
 gim2:
 a=get_image();
 if(a==0x00)
 {
 lcdcmd(0x01);
 lcddata("scanning.");
 a=generate_char(0x01);
 if(a==0x00)
 {
 // lcdcmd(0x01);
 lcddata(".");
 a=search(0x01);
 if(a==1)
 {
 lcdcmd(0x01);
 lcddata("finger print");
 lcdcmd(0xc0);
 lcddata(" matched");
 IOPIN0 |=0x20;
 return 1;
 }
 else
 {
 lcdcmd(0x01);
 lcddata("finger print");
 lcdcmd(0xc0);
 lcddata("not matched");
 return 0;
 }
 }
 }
 else if(a==0x02)
 goto gim2;
 else
 {
 lcdcmd(0x01);
 lcdcmd(0x80);
 lcddata("Error in Scanning");
 lcdcmd(0xc0);
 lcddata("try again");
 return 0;
 }
 return 0;
 }
 unsigned char get_image(void)
 {
 unsigned char a[15],i=0;
 send_uart0(0xEF);
 send_uart0(0x01);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(0x03);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(0x05);
 for(i=0;i<12;i++)
 {
 while(!(U0LSR & 0X01)); // RX EMPTY
 a[i]=U0RBR;
 }
 return a[9];
 }
 unsigned char generate_char(unsigned char b)
 {
 unsigned char a[15],i=0,c=0;
 /*send1(HEADER);
 send1(M_ADD);
 send1(CMD);*/
 send_uart0(0xEF);
 send_uart0(0x01);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(0x04);
 send_uart0(0x02);
 send_uart0(b);
 c=0x07+b;
 send_uart0(0x00);
 send_uart0(c);
 for(i=0;i<12;i++)
 { while(!(U0LSR & 0X01)); // RX EMPTY
 a[i]=U0RBR;
 }
 return a[9];
 }
 unsigned char create_template()
 {
 unsigned char a[15],i=0;
 send_uart0(0xEF);
 send_uart0(0x01);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(0x03);
 send_uart0(0x05);
 send_uart0(0x00);
 send_uart0(0x09);
 for(i=0;i<12;i++)
 {
 while(!(U0LSR & 0X01)); // RX EMPTY
 a[i]=U0RBR;
 }
 return a[9];
 }
 unsigned char store_template(unsigned char b)
 {
 unsigned char a[15],i=0,c;
 send_uart0(0xEF);
 send_uart0(0x01);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(0x06);
 send_uart0(0x06);
 send_uart0(b);
 send_uart0(0x00);
 send_uart0(0x01); ///////c=b+0x01+13;///////////
 send_uart0(0x00);
 send_uart0(c);
 for(i=0;i<12;i++)
 {
 while(!(U0LSR & 0X01)); // RX EMPTY
 a[i]=U0RBR;
 }
 return a[9];
 }
 unsigned char search(unsigned char b)
 {
 unsigned char a[20],i=0;
 send_uart0(0x0EF);
 send_uart0(0x01);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0xFF);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(0x08);
 send_uart0(0x04);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(b);
 send_uart0(0x00);
 send_uart0(0x01);
 send_uart0(0x00);
 send_uart0(0x0F+b);
 for(i=0;i&16;i++)
 {
 while(!(U0LSR & 0X01)); // RX EMPTY
 a[i]=U0RBR;
 }
 lcdcmd(0x01);
 if(a[9]==0x00)
 {
 return 1;
 }
 else if(a[9]==0x01)
 {
 lcddata("RECEIVE ERROR");
 return 0;
 }
 else if(a[9]==0x09)
 {
 return 0;
 }
 return 0;
 }
 void lcd_init()
 {
 IODIR1=IODIR1 | 0x00FF0000;
 IODIR0=IODIR0 | 0x2400;
 lcdcmd(0x01);
 lcdcmd(0x38);
 lcdcmd(0x0E);
 lcdcmd(0x06);
 lcdcmd(0x80);
 }
 void lcdcmd(unsigned char a)
 {
 IO0CLR=IO0CLR | (1<<10);//making rs=0 for command reg
 IO1SET=IO1SET | (a<<16); //loading cmd to DO to D7
 IO0SET=IO0SET | (1<13);//making en=1
 delay(1000);
 IO0CLR=IO0CLR | (1<<13);//making en=0
 IO1CLR=IO1CLR | (a<<16);
 }
 void lcddata(unsigned char *a)
 {
 unsigned char i=0;
 for(i=0;a[i]!='\0';i++)
 {
 IO0SET=IO0SET | (1<<10);//making rs=1 for data reg
 IO1SET=IO1SET | (a[i]<<16);//loading data to D0 to D7
 IO0SET=IO0SET | (1<<13);//making en=1
 delay(1000);
 IO0CLR=IO0CLR | (1<<13);//making en=0
 IO1CLR=IO1CLR | (a[i]<<16);
 }
 }
 void lcddata1(unsigned char a)
 {
 IO0SET=IO0SET | (1<<10);//making rs=1 for data reg
 IO1SET=IO1SET | (a<<16);//loading data to D0 to D7
 IO0SET=IO0SET | (1<<13);//making en=1
 delay(1000);
 IO0CLR=IO0CLR | (1<<13);//making en=0
 IO1CLR=IO1CLR | (a<<16);
 }
 void delay(unsigned int count)
 {
 int i,j;
 for(i=0;i<count;i++)
 for(j=0;j<i;j++);
 }
  
   

Leave a Reply

Your email address will not be published. Required fields are marked *