Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Fingerprint Detection using Microcontroller- (Part 45/46)

By Gurmeet Singh

REQUIREMENTS:

  1. AtMega 16 Microcontroller (development board)
  2. Fingerprint scanner module (R305)
  3. 16X2 Alphanumeric LCD (for user display)

DESCRIPTION:

In today’s secure world biometric safety is on the top. Unlike other techniques which make use of passwords and numbers, that are needed to be remembered, biometric techniques make use of human body parts like fingerprints or even iris of your eyes and as we know that these things are unique to all thus it makes biometric systems the most effective over others. In this project I have interfaced a very popular fingerprint scanner R305 with AtMega 16 microcontroller. This module communicates over UART protocol with microcontroller i.e. it makes use of Rx and Tx pin of microcontroller to interact with it.

Now talking about this module, it comes preloaded with scanner as well as detection section and we are left with 4 pins for connections. These 4 pins are: VCC, GND, Rx and Tx. It works over 3.3 to 5V supply and its Rx and Tx pin is connected to Tx and Rx pin of the microcontroller respectively. The mode is semi duplex asynchronism serial communication and the default baud rate is 57600bps but it can be changed between 9600~115200bps.

At power on, it takes about half a second for initialization, during this period the module can’t accept commands. The system sets aside a 512-bytes memory (16 pages X 32 bytes) for user’s notepad, where data requiring power-off protection can be stored. There is an image buffer and two 512-byte-character-file buffers within the RAM space of the module. This buffer serves for image storage and the image format is 256*288 pixels.  Two character file buffers can be used to store both character file and template file. System sets aside a certain space within Flash for fingerprint template storage, that’s fingerprint library. It is non volatile in nature. This module also serves the purpose for providing any 32 bit random number.

When communicating, the transferring and receiving of command/data/result are all wrapped in data package format.

Image showing format of Data Packet for communicating Commands, Result or Data from R305 Fingerprint Module

 Fig. 1: 

Image showing format of Data Packet for communicating Commands, Result or Data from R305 Fingerprint Module

ADDER: Default value is 0xFFFFFFFF, which can be modified by command. High byte transferred first and at wrong adder value, module will reject to transfer.HEADER: Fixed value of 0xEF01

PACKAGE IDENTIFIER: Its size is one byte. 01H for command packet and 07H for acknowledge packet.

PACKAGE LENGTH: Refers to the length of package content (command packets and data packets) plus the length of Checksum ( 2 bytes). Unit is byte. Max length is 256 bytes.

PACKAGE CONTENTS: It can be commands, data and command’s parameters, acknowledge result, etc. (fingerprint character value, templates are all deemed as data)

CHECKSUM: The arithmetic sum of package identifier, package length and all packages contends. Overflowing bits are omitted. High byte is transferred first.

Let me clear this concept with an example:-

To change the Modules Address, a command package like this is needed to be sent to it:

Image showing format of Data Packet used for sending command to change address of R305 Fingerprint Module

Fig. 2: Image showing format of Data Packet used for sending command to change address of R305 Fingerprint Module

If change becomes successful this type of acknowledge package will be received by it:

Image showing format of Data Packet received on success of change in address of R305 Fingerprint Module

Fig. 3: Image showing format of Data Packet received on success of change in address of R305 Fingerprint Module

*If there will be any error while doing this task, this CODE will change to 0x01.

If change becomes successful this type of acknowledge package will be received by it:

Coming back to this project I have made use of only few functions out of several. These are:

  1. Collecting finger image
  2. Generating character file from that image
  3. Generating template for this character file
  4. Storing template in Flash library
  5. Deleting template from Flash library
  6. Searching finger library

When enrolling, user needs to enter the finger two times. The system will process the two time finger images, generate a template of the finger based on processing results and store the template. When matching, user enters the finger through optical sensor and system will generate a template of the finger and compare it with templates of the finger library. For 1:1 matching, system will compare the live finger with specific template designated in the Module; for 1:N matching, or searching, system will search the whole finger library for the matching finger. In both circumstances, system will return the matching result, success or failure.

Here N is the maximum number of templates flash library can store. Mine has 1000.

I would recommend going through its datasheet and understanding how to communicate with it and see what all functions it can perform. I have attached the PDF file of the same in this folder itself.

In this project you will see that on powering up the microcontroller the fingerprint module will take certain time to initialize itself, thus I have given it plenty of delay time to do so. Also the status will be shown on a 16X2 LCD and some LEDS as well.

LCD is connected to PORTB and will work under 4 bit mode. LEDs are connected with PORTC.

Prototype of AVR ATMega16 and R305 Module based Fingerprint Scanner

Fig. 4: Prototype of AVR ATMega16 and R305 Module based Fingerprint Scanner

Typical Image of R305 Fingerprint Module

Fig. 5: Typical Image of R305 Fingerprint Module

Image showing pin connections of R305 Fingerprint Module

Fig. 6: Image showing pin connections of R305 Fingerprint Module

Header files used in my coding part have been attached inside this folder itself.

APPLICATIONS:

  1. Can be used in biometric attendance systems
  2. Can be used for security purposes where high level security is desired

Project Source Code

#include<avr/io.h>

#include<util/delay.h>

#include<uart.h>

#include<lcd.h>

 

void read_finger_1()          //for char_buffer1

{

      int i=0;

      char k=1,ch=1;

 

      sendchar_uart(239);

      sendchar_uart(1);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(3);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(5);

 

      for(i=0;i<10;i++)

      {

            k=getchar_uart();

            if(i==9)

            {

                  ch=k;

                  k=getchar_uart();

                  k=getchar_uart();

                  if(ch==0x00)

                  {

                        PORTC|=(1<<0);

                        k=1;

                        sendchar_uart(239);

                        sendchar_uart(1);

                        sendchar_uart(255);

                        sendchar_uart(255);

                        sendchar_uart(255);

                        sendchar_uart(255);

                        sendchar_uart(1);

                        sendchar_uart(0);

                        sendchar_uart(4);

                        sendchar_uart(2);

                        sendchar_uart(1);

                        sendchar_uart(0);

                        sendchar_uart(8);

                        i=0;

                        for(i=0;i<10;i++)

                        {

                              k=getchar_uart();

                              if(i==9)

                              {

                                    ch=k;

                                    k=getchar_uart();

                                    k=getchar_uart();

                                    if(ch==0x00)

                                    {

                                          PORTC|=(1<<1);

                                    }

                              }

                        }

                  }

            }

      }

}

 

void read_finger_2()          //for char_buffer2

{

      int i=0;

      char k=1,ch=1;

 

      sendchar_uart(239);

      sendchar_uart(1);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(3);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(5);

 

      for(i=0;i<10;i++)

      {

            k=getchar_uart();

            if(i==9)

            {

                  ch=k;

                  k=getchar_uart();

                  k=getchar_uart();

                  if(ch==0x00)

                  {

                        PORTC|=(1<<2);

                        k=1;

                        sendchar_uart(239);

                        sendchar_uart(1);

                        sendchar_uart(255);

                        sendchar_uart(255);

                        sendchar_uart(255);

                        sendchar_uart(255);

                        sendchar_uart(1);

                        sendchar_uart(0);

                        sendchar_uart(4);

                        sendchar_uart(2);

                        sendchar_uart(2);

                        sendchar_uart(0);

                        sendchar_uart(9);

                        i=0;

                        for(i=0;i<10;i++)

                        {

                              k=getchar_uart();

                              if(i==9)

                              {

                                    ch=k;

                                    k=getchar_uart();

                                    k=getchar_uart();

                                    if(ch==0x00)

                                    {

                                          PORTC|=(1<<3);

                                    }

                              }

                        }

                  }

            }

      }

}

 

void make_template()

{

      int i=0;

      char k=1,ch=1;

 

      k=1;

      sendchar_uart(239);

      sendchar_uart(1);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(3);

      sendchar_uart(5);

      sendchar_uart(0);

      sendchar_uart(9);

 

      for(i=0;i<10;i++)

      {

            k=getchar_uart();

            if(i==9)

            {

                  ch=k;

                  k=getchar_uart();

                  k=getchar_uart();

                  if(ch==0x00)

                        PORTC|=(1<<4);

            }

      }

 

}

 

void check_finger()

{

int i=0;

char k=1,ch=1;

 

sendchar_uart(239);

sendchar_uart(1);

sendchar_uart(255);

sendchar_uart(255);

sendchar_uart(255);

sendchar_uart(255);

sendchar_uart(1);

sendchar_uart(0);

sendchar_uart(8);

sendchar_uart(4);

sendchar_uart(1);

sendchar_uart(0);

sendchar_uart(0);

sendchar_uart(0);

sendchar_uart(10);

sendchar_uart(0);

sendchar_uart(24);

 

for(i=0;i<10;i++)

      {

            k=getchar_uart();

            if(i==9)

            {

                  ch=k;

                  k=getchar_uart();

                  k=getchar_uart();

                  k=getchar_uart();

                  k=getchar_uart();

                  k=getchar_uart();

                  k=getchar_uart();

                  LCDclr();

                  if(ch==0x00)

                        {

                              PORTC|=(1<<5);

                              LCDdisplay("FINGER FOUND");

                        }

                  else

                        LCDdisplay("FINGER NOT FOUND");

            }

      }

}

 

void store(int ID)

{

      int i=0,sum=14+ID;

      char k=1,ch=1;

 

      sendchar_uart(239);

      sendchar_uart(1);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(6);

      sendchar_uart(6);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(ID);

      sendchar_uart(0);//C

      sendchar_uart(sum);//C

 

      for(i=0;i<10;i++)

            {

                  k=getchar_uart();

                  if(i==9)

                  {

                        ch=k;

                        k=getchar_uart();

                        k=getchar_uart();

                        if(ch==0x00)

                              PORTC|=(1<<6);

                  }

            }

}

 

void empty()

{

      int i=0;

      char k=1,ch=1;

 

      sendchar_uart(239);

      sendchar_uart(1);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(255);

      sendchar_uart(1);

      sendchar_uart(0);

      sendchar_uart(3);

      sendchar_uart(13);

      sendchar_uart(0);

      sendchar_uart(17);

 

      for(i=0;i<10;i++)

            {

                  k=getchar_uart();

                  if(i==9)

                  {

                        ch=k;

                        k=getchar_uart();

                        k=getchar_uart();

                        if(ch==0x00)

                              PORTC|=(1<<7);

                  }

            }

}

 

void main()

{

      DDRC=0xff;

      PORTC=0;

 

      enable_uart(9600);

      LCDinit();

      LCDclr();

      _delay_ms(5000);  //plenty of delay for modules initialization

      LCDdisplay("Scanning.....");

      read_finger_1();  //scans and stores in char_buffer1

      read_finger_2();  //scans and stores in char_buffer2

      make_template();  //makes the template with info in char_buffer1 & char_buffer2 and stores it in char_buffer1

      check_finger();         //checks for the finger authentication

//    store(0);               //stores the scanned value to the given parametric location in flash library

//    empty();                //empties the flash library

}

 

   


Circuit Diagrams

Circuit-Diagram-AVR-ATMega16-R305-Module-Based-Fingerprint-Scanner

Project Video


Filed Under: Electronic Projects
Tagged With: avr
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • Introduction to Brain Waves & its Types (Part 1/13)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Variable Phase shift control circuit for PWM circuit
  • Passive Harmonics Filter
  • Avalanche Pulser
  • Pull up via GPIO
  • Fpga wake up

RSS Electro-Tech-Online.com Discussions

  • Someone please explain how this BMS board is supposed to work?
  • HV Diodes
  • DIY bluetooth speaker
  • Question about ultrasonic mist maker
  • Disabled son needs advice please
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering