Build a Fingerprint-Scanner Door Lock with Arduino

Sharing is caring!

Build a Fingerprint-Scanner Door Lock with Arduino

Free Daily Electronics Newsletter

Tutorials, news, and one component explained simply — every day.

Subscription Form

Difficulty: Beginner — Ever wished you could unlock your door like a spy in a movie? No keys to lose, no codes to remember — just press your finger and you’re in. The best part? You can build this with an Arduino, a fingerprint sensor, and a servo motor for under $30.

How Fingerprint Sensors Actually Work

The Adafruit fingerprint sensor (or similar optical models) works by shining an LED onto your finger and capturing the reflected image with a tiny camera. An onboard processor analyzes the ridges and valleys of your fingerprint, converts them into a mathematical template, and stores it in flash memory. It can hold up to 127 different fingerprints.

When you place your finger on the sensor, it captures a new image, generates a template, and compares it against all stored templates. If it finds a match, it returns the matching ID. If not, it returns an error. The entire process takes less than a second.

The sensor communicates with the Arduino via UART (serial) — just two wires for data plus power and ground.

What You’ll Need

  • Arduino Uno R3 — the controller
  • Adafruit Fingerprint Sensor — the biometric reader (connects via UART)
  • SG90 Servo Motor — physically moves the lock mechanism
  • Breadboard and jumper wires — for prototyping
  • USB cable — for programming and initial power

Wiring It Up

The wiring is straightforward. The fingerprint sensor has four pins:

Fingerprint door lock wiring diagram: Arduino, fingerprint sensor, and servo motor connections
Fingerprint door lock wiring diagram: Arduino, fingerprint sensor, and servo motor connections
  • VCC → Arduino 5V
  • GND → Arduino GND
  • TX → Arduino digital pin 2 (software serial RX)
  • RX → Arduino digital pin 3 (software serial TX)

The servo motor connects to:

  • Red wire (power) → Arduino 5V
  • Brown wire (ground) → Arduino GND
  • Orange wire (signal) → Arduino digital pin 9

Make sure your power supply can handle the servo — servos can draw significant current when moving under load. For a prototype, USB power is usually fine, but a production installation should use a separate 5V supply.

Programming the Arduino

You’ll need two libraries: the Adafruit Fingerprint Sensor Library and the built-in Servo library. Install the Adafruit library through the Arduino Library Manager.

The code has two parts: an enrollment sketch (run once to register fingerprints) and the main lock sketch (runs continuously).

Enrollment — Upload the “enroll” example from the Adafruit library. Open the Serial Monitor, and it will walk you through placing your finger twice to register it. Repeat for each person who needs access.

Main lock code — The core logic is simple:

  1. Wait for a finger on the sensor
  2. Capture the image and generate a template
  3. Search the stored templates for a match
  4. If matched: rotate servo to unlock position, wait 5 seconds, rotate back to locked
  5. If not matched: do nothing (optionally flash an LED or buzz a piezo)

The key functions from the Adafruit library are finger.getImage(), finger.image2Tz(), and finger.fingerFastSearch(). The servo is controlled with myservo.write(90) to unlock and myservo.write(0) to lock.

Making It Practical

Once the prototype works on a breadboard, you can make it into a real door lock:

  • Mount the sensor near the door handle at a comfortable height
  • Connect the servo to the existing deadbolt or latch mechanism with a simple bracket
  • Power it with a wall adapter or battery pack (add a low-battery warning LED)
  • Add security features: a lockout after 5 failed attempts, a backup key override, or a WiFi module to unlock remotely

For a more advanced version, you could add two-factor authentication by combining the fingerprint with a keypad, or use an ESP32 instead of an Arduino to add WiFi connectivity for remote monitoring and control.

The same pull-up resistor concepts apply here — make sure any status LEDs or buttons have proper pull-ups or pull-downs to avoid erratic behavior.

Watch the Full Build

This project was inspired by an original video tutorial. Watch the full process:

Parts List

Here are the components for this project (affiliate links):

Free Daily Electronics Newsletter

Tutorials, news, and one component explained simply — every day.

Subscription Form (#5)
Scroll to Top