Thursday, March 28, 2024

Arduino Projects: Fingerprint Door Unlock System

By DINU D. AND CINLA K. PAPPACHAN

This simple fingerprint door unlock project using Arduino can be very useful for door security, forensics, crime investigation, personal identification, attendance system and much more. In the future, there could be many more applications like fingerprint based driving licences, bank accounts operation and so on.

The whole system works under a simple algorithm called matching algorithm, which is used to compare previously-stored templates of fingerprints against users’ fingerprints for authentication purposes.

A key is normally used for traditional door opening, but it provides very poor security. In this fingerprint door unlock project, only when an authorized person places a finger on the sensor, the door unlocks and the LCD displays a welcome message along with that person’s name.

Circuit and working

The circuit shown in Fig. 1 operates using a 12V power supply. An Arduino microcontroller (MCU) requires only 5V but the solenoid electric lock requires 12V. As Arduino Uno has an inbuilt 5V voltage regulator, a common 12V supply can be used for the whole system.

Fig 1Fig. 1: Circuit diagram of the fingerprint door unlock system
Fig. 1: Circuit diagram of the fingerprint door unlock system

The brain of the circuit is Arduino Uno MCU board (BOARD1). It is based on ATmega328/ATmega328P and has 14 digital input/output (I/O) pins, six analogue inputs, 32k flash memory, 16MHz crystal oscillator, a USB connection, power jack, ICSP header and reset button, among others. It can be programmed using Arduino IDE software.

- Advertisement -

Test Points TableFingerprint sensor module R305 (connected across CON2) has UART interface with direct connections to the MCU or to the PC through max232/USB serial adaptor. The user can store fingerprint data in the module and configure it in 1:1 or 1:N mode for identification. Pins TX and RX of R305 sensor are connected to Arduino digital pins 2 and 3, which are used for serial communication.

Parts List tableThe LCD display (LCD1) is used to display messages during action. Here, a 16×2 display is used; each character is made of 5×7 dot-matrix. Pins 3, 4, 5 and 6 of the LCD are the control lines connected to preset (PR1) output, pin 12 (Arduino), GND and pin 11 (Arduino). Pins 11, 12, 13 and 14 are data pins of the LCD that are connected to pins 7, 6, 5 and 4 of Arduino, respectively. Preset PR1 is used to adjust the contrast of the LCD display.

An electronic door-lock solenoid (connected across connector CON3) is basically an electromagnet made of a big coil of copper wire with an armature (slug of metal) in the middle. When the coil is energised, the slug is pulled into the centre of the coil. This allows the solenoid to move to one end.

- Advertisement -
Fig 2Fig. 2: Initial state
Fig. 2: Initial state
Fig 3Fig. 3: Valid finger
Fig. 3: Valid finger
Fig 4
Fig. 4: Invalid finger

The solenoid lock requires more current than what Arduino can provide. Therefore to operate the lock, a 5V relay (RL1) is used. CON3 is connected between normally open (N/O) contacts of RL1 and GND. The sequence of messages on the LCD from author’s prototype are shown in Figs 2, 3 and 4.

Software

Programs named enroll and fingerprint use different functions like getFingerprintEnroll(int,id), Adafruit_Fingerprint(&mySerial) and getFingerprintEnroll(id). These functions are defined inside the library and pass arguments when called.

After uploading enroll in the Arduino, open serial monitor from Arduino IDE from Tools→Serial monitor options. Change baud rate below the serial monitor window to 38400. Choose Newline option from the same place. Then, follow the instructions on the serial monitor. Place the finger on the fingerprint module. Type any whole number as the ID number. Press Send tab to send the ID number from the serial monitor to Arduino. This fingerprint gets converted into digital data and gets store inside R305 module database.

More than 200 fingerprints can be stored on this system. Make sure that each fingerprint has a unique ID number. This ID number will be used in the next program to identify the authenticated person’s name. The serial monitor will guide the user as to when he or she should place the finger and when to remove it.

For debugging without an LCD display, make the same settings for the serial monitor after uploading Fingerprint program. This is used to compare the fingerprint in the sensor with stored prints. The serial monitor guides here also. The fingerprint program should be edited to change the name and ID numbers according to how users want.

Download source code: click here

Construction and testing

The single-side PCB for the fingerprint door unlock system is shown in Fig. 5 and it’s component layout in Fig. 6. For convenience, we have designed the PCB as an Arduino shield. The users can modify the design as per requirement. Also, they can test PCB with Arduino board using a cable connector.

Fig 5Fig. 5: Actual-size PCB pattern of the fingerprint door unlock system
Fig. 5: PCB pattern of the fingerprint door unlock system
Fig 6Fig. 6: Component layout of the PCB
Fig. 6: Component layout of the PCB

Download PCB and component layout PDFs: click here

Make sure the baud rate given in the program is correct. Baud rate for the serial monitor can be anything but the baud rate for R305 sensor should match that given in its datasheet. Baud rate may vary with different versions of the sensor. It is given in the program like Serial.begin(38400) [baud rate for serial monitor]; finger.begin(57600) [baud rate for sensor]. Reset Arduino board before validation of the fingerprint.


Dinu D. and Cinla K. Pappachan are fourth-year BE (ECE) students at Mar Ephraem College of Engineering and Technology, Tamil Nadu. They are also electronics hobbyists

This article was first published on 10 September 2019 and was updated on 28 May 2019.

83 COMMENTS

  1. If I am using another finger print module and using keypad 4*4 than what is my circuit diagram and please send me this type of circuit code we are using arduino.
    Please sir reply fast and send me a code or circuit diagram.

  2. I’ve a lot doubts and problems regarding this project to be solved , starting with
    1). I uploaded the program to the board but I found nothing in the LCD display,just a blank lit up screen
    2). As soon as I connect the relay to the circuit , especially when I try to connect the N/C pin to the 12V supply line the circuit just starts blinking,the leds on the screen, r305 and arduino board starts to blink instead of being steady
    so if anyone knows the solution, pls post it fast ,I have just 3 days to submit this

  3. And I also forget to add that , the test point ,what should I connect with it, as far as I’ve searched, I’ve learnt that it is not necessarily needed so I ignored it
    If I am wrong ,pls help me with the soln

  4. i am having problem with the code. its showing error. how can i debug it please. below is the error message;
    fatal error: Adafruit_Fingerprint.h: no such directory
    #include
    compilation terminated.
    exit status 1
    error compiling for board Arduino/Genuino uno.

    • We have used an Elock-S210M electric strike. It is a stainless-steel, fail-secure type electric lock with dimensions of 150x39x31 mm3. Applying electric current to the strike causes it to unlock. Its operating voltage and current are 12V DC and 450mA, respectively.

  5. hi team,
    kindly help me for this error

    Arduino: 1.8.5 (Windows 8), Board: “Arduino/Genuino Uno”

    H:\finger\Fingerprint_door_unlock_Arduino\enroll\enroll.ino:1:34: fatal error: Adafruit_Fingerprint.h: No such file or directory

    #include

    ^

    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

  6. Can’t upload programs enroll and fingerprint to Arduino Uno board.
    Error message shown is:
    Arduino: 1.8.5 (Windows 10), Board: “Arduino/Genuino Uno”

    C:\Users\RUTVIJ~1\AppData\Local\Temp\ccvVHvUp.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0′:

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:27: undefined reference to `Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial*)’

    C:\Users\RUTVIJ~1\AppData\Local\Temp\ccvVHvUp.ltrans0.ltrans.o: In function `setup’:

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:35: undefined reference to `Adafruit_Fingerprint::begin(unsigned int)’

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:37: undefined reference to `Adafruit_Fingerprint::verifyPassword()’

    C:\Users\RUTVIJ~1\AppData\Local\Temp\ccvVHvUp.ltrans0.ltrans.o: In function `getFingerprintEnroll’:

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:66: undefined reference to `Adafruit_Fingerprint::getImage()’

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:88: undefined reference to `Adafruit_Fingerprint::image2Tz(unsigned char)’

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:114: undefined reference to `Adafruit_Fingerprint::getImage()’

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:120: undefined reference to `Adafruit_Fingerprint::getImage()’

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:142: undefined reference to `Adafruit_Fingerprint::image2Tz(unsigned char)’

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:166: undefined reference to `Adafruit_Fingerprint::createModel()’

    C:\Users\Rutvij Shah\Desktop\Fingerprint_door_unlock_Arduino\enroll/enroll.ino:181: undefined reference to `Adafruit_Fingerprint::storeModel(unsigned int)’

    collect2.exe: error: ld returned 1 exit status

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

  7. Hello! I have a question … Can u please help me. After the fingerprint is placed on the scanner and it is matched with the database… The door will get open . Bt what if i want to open the door from inside?? We cant use a simple locking mechanism from inside coz if we do so there will be no use of this system the security will get compromised ….
    So what can we do for it??
    Expecting reply as soon as possible.

SHARE YOUR THOUGHTS & COMMENTS

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators

×