Interfacing GT511C3 Finger Print Sensor (FPS) with Arduino

Published  May 14, 2019   0
User Avatar Aswinth Raj
Author
Interfacing GT511C3 Finger Print Sensor with Arduino

Biometrics has been used as a reliable authentication system for a long time now. Today there exist complex biometric systems which can identify a person by his heart beat rhythm or even by his DNA. Other feasible methods include voice recognition, Face recognition, Iris scanning and Finger print Scanning. Out of which the finger print recognition is the most widely used method, we can find it from a simple attendance system to smart phones to Security checks and much more.

In this tutorial we will learn how to use the popular GT511C3 Finger Print Sensor (FPS) with Arduino. There are many FPS available and we have already learnt how to use them to build designs like Attendance system, Voting Machine, Security system etc. But the GT511C3 is more advanced with high accuracy and faster response time, so we will learn how to use it with Arduino to enroll finger prints on it and then detect the fingerprints whenever required. So let’s get started.

 

Materials Required

  • Arduino Nano/UNO
  • GT511C3 Finger Print Sensor
  • 16x2 LCD screen
  • Pot – 10k and 1k,10k,22k resistors
  • Push button
  • Connecting Wires
  • Bread board

 

GT511C3 Fingerprint Sensor (FPS) Module

Before diving into the project let us understand about the GT511C3 fingerprint sensor Module and how it works. This sensor is very different form the Capacitive and Ultrasonic Fingerprint sensor that are commonly used in our smart phones. The GT511C3 is an optical Fingerprint sensor, meaning it relies on images of your fingerprint to recognize its pattern. Yes you read that right, the sensor actually has a camera inside it which takes pictures of your fingerprint and then processes these images using powerful in-built ARM Cortex M3 IC. The below image shows the front and back side of the sensor with pinouts.

GT511C3 Fingerprint Sensor (FPS) Module

 

As you can see the sensor has a camera (black spot) surrounded by blue LEDs, these LEDs have to be lit up to take a clear image of the fingerprint. These images are then processed and converted into binary value by using the ARM Microcontroller coupled with EEPROM. The module also has a green color SMD LED to indicate power. Each fingerprint image is of 202x258 pixels with a resolution of 450dpi. The sensor can enroll upto 200 fingerprints and for each finger print template it assigns an ID form 0 to 199. Then during detection it can automatically compare the scanned fingerprint with all 200 templates and if a match is found it gives the ID number of that particular fingerprint using the Smack Finger 3.0 Algorithm on the ARM Microcontroller. The sensor can operate from 3.3V to 6V and communicates through Serial communication at 9600. The communication pins (Rx and Tx) is said to be only 3.3V tolerant, however the datasheet does not specify much about it. The pin-out of a GT511C3 FPS is shown below.

GT511C3 FPS Pinout

 

Apart from serial communication the module can also be directly interfaced to computer though USB connection using the pins shown in previous image. Once connected to computer the module can be controlled using the SDK_DEMO.exe application which can be downloaded from the link. This application allows the user to enroll/verify/delete fingerprints and also to recognize fingerprints. The software can also help you to read the image captured by the sensor which is worth giving it a try. Alternatively you can also use this Software even if the sensor is connected with Arduino, we will discuss on this later in this article.

Another interesting feature about the sensor is the metal casing around sensing region. As I told earlier the blue LED has to be turned on for the sensor to work. But in applications where the sensor should actively wait for a fingerprint it is not possible to keep the LED turned on always since it will heat up the sensor and thus damage it. Hence in those cases the metal casing can be wired to a capacitive touch input pin of a MCU to detect if it is being touched. If yes the LED can be turned on and the sensing process can be started. This method is not demonstrated here as it is outside the scope of this article.  

When operating at 3.3V the sensor consumes about 130mA. It requires nearly 3 seconds for enrolling a finger and 1 second to identify it. However if the enrolled template count is less the recognition speed will be high. For more details about the sensor you can refer to this datasheet from ADH-Tech who is the official manufacturer of the module. 

 

Connecting GT511C3 Finger Print Sensor with Arduino

The GT511C3 FPS has two power pins which can be powered by +5V pin of Arduino and two communication pins Rx and Tx which can be connected to any digital pin of Arduino for serial communication. Additionally we have also added a push button and a LCD to display the sensor status. The complete circuit diagram for Arduino GT511C3 Fingerprint Sensor interfacing can be found below.

Arduino GT511C3 Finger Print Sensor Circuit Diagram Connections

 

Since the Rx and Tx pins are 3.3V tolerant we have used a potential divider on the Rx side to convert 5V to 3.3V. The 10k resistor and 22k resistor converts the 5V signal from the Arduino Tx pin to 3.3V before it reaches the Rx pin of the FPS. The Sensor can also be powered by 3.3V but make sure your Arduino can source enough current for the sensor. We have connected the LCD in 4-bit mode powered by 5V pin of Arduino. A push button is connected to pin D2 which when pressed will put the program in enroll mode where the user can enroll new finger. After enrolling the program will remain in scanning mode to scan for any finger touching the sensor.

 Arduino GT511C3 Finger Print Sensor Circuit Connections

 

Arduino GT511C3 Finterprint Sensor Library

As mentioned earlier the GT511C3 FPS communicates through serial communication, the sensor understands hex code and for each hex code a particular operation is performed. You can check the datasheet to know all the hex values and its corresponding function if you are interested. But, lucky for us bboyho has already created a library which can be used directly with Arduino to Enroll and detect finger prints. The Github library for GT511C3 FPS can be downloaded from the link below

GT511C3 Arduino Library

The link will download a ZIP file, you would then have to add it to your Arduino IDE by following the command Sketch -> Include Library -> Add .ZIP Library. Once you have added the library restart your IDE and you should be able to find the example programs for GT511C3 FSP under File -> Example -> Fingerprint Scanner TTL as shown below

Arduino with GT511C3 Finger Print Sensor

 

You should see four example programs, the blink program will blink the blue led on the FPS, the enroll and ID finger program can be used to enroll and identify the fingers accordingly. Note that a finger once enrolled will always be remembered by the module even if it is powered off.

The Serial Pass-through program can be uploaded to the Arduino to use the Demo_SDK.exe application that we discussed earlier in this article. To delete any fingerprint template or to save a copy on your computer this SDK application can be used.

 

Arduino Finger Print Sensor Code

Our aim here is to write a program that will enroll a finger when a button is pressed and display the ID number of the finger that is already enrolled. We should also be able to display all information on the LCD to enable the project to be a stand-alone one. The complete code to do the same is give at the bottom of this page. Here I am breaking the same into small snippets to help you understand better.

As always we begin the program by including the required libraries, here we will need the FPS_GT511C3 library for our FPS module, Software serial to use D4 and D5 on serial communication and Liquid crystal for LCD interfacing. Then we need to mention to which pins the FPS and LCD is connected to. If you had followed the circuit diagram as such then it is 4 and 5 for FPS and D6 to D11 for LCD. The code for the same is shown below

#include "FPS_GT511C3.h" //Get library from https://github.com/sparkfun/Fingerprint_Scanner-TTL
#include "SoftwareSerial.h" //Software serial library
#include <LiquidCrystal.h> //Library for LCD

FPS_GT511C3 fps(4, 5); //FPS connected to D4 and D5

const int rs = 6, en = 7, d4 = 8, d5 = 9, d6 = 10, d7 = 11; //Mention the pin number for LCD connection
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);//Initialize LCD method

 

Inside the setup function, we display some introductory message on the LCD and then initialize the FPS module. The command fps.SetLED(true) will turn on the blue LED on the sensor, you can turn it off by fps.SetLED(false) when not required as it would heat up the sensor if left on continuously. We have also made the pin D2 as input pin and connected it to internal pull-up resistor so as to connect a push button to the pin.

void setup()
{
  Serial.begin(9600);
  lcd.begin(16, 2); //Initialise 16*2 LCD
  lcd.print("GT511C3 FPS"); //Intro Message line 1
  lcd.setCursor(0, 1);
  lcd.print("with Arduino"); //Intro Message line 2
  delay(2000);
  lcd.clear();

  fps.Open();         //send serial command to initialize fp
  fps.SetLED(true);   //turn on LED so fps can see fingerprint

  pinMode(2,INPUT_PULLUP); //Connect to internal pull up resistor as input pin
}

 

Inside the void loop function we have to check if the button is pressed, if pressed we will enroll a new finger and save its template with an ID number by using the enroll function. If not we will keep waiting for a finger to be pressed in the sensor. If pressed we will indentify the fingerprint by comparing it to all enrolled fingerprints template using the 1:N method. Once the ID number is discovered we will display welcome followed by the ID number. If the finger print did not match with any of the enrolled fingers the id count will be 200, in that case we will display welcome unknown.

  if (digitalRead(2))//If button pressed
  {
  Enroll(); //Enroll a fingerprint
  }

// Identify fingerprint test
  if (fps.IsPressFinger())
  {
    fps.CaptureFinger(false);
    int id = fps.Identify1_N();
      lcd.clear();
      lcd.print("Welcome:");
      if (id==200) lcd.print("Unkown  "); //If not recognised
      lcd.print(id);
      delay(1000);
  }

 

The enroll function would have to take three sample inputs to enroll one finger successfully. Once enrolled a template for that particular finger will be created which will not be deleted unless the user forced it though HEX commands. The code to enroll a finger is shown below. The method IsPressFinger is used to check if a finger is detected, if yes then the image is captured using CaptureFinger and then finally Enroll1, Enroll2 and Enroll3 is used for three different samples to successfully enroll one finger. The LCD displays the ID number of the finger if enrolled successfully else it would display a failure message with code. Code 1 means the finger print was not captured clearly and hence you have to try again. Code 2 is a memory fail indication and code 3 is to indicate that the finger has already been enrolled.

void Enroll() //Enrol function from library exmaple program
{
  int enrollid = 0;
  bool usedid = true;
  while (usedid == true)
  {
    usedid = fps.CheckEnrolled(enrollid);
    if (usedid==true) enrollid++;
  }
  fps.EnrollStart(enrollid);
  // enroll
  lcd.print("Enroll #");
  lcd.print(enrollid);
  while(fps.IsPressFinger() == false) delay(100);
  bool bret = fps.CaptureFinger(true);
  int iret = 0;
  if (bret != false)
  {
    lcd.clear();
    lcd.print("Remove finger");
    fps.Enroll1();
    while(fps.IsPressFinger() == true) delay(100);
    lcd.clear(); lcd.print("Press again");
    while(fps.IsPressFinger() == false) delay(100);
    bret = fps.CaptureFinger(true);
    if (bret != false)
    {
      lcd.clear(); lcd.print("Remove finger");
      fps.Enroll2();
      while(fps.IsPressFinger() == true) delay(100);
      lcd.clear(); lcd.print("Press yet again");
      while(fps.IsPressFinger() == false) delay(100);
      bret = fps.CaptureFinger(true);
      if (bret != false)
      {
        lcd.clear(); lcd.print("Remove finger");
        iret = fps.Enroll3();
        if (iret == 0)
        {
          lcd.clear(); lcd.print("Enrolling Success");
        }
        else
        {
          lcd.clear();
          lcd.print("Enroll Failed:");
          lcd.print(iret);
        }
      }
      else lcd.print("Failed 1");
    }
    else lcd.print("Failed 2");
  }
  else lcd.print("Failed 3");
}

 

Working of GT511C3 Finger Print Sensor with Arduino

Now that our hardware and code is ready it is time to test our project. Upload the code to Arduino and power it up, I am just using the micro-usb port to power the project. On booting we should see the intro message on the LCD and then it should display “Hi!..”. This means that FPS is ready to scan for finger, if any enrolled finger is pressed it would say “Welcome” followed by the ID number of that finger as shown below.

Interfacing GT511C3 Finger Print Sensor (FPS) with Arduino

 

If a new finger has to be enrolled then we can use the push button to get into enroll mode and follow the LCD instruction to enroll a finger. After the enrolling process is complete the LCD will display “Hi!..” again to indicate that it is read to indentify fingers again. The complete working can be found at the video linked below.

Testing GT511C3 Finger Print Sensor with Arduino

 

From here you can develop many interesting stuff on top on this using the Finger Print sensor module. Hope you understood the tutorial and enjoyed building something useful, if you have any questions leave them in the comment section or use the forums for other technical questions.

Code

/*
 * Arduino with GT511C2 FingerPrint Sensor (FPS)
 * Code to enroll and Detect Fingers
 * For: www.circuitdigest.com
 * Dated: 6-5-19
 * Code By: Aswinth
 * 
 * Connect Tx of FPS to Arduino Pin D4 and Rx of FPS to D5
 */

#include "FPS_GT511C3.h" //Get library from https://github.com/sparkfun/Fingerprint_Scanner-TTL&nbsp;
#include "SoftwareSerial.h" //Software serial library 
#include <LiquidCrystal.h> //Library for LCD

FPS_GT511C3 fps(4, 5); //FPS connected to D4 and D5

const int rs = 6, en = 7, d4 = 8, d5 = 9, d6 = 10, d7 = 11; //Mention the pin number for LCD connection
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);//Initialize LCD method

 

 

void setup()
{
  Serial.begin(9600);
  lcd.begin(16, 2); //Initialise 16*2 LCD
  lcd.print("GT511C3 FPS"); //Intro Message line 1
  lcd.setCursor(0, 1);
  lcd.print("with Arduino"); //Intro Message line 2
  delay(2000);
  lcd.clear();

  fps.Open();         //send serial command to initialize fps 
  fps.SetLED(true);   //turn on LED so fps can see fingerprint

  pinMode(2,INPUT_PULLUP); //Connect to internal pull up resistor as input pin 
}

void loop()

  if (digitalRead(2)==0)//If button pressed 
  {
  Enroll(); //Enroll a fingerprint 
  }

// Identify fingerprint test
  if (fps.IsPressFinger())
  {
    fps.CaptureFinger(false);
    int id = fps.Identify1_N();
      lcd.clear();
      lcd.print("Welcome:"); 
      if (id==200) lcd.print("Unkown  "); //If not recognised 
      lcd.print(id);
      delay(1000);
  }
  else
  {
    lcd.clear(); lcd.print("Hi!....."); //Display hi when ready to scan 
  }

}

 

void Enroll() //Enrol function from library exmaple program 
{
  int enrollid = 0;
  bool usedid = true;
  while (usedid == true)
  {
    usedid = fps.CheckEnrolled(enrollid);
    if (usedid==true) enrollid++;
  }
  fps.EnrollStart(enrollid);

  // enroll
  lcd.clear();
  lcd.print("Enroll #");
  lcd.print(enrollid);
  while(fps.IsPressFinger() == false) delay(100);
  bool bret = fps.CaptureFinger(true);
  int iret = 0;
  if (bret != false)
  {
    lcd.clear();
    lcd.print("Remove finger");
    fps.Enroll1(); 
    while(fps.IsPressFinger() == true) delay(100);
    lcd.clear(); lcd.print("Press again");
    while(fps.IsPressFinger() == false) delay(100);
    bret = fps.CaptureFinger(true);
    if (bret != false)
    {
      lcd.clear(); lcd.print("Remove finger");
      fps.Enroll2();
      while(fps.IsPressFinger() == true) delay(100);
      lcd.clear(); lcd.print("Press yet again");
      while(fps.IsPressFinger() == false) delay(100);
      bret = fps.CaptureFinger(true);
      if (bret != false)
      {
        lcd.clear(); lcd.print("Remove finger");
        iret = fps.Enroll3();
        if (iret == 0)
        {
          lcd.clear(); lcd.print("Enrolling Success");
        }
        else
        {
          lcd.clear();
          lcd.print("Enroll Failed:");
          lcd.print(iret);
        }
      }
      else lcd.print("Failed 1");
    }
    else lcd.print("Failed 2");
  }
  else lcd.print("Failed 3");
}

Video

Have any question realated to this Article?

Ask Our Community Members