Guide to Fingerprint Sensor Module with Arduino (FPM10A)

This post is an introductory guide on how to use the Fingerprint Sensor Module with the Arduino. We’ll show you how to enroll a new fingerprint ID, and how to find a fingerprint match.

Watch the Video Demonstration

Introducing the Fingerprint Sensor Module

Fingerprint sensor modules, like the one in the following figure, made fingerprint recognition more accessible and easy to add to your projects. This means that is is super easy to make fingerprint collection, registration, comparison and search.

These modules come with FLASH memory to store the fingerprints and work with any microcontroller or system with TTL serial. These modules can be added to security systems, door locks, time attendance systems, and much more.

Prices for this sensor greatly vary from $10 to $50. We recommend checking the Fingerprint sensor module on Maker Advisor that compares the price in different stores. The fingerprint sensor modules featured on Maker Advisor should be compatible with this guide.

Specifications

Here’s the specifications of the fingerprint sensor module we’re using (you should check your sensor datasheet or the specifications provided by your supplier – they shouldn’t be much different than these):

  • Voltage supply: DC 3.6 to 6.0V
  • Current supply: <120mA
  • Backlight color: green
  • Interface: UART
  • Bad rate: 9600
  • Safety level: five (from low to high: 1,2,3,4,5)
  • False Accept Rate (FAR): <0.001% (security level 3)
  • False Reject Rate (FRR): <1.0% (security level 3)
  • Able to store 127 different fingerprints

Sensor Pinout

The sensor has six pins that are labeled in the figure below.

The fingerprint sensor module used in this project came with really thin wires, so soldering breadboard-friendly wires was needed. We recommend using different colors according to the pin function. In our case:

  • DNC – white wires
  • VCC – red wire
  • TX – blue wire
  • RX – green wire
  • GND – black wire

The following table shows how to wire the sensor to the Arduino.

Fingerprint Sensor Arduino
VCC 5V (it also works with 3.3V)
TX RX (digital pin 2, software serial)
RX TX (digital pin 3, software serial)
GND GND

Installing the Adafruit Fingerprint Sensor Library

The easiest way to control the fingerprint sensor module with the Arduino is by using the Adafruit library for this sensor. Follow the next instructions to install the library:

  1. Click here to download the Adafruit Fingerprint Sensor library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get Adafruit-Fingerprint-Sensor-Library-master folder
  3. Rename your folder from  Adafruit-Fingerprint-Sensor-Library-master folder to  Adafruit_Fingerprint_Sensor_Library folder
  4. Move the folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Enroll a New Fingerprint

Having the fingerprint sensor module wired to the Arduino, follow the next steps to enroll a new fingerprint. Make sure you’ve installed the Adafruit Fingerprint Sensor library previously.

1. In the Arduino IDE, go to File > Examples > Adafruit Fingerprint Sensor Library > Enroll.

2. Upload the code, and open the serial monitor at a baud rate of 9600.

3. You should enter an ID for the fingerprint. As this is your first fingerprint, type 1 at the top left corner, and then, click the Send button.

4. Place your finger on the scanner and follow the instructions on the serial monitor.

You’ll be asked to place the same finger twice on the scanner. If you get the “Prints matched!” message, as shown below, your fingerprint was successfully stored. If not, repeat the process, until you succeed.

Store as many fingerprints you want using this method.

Finding a Match

You now should have several fingerprints saved on different IDs. To find a match with the fingerprint sensor, follow the next instructions.

1. In the Arduino IDE, go to File > Examples > Adafruit Fingerprint Sensor Library > Fingerprint and upload the code to your Arduino board.

2. Open the Serial Monitor at a baud rate of 9600. You should see the following message:

3. Place the finger to be identified on the scan.

4. On the serial monitor, you can see the ID that matches the fingerprint. It also shows the confidence – the higher the confidence, the similar the fingerprint is with the stored fingerprint.

Project Example – Show Fingerprint Match on OLED display

In this project example, we’ll enroll two fingerprints from two different persons. Then, we’ll display a greeting message accordingly to the match found, on an OLED display.

To learn more about the OLED display read: Guide for OLED Display with Arduino

Parts required

For this example you’ll need the following parts:

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Schematics

Here’s the wiring diagram you should follow to make the circuit for this project.

Installing the 0.96 inch OLED libraries

To control the OLED display you need the “Adafruit_GFX.h” library and “Adafruit_SSD1306.h” library. Follow the next steps to install those libraries:

Installing the Adafruit_GFX library

  1. Click here to download the Adafruit GFX library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get Adafruit-GFX-Library-master folder
  3. Rename your folder from Adafruit-GFX-Library-master to Adafruit_GFX_Library (you really need ro replace those “-” by “_”)
  4. Move the Adafruit_GFX_Library folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Installing the adafruit_SSD1306 library

  1. Click here to download the Adafruit_SSD1306 library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get Adafruit-GFX-Library-master folder
  3. Rename your folder from Adafruit_SSD1306-master to Adafruit_SSD1306
  4. Move the Adafruit_SSD1306 folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Code

Before uploading the code, you need to enroll different fingerprints from different persons. Go to “Enroll a New Fingerprint” section above, upload the given code and follow the instructions to enroll two fingerprints.

Then, modify the code so that the fingerprint IDs match the name of the persons enrolled – scroll down to page for an explanation of the code. Finally, you can upload the code provided.

/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com  
*********/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
int fingerprintID = 0;
String IDname;

void setup(){
  //Fingerprint sensor module setup
  Serial.begin(9600);
  // set the data rate for the sensor serial port
  finger.begin(57600);
  
  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } 
  else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1) { delay(1); }
  }

  //OLED display setup
  Wire.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  //displays main screen
  displayMainScreen();
}

void loop(){
  displayMainScreen();
  fingerprintID = getFingerprintIDez();
  delay(50);
  if(fingerprintID == 1 || fingerprintID == 3 || fingerprintID == 4 || fingerprintID == 5){
    IDname = "Sara";
    displayUserGreeting(IDname);            
  }  
  else if(fingerprintID == 2){
    IDname = "Rui";  
    displayUserGreeting(IDname);            
  }
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;
  
  // found a match!
  Serial.print("Found ID #"); 
  Serial.print(finger.fingerID); 
  Serial.print(" with confidence of "); 
  Serial.println(finger.confidence);
  return finger.fingerID; 
}

void displayMainScreen(){
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(7,5);
  display.println("Waiting fingerprint");
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(52,20);
  display.println("...");  
  display.display();
  delay(2000);
}

void displayUserGreeting(String Name){
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(2);
  display.setCursor(0,0);
  display.print("Hello");
  display.setCursor(0,15);
  display.print(Name); 
  display.display();
  delay(5000);
  fingerprintID = 0; 
}

View raw code

Importing libraries

The code starts by importing the needed libraries to write in the OLED display, and creates an Adafruit_SSD1306 object called display.

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

We also need to import the libraries needed for the fingerprint sensor: Adafruit_Fingerprint.h and SoftwareSerial.h.

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);

The following line sets software serial on pins 2 and 3. Pin 2 as RX, and Pin 3 as TX.

SoftwareSerial mySerial(2, 3);

Then, we create a an Adafruit_Fingerprint object called finger on the serial pins we’ve set previously.

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

The next two lines create variables to hold the fingerprint ID and the IDname.

int fingerprintID = 0;
String IDname;

setup()

In the setup(), both the fingerprint sensor and the OLED display are initialized. We also print a message on the serial monitor so that we know if the fingerprint sensor was found successfully.

void setup(){
 //Fingerprint sensor module setup
 Serial.begin(9600);
 // set the data rate for the sensor serial port
 finger.begin(57600);
 
 if (finger.verifyPassword()) {
   Serial.println("Found fingerprint sensor!");
 } 
 else {
   Serial.println("Did not find fingerprint sensor :(");
   while (1) { delay(1); }
 }

//OLED display setup
 Wire.begin();
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
 //displays main screen
 displayMainScreen();
}

loop()

In the loop(), the code displays the main screen on the OLED display – this is done in the displayMainScreen() function. Then, the code is continuously checking for incoming fingerprints. If the sensor founds a saved fingerprint, the Arduino saves the corresponding ID in the fingerprintID variable.

Then, the code has an if/else statement to check the ID the fingerprint corresponds to. You should edit the following lines of code with the corresponding IDs and names.

 if(fingerprintID == 1 || fingerprintID == 3 || fingerprintID == 4 || fingerprintID == 5){
  IDname = "Sara";
  displayUserGreeting(IDname); 
 } 
 else if(fingerprintID == 2){
  IDname = "Rui";

Sometimes, the sensor will recognize a fingerprint better if it is saved several times in different IDs. After identifying the ID name, the OLED displays a greeting – this is done in the displayUserGreeting() function,

Demonstration

Now, when a person with a saved fingerprint places the finger on the sensor, it displays a greeting message.

Wrapping Up

In this post we’ve shown you how to use the fingerprint sensor module: enroll fingerprints and find a match.

Sometimes the sensor has a hard time identifying the fingerprint if you don’t place your finger very similarly to when you’ve saved it – specially women’s fingerprints (we have no idea why this happens). We’ve noticed that the sensor works better if you place your finger slowly on the scanner.

In our opinion, the fingerprint sensor module works quite well, and it is an affordable way to add biometrics recognition to your projects.

You may also like the following projects:

Thanks for reading.


Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »

Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »


Enjoyed this project? Stay updated by subscribing our weekly newsletter!

36 thoughts on “Guide to Fingerprint Sensor Module with Arduino (FPM10A)”

    • Hi.
      Yes, you can do that.
      For that, you need to use a development board that can act as a keyboard like an Arduino Leonardo or a Teensy.
      Regards,
      Sara

      • Hi Sarah, can you pls help me convert this code into matlab simulink block.

        #include
        String value;
        int TxD = 11;
        int RxD = 10;
        int servoposition;
        SoftwareSerial bluetooth(TxD, RxD);

        void setup() {
        pinMode(2, OUTPUT);
        pinMode(3, OUTPUT);
        pinMode(4,OUTPUT);
        Serial.begin(9600); // start serial communication at 9600bps
        bluetooth.begin(9600);
        }

        void loop() {
        Serial.println(value);
        if (bluetooth.available())
        {
        value = bluetooth.readString();

        if (value == “all led turn on”){
        digitalWrite(2, HIGH);
        digitalWrite(3, HIGH);
        digitalWrite(4, HIGH);
        }

        if (value == “all led turn off”){
        digitalWrite(2, LOW);
        digitalWrite(3, LOW);
        digitalWrite(4, HIGH);
        }

        if (value == “turn on red led”){
        digitalWrite(2, HIGH);
        }

        if (value == “turn on the fan”){
        digitalWrite(3, HIGH);
        }

        if (value == “turn off red led”){
        digitalWrite(2, LOW);
        }
        if (value == “turn on blue led”){
        digitalWrite(4, HIGH);
        }
        if (value == “turn off red led”){
        digitalWrite(4, LOW);
        }

        if (value == “turn off the fan”){
        digitalWrite(3, LOW);
        }

        }

        }

  1. Thanks for this tutorial.
    Actually this doesn’t works for me.
    Even the SFG demo program doesn’t work.
    My sensor is not responding to the commands sent by Arduino.
    Plus when i power up the sensor I didn’t see any led blinking, does this means that my sensor is faulty??
    I assume that whenever the power js supplied the red led will blink, but u haven’t seen that for a single time.

  2. hi, my name is peter
    I am a hobbysta of the arduino
    I wanted to make a project using the print finger sensor
    I bought one that matches his showing in the tutorial
    I also followed the link the library but nothing
    the light does not turn on in the reader
    the light is activated as soon as it is true tension
    I also respected the order of the cables but nothing
    DY50 reader model
    I ask the courtesy if you could help me thank you in advance

    • Hello Pietro, it sounds like your fingerprint sensor might be broken or defective. The first module that I’ve ordered was broken and it also didn’t light up…
      Regards,
      Rui

    • Hi Jane,
      The original Adafruit Code and sub libraries are defined for “uint8_t” that means “up to 255 fingerprints. If the files are modified as below, it will handle the fingerprints up to 0x03E8” (1000 fingerprints). But keep in mind that if the sensor can’t handle that more, the code returned after calling STORE will be “0bH – addressing PageID is beyond the finger library”. If it’s triggered you can modify the max values accordingly :

      1. In “AdaFruit_FingerPrint.cpp”, modify the following line as below:
      GET_CMD_PACKET(FINGERPRINT_HISPEEDSEARCH, 0x01, 0x00, 0x00, 0x03, 0xE7);
      //The last 2 bytes defines the Page Number which is used for the maximum fingerprints the sensor can store.

      2. In “Enroll.ino” covered in the examples, modify the following lines to store “uint16_t” type as Word:

      uint16_t readnumber(void) {
      uint16_t num = 0;
      //The original data type is uint_8 which can only store 0-255. However, you would like to handle the fingerprints up to 1000 or 0xFFFF.

      If you have any further questions, feel free to e-mail me.

    • To be able to determine how many fingerprints the sensor can handle, you can modify the files as below. I hope you know how to add a procedure to a file. Because below changes don’t define the relevant changes that need to be done in the whole library :
      1. Adafruit_Fingerprint.cpp – add the following Procedure:

      uint8_t Adafruit_Fingerprint::getMaxPageNumber(void) {
      GET_CMD_PACKET(FINGERPRINT_MAXPAGENUMBER);
      maxPageNumber = packet.data[5];
      maxPageNumber <
      //Build BA – Modified
      Serial.print(“Please type in the ID # (from 1 to “); Serial.print(finger.maxPageNumber); Serial.println(“) you want to save this finger as…”);
      //->

      • Some parts of my comment are removed somehow?

        Here is the all changes:
        1. Adafruit_Fingerprint.cpp – add the following Procedure:
        //Build BA – Added to get maximum Page Number that the sensor can store (Finger Library Size)
        uint8_t Adafruit_Fingerprint::getMaxPageNumber(void) {
        GET_CMD_PACKET(FINGERPRINT_MAXPAGENUMBER);
        maxPageNumber = packet.data[5];
        maxPageNumber <
        //Build BA – Modified
        Serial.print(“Please type in the ID # (from 1 to “);Serial.print(finger.maxPageNumber);Serial.println(“) you want to save this finger as…”);
        //->

    • Sure. But as Santos mentioned by using default library, you can only store it in Flash memory.
      However, if DownChar/UpChar commands are used, the templates in Sensor Buffers (CharBuffer1 or CharBuffer2) can be downloaded/uploaded to an external computer. And those templates can be utilized to be transfered to the other sensors connected to the other arduinos.
      This method can handle the process for an environment using multiple fingerprint sensors in different locations, and the data upload/download can be done over network using a ethernet module.

      If you need the code, i can send it after i develop and test it.
      Regards,

      • Hi. I am very interested in that modification to save the data in a memory other than the internal one to display it in several arduino. Could you indicate how to do it ?. Thank you

  3. Thank you for this awesome tutorial, however I don’t understand this part of the sketch :
    SoftwareSerial mySerial(2, 3); // don’t understand this
    Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial); // don’t understand this

    what does it mean ?

    • Hi.
      The SoftwareSerial library allows serial communication on other digital pins of the Arduino (the default pins are 0 and 1). That first line creates a SoftwareSerial object called mySerial that will create an RX pin on Pin 2, and a TX Pin on Pin 3. Basically, that means that Pin 2 and Pin 3 will be able to communicate via serial.
      The next line creates an Adafruit_Fringerprint object called finger that contains properties and methods to handle the fingerprint sensor. The “&mySerial” means that you want to instantiate your fingerprint sensor on the software serial pins you’ve defined earlier.
      I hope this helps.
      Regards,
      Sara 🙂

  4. Hi, thanks for your response.

    So basically this code is useful when we set up the fingerprint sensor, if I understand well.
    So it is not like the sketch to run when the arduino is already set up and disconnected from the laptop, is it ?

    • Partially true. The code has a portion using Serial communication to connect to the computer and get the commands (Id, delete, etc.). Additionally the responses are visible to the user over this serial connection.
      If you like to use it offline (without Computer), you can add the keypad and LCD screen modules to the project.

      Kind Regards,
      BA

  5. For my sensor, it comes with a red six wire connector, but it is too thin to be connected, is there any converter I can buy to connect from this small conector to a much big connector, then I can wire it to Arduino board. Thanks.

    • Hi David.
      Our fingerprint sensor was the same.
      A very thin connector that can’t fit anywhere. We’ve just cut the connector and solder breadboard friendly wires.
      I don’t know any connector to convert to a bigger connector.
      If you find a solution just let us know.
      Regards,
      Sara 🙂

  6. I bought a fingerprint sensor (BIOSEC OK300). When powered, LED blinks once (Not from the sensor side, in the connector side). Doesn’t work with the enrollment example. It displays like “Did not find fingerprint sensor :(” . How to test this sensor?

    Does this BIOSEC OK300 compatible with Adafruit-fingerprint-Sensor-Library?

    Please help me on this.

Leave a Comment

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.