@tutorial: Fingerprint sensor door lock and blackbox

Last year I’ve made two door lock projects. One was the keypad project and the second one was an RFID door lock project each with a 3D printed case and a servo to open the door. Today I have a new one and probably the last door lock project on this channel.

External Link: https://electronoobs.com/eng_arduino_tut41.php

by: ELECTRONOOBS on 2026-09-03

Check the keypad project as well! This is a fingerprint door lock with a black box integrated. So, why is this better than the other two projects? Well, first you don’t need to carry any key or card with you since you always have your fingerprint. So that’s more convenient. It is also faster to use than typing the code of the keypad door lock. Just place the finger and open the door. Also, it is almost impossible to trick this door lock since a fingerprint is difficult to copy so with a metal case instead of plastic, this would be a very secure door lock. It also has a black-box with SD card and real time clock so we could see the log line by line with everything that happened with the door.

~Part List

1 x Arduino MEGA: LINK eBay

1 x RTC module: LINK eBay

1 x SD card module: LINK eBay

1 x Fingerprint sensor: LINK eBay

1 x i2c LCD: LINK eBay

1 x 9g servo: LINK eBay

3 x push button: LINK eBay

1 x 3D printed case: LINK eBay

Wires LINK eBay


Wire, soldering iron, solder, etc...


A fresh door lock prototype featuring a 3D?printed housing, servo mechanism and integrated RFID reader.
A fresh door lock prototype featuring a 3D?printed housing, servo mechanism and integrated RFID reader.
~PART 1 - The fingerprint sensor

Add fingerprint to database

First we need to see how to use the fingerprint sensor by itself. Then we will create the rest of the project. When you receive the fingerprint module, it has no fingerprints stored to its memory so first we have to add our data. Connect it like below (left) to and Arduino UNO, or like (right) to and Arduino MEGA. Not all pins are good for this since not all pins could create interrupt for the RX pin so follow the schematic below. For this example, we will use the serial monitor to save our fingerprint to the sensor database. Upload the example code below called, fingerprint scan example.


door lock arduino schematic fingerint sensor
door lock arduino schematic fingerint sensor

Make sure you install the adafruit fingerprint library that you could also find below. Upload this example code to the Arduino and open serial monitor and select the 9600 baud rate. Now sent the ID number where you want to store the new fingerprint. I send 1 since I want to save my first print to the ID 1 which will be the main user. Type 1 and press enter and follow the instructions. Scan the finger once, remove it and scan it once again and the new data is stored. Now my finger is on the database.

A newly designed door lock featuring a 3D-printed housing and servo mechanism for automatic opening.
A newly designed door lock featuring a 3D-printed housing and servo mechanism for automatic opening.
~Read fingerprint from database

Now, you have another small example code that will detect the scanned fingerprint. With the same schematic before, upload the scan fingerprint example code you can find below. Open the serial monitor and place your finger on to the sensor. There you have it. ID1 was detected, which is the ID for the finger scaned before. With these two codes you now know how to store and read data from the sensor. Read the comments in the code for more.

A fresh door lock prototype with a 3D?printed case and servo actuator, after earlier keypad and RFID designs.
A fresh door lock prototype with a 3D?printed case and servo actuator, after earlier keypad and RFID designs.
~PART 2 - The real time clock RTC

Now, let’s configure the real time clock. This module has its own battery so even when the Arduino is not powered, it will still keep the real time for more than a year. But first, we have to tell it the real time. Connect it below this to the Arduinos i2c port. Now open the set time example code from below and make sure you install the DS32 31 library you will also find below.

A fresh DIY door lock with 3D?printed housing and servo motor, concluding the channel’s lock series.
A fresh DIY door lock with 3D?printed housing and servo motor, concluding the channel’s lock series.

Here in the code above, uncomment the 3 lines in the setup loop and add the exact date and time. Add the day, month, year and then the hour, minute and seconds and upload the code. Then comment back the lines and upload the code once again. Open serial monitor, and there you have it, this is the real time you get from the sensor and all you have to do is to use the get time and get date functions of the DS32 31 library. So, now we know how to use the RTL module as well.



A 3D?printed enclosure houses a servo?driven door lock, combining keypad and RFID control in a new project.
A 3D?printed enclosure houses a servo?driven door lock, combining keypad and RFID control in a new project.

We already seen how the SD card module works in the 3D scanner tutorial. Check that video for more details. You need to install the SD library you will find below as well. Using the SD open and SD print function we can write data to the SD card in an txt format.


~PART 3 - Final schematic

That’s it. Now the final code is quite long. I’ve placed comments to help you understand it. The main idea goes like this. The buttons will activate the loops for scanning, adding new user or close the door. After each loop, there is an SD card log print and in each SD print, we read the real time. Mount the enxt schematic below and then upload the final code and gieve it a test.

A fresh DIY door lock featuring a 3D?printed housing and servo motor for automated opening.
A fresh DIY door lock featuring a 3D?printed housing and servo motor for automated opening.
~Final Code

Below the void loop, we have two functions. One is to scan the finger and the other is to add new user to the database. In the bit of code below you can change which ID is the main user, in my case is ID 1 and only this ID can add new users. Also, there is the maximum and minimum angle of the servo motor for open and close the door. Change these values in case you need others angle. That’s it, upload this code to the Arduino mega and make sure you have this schematic for the final project.


Now we have the final schematic and code. All we need is the 3D printed case that you could downlaod froma link below and 3D print it. Fit the LCD in place and the Arduino MEGA using m3 screws. Then using wires we make all the connections and our door lock is ready. There is space for 3 push buttons as well.


Download: Front part
door lock STL free download case
door lock STL free download case

Now the case and project is ready. I hope that you've enjoyed the tutorial and that you have learned something new. Now you know how to use the fingerprint sensor, RTC module and the SD card module and create a black box door lock with fingerprint security. Consider helping me on PATREON.

~Video Tutorial

Leave a comment

Please login in order to comment.

Comments

ADVERTISERS
ADVERTISERS
PCBWAY