How to make a fingerprint scanner using Arduino UNO
How to make a fingerprint scanner using Arduino UNO
Although you can use passwords and keys to access security systems, both methods are inconvenient and easy to forget. In this article, we will mainly learn how to use the FPM10A with the Adafruit Arduino library to make a biometric fingerprint system.
Required Components
● FPM10A fingerprint module
● Arduino Uno development board
● Arduino IDE
Installing and using the library
The first step in using the FPM10A is to install the Adafruit Fingerprint Library, which can be done using the Library Manager. Open the Arduino IDE and navigate to Sketch > Include Library > Manage Libraries .
When the Library Manager loads the search results for “Fingerprint”, the first result should be Adafruit Fingerprint Sensor Library. Install that library.
Once the library is installed, it’s time to create a new Arduino project. Click File > New and save the project in its own folder. At this point, open the project folder and copy the “fingerprint.h” file into it.
This is a special header file I wrote to make the fingerprint library easier to use. The header file has only three functions:
● fingerprint_setup() – configures the serial port to 9600 baud and connects to the module
● readFingerprint() – a polling function that returns -1 if any invalid events occur, or something else if a successful print is found
● enrollFingerprint(int id) – adds the fingerprint with ID “id” to the system.
To include this file in your project, simply use the include command as follows:
The first function you need to call in the setup() function is fingerprint_setup(), which automatically connects to the module and confirms that everything is working correctly.
To add a new fingerprint, call the enrollFingerprint(id) function. The function returns -1 if an error occurs, but other values indicate successful fingerprint enrollment. The ID passed to this function is a link to the scanned fingerprint, and each fingerprint has a unique ID number.
Making and using a fingerprint scanner
Since it uses the serial port for communication, it is very easy to get this module working. However, since the Arduino Uno has only one hardware serial port, you will need to use the software serial port to communicate with the fingerprint module using pins 2 and 3 (the hardware serial port is reserved for PC communication).
The ribbon cable that comes with the FPM10A module is not suitable for hobbyists as it comes in a 1.27mm pitch package, so I cut one side off and exposed the wires to connect to the jumper wires.
When you launch this project it will first ask you to place your finger on the scanner. If the scanner is able to read your fingerprint it will ask you to remove and then replace the finger on the scanner. This will cause the scanner to successfully add your fingerprint to ID 1 and leaving your finger on the scanner will cause the system to grant access.
The project can be easily expanded to include electromagnetic locks and relays that only allow authorized users to make changes and unlock the system. When you’re ready, install your new scanner to doors, cabinets, safes, windows, electrical systems, computers, and more!
The complete code for this project is as follows: