Projects / Fingerprint door lock

Fingerprint door lock

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 5 done
  1. UNO

    Identify the wires

    Cable colours vary between batches. Check your seller's pin sheet: VCC, GND, TX, RX.

  2. UNO

    Wire the sensor

    VCC to 5V, GND, TX to D2, RX to D3.

  3. UNOR307

    Enrol fingers

    Open File > Examples > Adafruit Fingerprint > enroll, set SoftwareSerial pins to 2 and 3, upload, and enrol IDs 1, 2, 3... Place each finger twice.

  4. UNOON

    Wire the lock

    Relay IN to D7. 12 V through relay COM/NO to the solenoid, with the 1N4007 across it.

  5. UNO8.5 mA

    Upload this sketch

    Upload, open the serial monitor and test enrolled and unknown fingers.

In short

How do you build a fingerprint door lock?

An R307 fingerprint sensor checks a finger against stored prints and opens a 12 V solenoid lock for the people you enrolled. You need Arduino Uno R3, Fingerprint sensor R307, Relay Module 5V, Solenoid lock 12 V, Rectifier Diode 1N4007, 12 V 2 A DC adapter, DC barrel to screw terminal adapter (female), LED 5 mm green, LED 5 mm red, Resistor 220 Ω × 2 and Jumper wires male to female (40 pcs). It takes 5 steps and about 120 minutes.

Level
Intermediate
Time
About 120 min
Parts
11

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
R307 red (VCC) / black (GND)Uno 5V / GNDSensor power (the R307 runs on 4.2 to 6 V)
R307 TX (green on most cables)Uno D2Sensor to Uno (SoftwareSerial RX)
R307 RX (white on most cables)Uno D3Uno to sensor
Relay INUno D7Lock control
12 V +Relay COM, NO to solenoid +Lock power; 1N4007 across the solenoid, stripe to +
Uno D9 / D10220 Ω, green / red LEDMatch / no match

Code

Arduino IDE, board "Arduino Uno". Install "Adafruit Fingerprint Sensor Library". Enrol fingers first with its "enroll" example (change its pins to 2 and 3), then upload this sketch.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

SoftwareSerial fpSerial(2, 3);
Adafruit_Fingerprint finger(&fpSerial);
const int RELAY = 7, GREEN = 9, RED = 10;
const bool ON = LOW;

void setup() {
  pinMode(RELAY, OUTPUT); digitalWrite(RELAY, !ON);
  pinMode(GREEN, OUTPUT); pinMode(RED, OUTPUT);
  Serial.begin(9600);
  finger.begin(57600);
  if (!finger.verifyPassword()) { Serial.println("Sensor not found"); while (true) { digitalWrite(RED, !digitalRead(RED)); delay(200); } }
  finger.getTemplateCount();
  Serial.print("Stored prints: "); Serial.println(finger.templateCount);
}

void loop() {
  if (finger.getImage() != FINGERPRINT_OK) return;          // no finger yet
  if (finger.image2Tz() != FINGERPRINT_OK) return;
  if (finger.fingerSearch() == FINGERPRINT_OK && finger.confidence > 50) {
    Serial.print("Match ID "); Serial.print(finger.fingerID);
    Serial.print(" confidence "); Serial.println(finger.confidence);
    digitalWrite(GREEN, HIGH); digitalWrite(RELAY, ON);
    delay(4000);
    digitalWrite(RELAY, !ON); digitalWrite(GREEN, LOW);
  } else {
    Serial.println("No match");
    digitalWrite(RED, HIGH); delay(1000); digitalWrite(RED, LOW);
  }
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Uno with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

Sensor not found

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Serial monitor at start"Stored prints: N" with the number you enrolled
Enrolled finger"Match ID n confidence 80 to 250", green LED, lock opens for 4 s
Unknown finger"No match", red LED for 1 s
Sensor ring lightLights when a finger is being read

If it does not work

"Sensor not found"

TX and RX swapped, or the module runs at a different speed. Try finger.begin(9600).

Enrolled finger often refused

Re-enrol with the finger flat and centred, and keep the glass clean.

Lock chatters

Check the flyback diode and use a 12 V adapter rated 2 A.

Privacy

Prints are stored inside the sensor, not on the Uno. Delete them with the "delete" example before giving the sensor away.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the fingerprint door lock?

Arduino Uno R3, Fingerprint sensor R307, Relay Module 5V, Solenoid lock 12 V, Rectifier Diode 1N4007, 12 V 2 A DC adapter, DC barrel to screw terminal adapter (female), LED 5 mm green, LED 5 mm red, Resistor 220 Ω × 2 and Jumper wires male to female (40 pcs).

How long does the fingerprint door lock take to build?

About 120 minutes for a intermediate maker, in 5 steps.

How do I know the fingerprint door lock works?

Serial monitor at start: "Stored prints: N" with the number you enrolled. Enrolled finger: "Match ID n confidence 80 to 250", green LED, lock opens for 4 s. Unknown finger: "No match", red LED for 1 s.

Sensor not found: what should I check?

TX and RX swapped, or the module runs at a different speed. Try finger.begin(9600).

Enrolled finger often refused: what should I check?

Re-enrol with the finger flat and centred, and keep the glass clean.

Lock chatters: what should I check?

Check the flyback diode and use a 12 V adapter rated 2 A.

Privacy: what should I check?

Prints are stored inside the sensor, not on the Uno. Delete them with the "delete" example before giving the sensor away.