This project mainly introduces how to use the fingerprint sensor module step by step on the Arduino UNO board.

Introduction

By using the adafruit fingerprint sensor module shown in the figure below, you can make fingerprint recognition easier to implement and easy to add to your project. So that fingerprint collection, registration, comparison and search are very easy to implement.

This module has FLASH memory for storing fingerprints, and can be used with any microcontroller or system with a TTL serial interface, and can be added to security systems, door locks, time and attendance systems, and so on.

Project Parameters

The following are the specifications of the fingerprint sensor module ( check the sensor data sheet or specification provided by the supplier):

Power supply: DC 3.6V~ 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 has wires of the same color, so it is necessary to solder wires that are easy to distinguish. We recommend using different colors according to the pin function. As shown in the following example:

DNC-White wire

VCC-Red wire

TX-Blue wire

RX-Green wire

GND-Black wire

Connect the Sensor to Arduino UNO

|Fingerprint Sensor|Arduino

|VCC|5V (it also applies to 3.3V)

|TX|RX (digital pin 2, serial)

|RX|TX (digital pin 3, serial)

|GND|GND

Install the Adafruit Fingerprint Sensor Library

The easiest way to control the fingerprint sensor module with Arduino is to use the sensor's Adafruit library. Follow the instructions below to install the library:

1. Download the Adafruit fingerprint sensor library.

2. Unzip the file, you will see an Adafruit-Fingerprint-Sensor-Library-master.

3. Rename the folder to Adafruit_Fingerprint_Sensor_Library.

4. Move the folder to your Arduino IDE installation library folder.

5. Finally, reopen the Arduino IDE.

Adafruit Fingerprint Sensor Enrollment

Connect the fingerprint sensor module to the Arduino, please follow the steps below to enroll a new fingerprint. Make sure you have installed the Adafruit fingerprint sensor library before.

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

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

3. Enter the fingerprint ID. Since this is your first fingerprint, please enter 1 in the upper left corner and click “Send”.

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

You will be asked to put the same finger on the scanner repeatedly until you receive "Prints matched!

Use this method to store the fingerprint you want.

Adafruit Finger Detect Test

After several operations, you should now have several fingerprints with different IDs. To find the fingerprint that matches the sensor, just follow the instructions below.

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

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

3. Place the finger to be recognized in the scanner.

4. On the serial monitor, you can see the ID that matches the fingerprint. At the same time, it also shows the confidence value. The higher the confidence value, the more similar the fingerprint is to the stored fingerprint.

Fingerprint Display in OLED

In the example of this project, we will register two fingerprints from two people. Then, we will display the corresponding matching greeting message on the OLED display.

Materials

Arduino UNO

Fingerprint sensor module

0.96-inch OLED display

Breadboard

Cables

Project Schematic

Below is the wiring diagram of the circuit made by this project.

Install 0.96 Inch OLED Library

To control the OLED display, you need to use Adafruit_GFX.h library and Adafruit_SSD1306.h library.

Install Adafruit_GFX Library

1. Download the Adafruit GFX library.

2. Unzip the file, you will see an Adafruit-GFX-Library-master

3. Rename it to Adafruit_GFX_Library

4. Move the Adafruit_GFX_Library folder to the Arduino IDE installation library folder.

5. Finally, reopen your Arduino IDE.

Install Adafruit_SSD1306 Library

1. Download the Adafruit_SSD1306 library. After it, you will get a .zip file.

2. Unzip the .zip file, you will see an 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 so that the fingerprint ID is consistent with the name of the registered person. Finally, you can upload the provided code.

Import Library

The code first imports the required libraries to write to the OLED display, and then creates an Adafruit_SSD1306 object named 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 library required by the fingerprint sensor: Adafruit_Fingerprint.h and SoftwareSerial.h

#include <Adafruit_Fingerprint.h>

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);

The following line sets the serial interface on pins 2 and 3. Pin 2 is RX, and pin 3 is TX.

SoftwareSerial mySerial(2, 3);

Then, we create an Adafruit_Fingerprint named finger on the serial pin we set up earlier.

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

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

int fingerprintID = 0;

String IDname;

setup() Function

In setup(), both the fingerprint sensor and the OLED display are initialized. We can print a message on the serial monitor so that we know whether 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();

}

Loop() Function

In loop(), the code displays the main screen on the OLED display, which is done in the displayMainScreen() function. Then, the code continuously checks the input fingerprint. If the sensor finds the saved 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 lines of code with the corresponding ID and name.

if(fingerprintID == 1 || fingerprintID == 3 || fingerprintID == 4 || fingerprintID == 5){

IDname = "Sara";

displayUserGreeting(IDname);

}

else if(fingerprintID == 2){

IDname = "Rui";

If the sensor is saved multiple times with different IDs, the sensor will recognize fingerprints better. After recognizing the ID name, the OLED will display a greeting-message in the displayUserGreeting() function.

Program Display

Now, when the person who saved the fingerprint ID puts the finger on the sensor, it will display a greeting message.

Summery

In this project, we show you how to use the fingerprint sensor module: enroll fingerprints and find matching fingerprints ID.

Sometimes, if your fingers are not placed correctly as they were saved, especially female fingerprints, the sensor can hardly recognize it. And we noticed that if you place your finger slowly on the scanner, the sensor will work better.

Recommended Reading: Intelligent Sensor and Its Applications

Section Header

Explain each section of your project

catalog.jpg
        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(); 
}
    
Arduino Fingerprint Sensor.jpg
Dan Cox
An electonic amateur in Hongkong.