This article mainly introduces how to use the fingerprint sensor module FPM10A on the Arduino development board. We will show you how to register a new fingerprint ID and how to find a matching fingerprint.
Introduction to Fingerprint Sensor Module
By using the fingerprint sensor module shown in the figure below, fingerprint recognition can be made easier to implement and easy to add to your project. This means that fingerprint acquisition, registration, comparison, and search are very easy to achieve.
These modules come with FLASH memory for storing fingerprints and can be used with any microcontroller or system with a TTL serial interface. These modules can be added to security systems, door locks, attendance systems, and more.
Product Specifications
The following are the specifications of the fingerprint sensor module we used (you should check the sensor datasheet or specifications provided by the vendor – their parameters should not differ too much):
● Operating voltage: DC 3.6 to 6.0V
● Current: <120mA
● Backlight color: green
● Interface: UART
● Baud rate: 9600
● Security level: five levels (from low to high: 1, 2, 3, 4, 5)
● False Acceptance Rate (FAR): <0.001% (security level 3)
● False Rejection Rate (FRR): <1.0% (security level 3)
● Able to store 127 different fingerprints
Sensor Module Pins
The sensor module has six pins, as shown in the figure below.
The fingerprint sensor module used in this project comes with wires of the same color, so it is necessary to solder easily distinguishable wires. We recommend using different colors based on pin functions. In our example:
● DNC – white wire
● VCC – red wire
● TX – blue wire
● RX – green wire
● GND – black wire
The table below shows how the sensor connects to the Arduino.
Fingerprint Sensor |
Arduino |
VCC |
5V (also suitable for 3.3V) |
TX |
RX (digital pin 2, serial) |
RX |
TX (digital pin 3, serial) |
GND |
GND |
Installing the Adafruit Fingerprint Sensor Library
The easiest way to control the fingerprint sensor module with Arduino is to use the Adafruit library for this sensor. Follow the instructions below to install the library:
1. First download the Adafruit fingerprint sensor library. After downloading, you will get a .zip file;
2. Unzip the .zip file, and you will see a Adafruit-Fingerprint-Sensor-Library-master folder;
3. Rename the Adafruit-Fingerprint-Sensor-Library-master folder to Adafruit_Fingerprint_Sensor_Library;
4. Move the folder to your Arduino IDE installation library folder;
5. Finally, reopen the Arduino IDE.
Register a New Fingerprint
Connect the fingerprint sensor module to the Arduino, and follow the steps below to register a new fingerprint. Make sure you have 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 to the Arduino board and open the serial monitor at a baud rate of 9600.
3. At this point, you should enter the ID of the fingerprint. Since this is your first fingerprint, enter 1 in the upper left corner, and then click the Send button.
4. Place your finger on the scanner and follow the instructions on the serial monitor.
The system will ask you to place the same finger on the scanner twice. If you receive the message “Prints matched!” as shown below, your fingerprint has been successfully stored. If not, repeat this process until you succeed.
Use this method to store the fingerprints you want.
Finding a Matching Fingerprint
You should now have several fingerprints saved with different IDs. To find a fingerprint that matches the fingerprint sensor, follow the instructions below.
1. In the Arduino IDE, go to File > Examples > Adafruit Fingerprint Sensor Library > Fingerprint, and then upload the code to the Arduino board.
2. Open the serial monitor at a baud rate of 9600. You should see the following message:
3. Place the finger you want to identify on the scanner.
4. On the serial monitor, you can see the ID that matches the fingerprint. It also shows the confidence value – the higher the confidence value, the more similar the fingerprint is to the stored fingerprint.
Project Example – Display Matching Fingerprint on OLED Screen
In this project example, we will register two fingerprints from two different people. Then, we will display the corresponding matching greeting message on the OLED screen.
Required Components
For this example, you need the following parts:
● Arduino UNO development board
● Fingerprint sensor module
● 0.96-inch OLED display
● Breadboard
● Jumper wires
Schematic Diagram
Below is the wiring diagram for making the circuit for this project.
Installing the 0.96-inch OLED Library
To control the OLED display, you need to use the “Adafruit_GFX.h” library and the “Adafruit_SSD1306.h” library. Follow the steps below to install these libraries:
Installing the Adafruit_GFX Library
1. Click here to download the Adafruit GFX library. After downloading, you will get a .zip file;
2. Unzip this .zip file, and you will see a Adafruit-GFX-Library-master folder;
3. Rename the Adafruit-GFX-Library-master folder to Adafruit_GFX_Library (make sure to replace those “-” with “_”);
4. Move the Adafruit_GFX_Library folder to the Arduino IDE installation library folder;
5. Finally, reopen your Arduino IDE.
Installing the Adafruit_SSD1306 Library
1. Click here to download the Adafruit_SSD1306 library. After downloading, you will get a .zip file;
2. Unzip this .zip file, and you will see a Adafruit_SSD1306-master folder;
3. Rename the Adafruit_SSD1306-master folder to Adafruit_SSD1306;
4. Move the Adafruit_SSD1306 folder to the Arduino IDE installation library folder;
5. Finally, reopen your Arduino IDE.
Code
Before uploading the code, you need to register different fingerprints from different people. Go to the “Register a New Fingerprint” section above, upload the given code and follow the instructions to register two fingerprints. Then, modify the code to match the fingerprint IDs with the names of the registrants. Finally, you can upload the provided code.
Importing Libraries
The code first imports the required libraries to write to the OLED display, then creates an object called display of type Adafruit_SSD1306.
-
#include <Wire.h>
-
#include <Adafruit_GFX.h>
-
#include <Adafruit_SSD1306.h>
-
#define OLED_RESET 4
-
Adafruit_SSD1306 display(OLED_RESET);
Copy code
We also need to import the libraries required for the fingerprint sensor: Adafruit_Fingerprint.h and SoftwareSerial.h.
-
#include <Adafruit_Fingerprint.h>
-
#include <SoftwareSerial.h>
-
SoftwareSerial mySerial(2, 3);
Copy code
The following line sets up the serial interface on pins 2 and 3. Pin 2 is RX, and pin 3 is TX.
-
SoftwareSerial mySerial(2, 3);
Copy code
Then, we create an object called finger of type Adafruit_Fingerprint on the previously set serial pins.
-
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
Copy code
The next two lines create variables to hold the fingerprint ID and ID name.
-
int fingerprintID = 0;
-
String IDname;
Copy code
setup() Function
In the setup(), both the fingerprint sensor and OLED display are initialized. We also print a message to the serial monitor so that we know if the fingerprint sensor was successfully found.
-
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();
-
}
Copy code
loop() Function
In the loop(), the code displays the main screen on the OLED display – this is done in the displayMainScreen() function. Then, the code continuously checks for incoming fingerprints. If the sensor finds a stored fingerprint, the Arduino saves the corresponding ID in the fingerprintID variable.
Then, the code has an if/else statement to check the ID corresponding to the fingerprint. You should edit the following line of code with the appropriate ID and name.
-
if(fingerprintID == 1 || fingerprintID == 3 || fingerprintID == 4 || fingerprintID == 5){
-
IDname = “Sara”;
-
displayUserGreeting(IDname);
-
}
-
else if(fingerprintID == 2){
-
IDname = “Rui”;
Copy code
Sometimes, if the sensor saves multiple times with different IDs, the sensor may better recognize the fingerprint. After identifying the ID name, the OLED will display a greeting – this is done in the displayUserGreeting() function.
Demo Program
Now, when the person whose fingerprint is saved places their finger on the sensor, it will display a greeting message.
Conclusion
In this article, we showed you how to use the fingerprint sensor module: register fingerprints and find matching fingerprints.
Sometimes, if your finger is not placed the same way it was saved, especially for female fingerprints (we do not know why this happens), the sensor may have difficulty recognizing the fingerprint. We noticed that if you place your finger slowly on the scanner, the sensor performs better.
In our opinion, the fingerprint sensor module works very well, and it is the most cost-effective way to add biometric recognition to your projects. If you encounter any problems, please feel free to leave a message below this article.
For more exciting tutorials about Arduino development boards, please click “Read the original“.
Leave a Comment
Your email address will not be published. Required fields are marked *