How to Use a Fingerprint Sensor with Arduino Uno: Door Lock System

Intro

Your phone unlocks with your finger, your office attendance is marked with a thumb, and a hostel door opens for the right person without a key. The small black module that makes all of that possible costs less than a textbook — and it talks to an Arduino over two wires.

The module is the R307, an optical fingerprint sensor. You press your finger on its glass window, it takes a picture of your fingerprint, turns the picture into a small digital template, and stores that template inside its own memory. Later, when a finger touches the window again, the module compares it with every template it has stored and answers with a match or no match — all in under a second. The Arduino only has to ask the question and act on the answer.

In this guide, you will build a fingerprint door lock: enrol your finger from the Serial Monitor, then touch the sensor and a green LED lights up with a short beep for a registered finger, while an unknown finger gets a red LED and two beeps. You will learn how an optical fingerprint sensor works, why it needs 5 V and not 3.3 V, how UART wiring differs from the SPI wiring of the RFID reader, how the Adafruit Fingerprint library enrols and searches, and how to write lock code that never blocks with delay(). The project is a strong base for a final-year project — a hostel door lock, an attendance system, or a fingerprint safe all start from this exact circuit.

Components Required

PartQuantityPurposePrice
R307 Fingerprint Sensor Module (optical, UART)1Scans fingerprints and stores templatesRs 3,500
Arduino Uno R3 DIP1Runs the Adafruit Fingerprint library and the door lock codeRs 1,200
MB102 solderless breadboard, 830 points1Holds the LEDs, resistors and buzzer without solderingRs 250
Active Piezo Buzzer 3V–12V1Beeps for access granted and deniedRs 35
5 mm LED (green)1Lights up when a registered finger is scannedRs 6
5 mm LED (red)1Lights up when an unknown finger is scannedRs 6
220 Ω resistor2Protect the two LEDs from too much currentAvailable on order — WhatsApp
40-pin male-to-male jumper wires10Connects the sensor, LEDs and buzzer to the UnoRs 180

The parts come to about Rs 5,177, including the R307 module at Rs 3,500. The 220 Ω resistors are available on order — message us on WhatsApp for the current price. The sensor’s six-wire cable is usually included in the box.

How a Fingerprint Sensor Works

An optical fingerprint sensor is a tiny camera system. Under the glass window sits a light and an image sensor. When you press your finger on the window, the light shines on your skin and the image sensor photographs the pattern of ridges and valleys on your fingertip. The module’s own processor then studies that picture and picks out the distinctive features — ridge endings and splits, called minutiae — and turns them into a compact digital description.

That description is called a character file, and it is 256 bytes. It is not a photograph: you cannot rebuild a fingerprint image from it, and the Arduino never sees the picture at all. When you enrol a finger, the module scans it twice and combines the two character files into one template of 512 bytes, which it stores in its own flash memory under an ID number you choose. The templates survive unplugging the Arduino and even uploading new code, because they live inside the sensor, not in the Arduino.

Matching works in two ways. In 1:1 mode (verify), the module compares a fresh scan with one stored template you name. In 1:N mode (search), it compares the fresh scan with every template in its library and reports the best match — this is what a door lock uses, because the lock does not know in advance whose finger is on the window. The search takes under a second even with 1,000 templates stored.

The 5 V rule: the one thing you must not get wrong

The R307 runs on 4.2 V to 6 V, so it takes its power from the Arduino Uno’s 5V pin — and only from that pin. The Uno’s 3.3V pin is below the module’s minimum voltage: the sensor may light up, but it will fail to answer commands. This is the opposite of the RC522 RFID module from the previous guide, which must run on 3.3 V and never on 5 V — so if you have built both projects, check the power wire every time you swap modules.

Key specifications of the R307 module (GROW R307 User Manual, Ver. 1.20):

SpecificationValue
Sensor typeOptical
Supply voltageDC 4.2 V to 6 V (5 V typical)
Working currentAbout 50 mA typical, 80 mA peak
InterfaceUART (TTL), 9,600 to 115,200 baud, 57,600 default
Image size256 × 288 pixels
Sensing window19 × 21 mm
Image acquiring timeUnder 0.5 seconds
Character file256 bytes
Template file512 bytes
Storage capacity1,000 templates
Security levels1 to 5 (level 3 is the default)
False acceptance rate (FAR)Under 0.001%
False rejection rate (FRR)Under 0.1%
Search timeUnder 1 second (1:1,000)
Matching modes1:1 verify and 1:N search
Module sizeAbout 44.1 × 20 × 23.5 mm

The closely related AS608 module speaks the same protocol and works with the same library and the same code in this guide. Its differences are a 3.3 V to 5 V supply, about 120 mA current, and 162 stored templates instead of 1,000. If your module says AS608 on it, follow this guide exactly — only the capacity number changes.

R307 Pinout and Wiring with Arduino Uno

The module has six pins on its cable. Wire colours can vary by seller, so always go by the pin name printed on the module or its cable, not by colour alone. The two pins you will not use in this build are Touch, a finger-detection output, and 3.3V, which powers that detection circuit — the module works without them, and this guide leaves them unconnected.

R307 sensor pinMeaningArduino Uno pinWire colour used here
5VPower — 4.2 V to 6 V, NEVER 3.3V5VRed
GNDGroundGNDBlack
TXDSensor transmits — Arduino receivesD2Green
RXDSensor receives — Arduino transmitsD3White
TouchFinger-detection output — not used here— (leave unconnected)—
3.3VFinger-detection power — not used here— (leave unconnected)—

The TX and RX wires cross over: the sensor’s TX goes to the Arduino’s D2, and the sensor’s RX goes to the Arduino’s D3. That is not a mistake — a transmitter must talk to a receiver, so TX always meets RX on the other side. If you wire TX to TX, the sensor never answers and the code reports “Sensor not found”. This crossover is the most common wiring error with UART modules, so check it first whenever the sensor does not respond.

The sensor talks over a second serial port made in software. The Uno’s hardware serial port on D0 and D1 is busy talking to your computer through the USB cable — that is how the Serial Monitor works — so the sensor cannot use those pins. The code below creates a SoftwareSerial port on D2 and D3 instead, at the sensor’s default speed of 57,600 baud. The Serial Monitor itself runs at 9,600 baud; the two speeds are different and that is normal.

The lock’s outputs sit on the MB102 breadboard with the Uno.

Lock partConnection
Green LED anode (+)D7, through a 220 Ω resistor
Green LED cathode (−)GND
Red LED anode (+)D8, through a 220 Ω resistor
Red LED cathode (−)GND
Active buzzer +D6
Active buzzer −GND

Each resistor goes between its Arduino pin and its LED anode. The buzzer in this guide is the active type, which sounds when its pin is HIGH — a passive buzzer looks the same but needs a tone() signal, so check which type you have first.

Circuit diagram — Arduino Uno on the left, R307 fingerprint sensor on the right with TX, RX, VCC and GND labelled and a drawn sensor module with a glass window, green and red LEDs with 220 Ω resistors and active buzzer below; wires: green TX to D2, grey RX to D3, red VCC to 5V, black GND to GND, magenta D6 to the buzzer, green D7 through the resistor to the green LED, red D8 through the resistor to the red LED.
Fingerprint door lock circuit diagram — Arduino Uno, R307 sensor, LEDs and buzzer.

Library Installation

This project needs one library. SoftwareSerial is built into the Arduino IDE. The fingerprint library comes from the Library Manager:

  1. In the Arduino IDE, open Sketch > Include Library > Manage Libraries.
  2. Search for “Adafruit Fingerprint Sensor Library” and install the one by Adafruit (version 2.1.4 was used for this guide).
  3. Restart the IDE if the examples do not appear.

The library speaks the sensor’s packet protocol for you: it takes the picture, turns it into a template, stores it, and searches the library. Your code only calls getImage(), image2Tz(), createModel(), storeModel() and fingerFastSearch().

Complete Arduino Code

/*
  Fingerprint Door Lock with Arduino Uno
  Place a registered finger on the R307 / AS608 sensor and the
  lock answers:
  - Registered finger: green LED lights for 2 seconds, one short beep.
  - Unknown finger: red LED lights for 2 seconds, two short beeps.
  Every match is printed on the Serial Monitor with its ID number
  and confidence score.

  HOW TO ENROL A FINGER:
  1. Upload this sketch and open the Serial Monitor at 9600 baud.
  2. Type a number from 1 to 127 and press Enter. That number is
     the ID this finger will be stored under.
  3. Follow the prompts: place the finger, lift it, place the
     same finger again. Two scans are needed to build one template.
  4. Repeat for every finger you want the lock to know.
  Enrolled templates live inside the sensor's own flash memory,
  so they survive unplugging the Arduino.

  The lock itself never blocks: the LED and buzzer timing all runs
  on millis(). Enrolment is the only part that waits for you,
  because you are standing at the Serial Monitor giving it
  instructions.

  Needs one library: "Adafruit Fingerprint Sensor Library" by
  Adafruit. Install it from Sketch > Include Library > Manage
  Libraries. SoftwareSerial is built into the Arduino IDE.

  Wiring:
    Sensor TX (green wire) -> D2   (SoftwareSerial RX)
    Sensor RX (white wire) -> D3   (SoftwareSerial TX)
    Sensor VCC (red wire)  -> 5V   (R307 needs 4.2-6 V - NEVER 3.3V)
    Sensor GND (black wire)-> GND
    Sensor Touch + 3.3V pins: leave unconnected in this build
    Green LED anode (+) -> D7 through a 220 ohm resistor
    Red LED anode (+)   -> D8 through a 220 ohm resistor
    LED cathodes (-) -> GND
    Active buzzer + -> D6, buzzer - -> GND
*/

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

// D2 receives from the sensor, D3 transmits to it.
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

#define GREEN_LED_PIN 7    // Green LED anode through a 220 ohm resistor
#define RED_LED_PIN 8      // Red LED anode through a 220 ohm resistor
#define BUZZER_PIN 6       // Active buzzer + (sounds on HIGH)

const unsigned long SIGNAL_MS = 2000;   // LEDs stay lit for 2 seconds
const unsigned long BEEP_MS = 150;      // Length of one beep

unsigned long signalEnd = 0;
unsigned long lastBeepToggle = 0;
bool buzzerOn = false;
int beepsLeft = 0;
bool waitingForRemoval = false;

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // Wait for the Serial Monitor on boards that need it.
  }
  pinMode(GREEN_LED_PIN, OUTPUT);
  pinMode(RED_LED_PIN, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  digitalWrite(GREEN_LED_PIN, LOW);
  digitalWrite(RED_LED_PIN, LOW);
  digitalWrite(BUZZER_PIN, LOW);

  finger.begin(57600);
  if (finger.verifyPassword()) {
    Serial.println("Fingerprint sensor found");
  } else {
    Serial.println("Sensor not found - check wiring and power");
    Serial.println("Sensor TX -> D2, sensor RX -> D3, VCC -> 5V, GND -> GND");
    while (1) {
      delay(1); // Nothing else can work without the sensor.
    }
  }

  if (finger.getParameters() == FINGERPRINT_OK) {
    Serial.print("Sensor capacity: ");
    Serial.print(finger.capacity);
    Serial.println(" fingerprints");
  }
  if (finger.getTemplateCount() == FINGERPRINT_OK) {
    Serial.print("Fingerprints stored: ");
    Serial.println(finger.templateCount);
  }
  Serial.println("Fingerprint Door Lock ready");
  Serial.println("Type a number 1-127 and press Enter to enrol a finger");
  Serial.println("Or place a registered finger on the sensor");
}

// Returns 0 = no finger, 1 = granted, 2 = denied, 3 = scan error.
uint8_t checkFinger() {
  uint8_t p = finger.getImage();
  if (p == FINGERPRINT_NOFINGER) {
    return 0;
  }
  if (p != FINGERPRINT_OK) {
    Serial.println("Imaging error");
    return 3;
  }
  p = finger.image2Tz();
  if (p != FINGERPRINT_OK) {
    Serial.println("Messy image - lift and place the finger again");
    return 3;
  }
  p = finger.fingerFastSearch();
  if (p == FINGERPRINT_OK) {
    Serial.print("Found ID #");
    Serial.print(finger.fingerID);
    Serial.print(" with confidence ");
    Serial.println(finger.confidence);
    return 1;
  }
  if (p == FINGERPRINT_NOTFOUND) {
    Serial.println("Finger not registered");
    return 2;
  }
  Serial.println("Search error");
  return 3;
}

void loop() {
  unsigned long now = millis();

  // Switch the signal LEDs off once their 2 seconds are up.
  if (signalEnd != 0 && now >= signalEnd) {
    digitalWrite(GREEN_LED_PIN, LOW);
    digitalWrite(RED_LED_PIN, LOW);
    signalEnd = 0;
  }

  // Beep pattern, also non-blocking: while beeps remain, the
  // buzzer toggles every 150 ms. One beep for granted, two for denied.
  if (beepsLeft > 0) {
    if (now - lastBeepToggle >= BEEP_MS) {
      lastBeepToggle = now;
      if (buzzerOn) {
        digitalWrite(BUZZER_PIN, LOW);
        buzzerOn = false;
        beepsLeft--;
      } else {
        digitalWrite(BUZZER_PIN, HIGH);
        buzzerOn = true;
      }
    }
  } else if (buzzerOn) {
    digitalWrite(BUZZER_PIN, LOW);
    buzzerOn = false;
  }

  // After a verdict, wait until the finger is lifted before
  // scanning again, so one touch is never read twice.
  if (waitingForRemoval) {
    if (finger.getImage() == FINGERPRINT_NOFINGER) {
      waitingForRemoval = false;
    }
    return;
  }

  // Enrolment: type an ID number 1-127 in the Serial Monitor.
  if (Serial.available() > 0) {
    String line = Serial.readStringUntil('\n');
    line.trim();
    int id = line.toInt();
    if (id >= 1 && id <= 127) {
      enrollFingerprint((uint8_t)id);
    } else {
      Serial.println("Type a number from 1 to 127 to enrol a finger");
    }
    return;
  }

  uint8_t result = checkFinger();
  if (result == 1) {
    Serial.println("ACCESS GRANTED");
    digitalWrite(GREEN_LED_PIN, HIGH);
    digitalWrite(RED_LED_PIN, LOW);
    beepsLeft = 1;
    signalEnd = now + SIGNAL_MS;
    lastBeepToggle = now;
    waitingForRemoval = true;
  } else if (result == 2) {
    Serial.println("ACCESS DENIED");
    digitalWrite(RED_LED_PIN, HIGH);
    digitalWrite(GREEN_LED_PIN, LOW);
    beepsLeft = 2;
    signalEnd = now + SIGNAL_MS;
    lastBeepToggle = now;
    waitingForRemoval = true;
  }
  // result 0 (no finger) and 3 (scan error): keep waiting.
}

// Enrol one finger under the given ID. Two scans of the same
// finger are combined into one template and stored in the
// sensor's flash memory. This is an interactive setup step,
// so it waits for you at the Serial Monitor.
uint8_t enrollFingerprint(uint8_t id) {
  int p = -1;
  Serial.print("Enrolling ID #");
  Serial.println(id);
  Serial.println("Place finger on sensor...");

  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
      case FINGERPRINT_OK:
        Serial.println("Image taken");
        break;
      case FINGERPRINT_NOFINGER:
        Serial.print(".");
        break;
      case FINGERPRINT_PACKETRECIEVEERR:
        Serial.println("Communication error");
        break;
      case FINGERPRINT_IMAGEFAIL:
        Serial.println("Imaging error");
        break;
      default:
        Serial.println("Unknown error");
        break;
    }
  }

  p = finger.image2Tz(1);
  if (p != FINGERPRINT_OK) {
    Serial.println("Could not read the print - try again");
    return p;
  }
  Serial.println("Remove finger");
  delay(2000);

  p = 0;
  while (p != FINGERPRINT_NOFINGER) {
    p = finger.getImage();
  }

  Serial.println("Place the same finger again...");
  p = -1;
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
      case FINGERPRINT_OK:
        Serial.println("Image taken");
        break;
      case FINGERPRINT_NOFINGER:
        Serial.print(".");
        break;
      case FINGERPRINT_PACKETRECIEVEERR:
        Serial.println("Communication error");
        break;
      case FINGERPRINT_IMAGEFAIL:
        Serial.println("Imaging error");
        break;
      default:
        Serial.println("Unknown error");
        break;
    }
  }

  p = finger.image2Tz(2);
  if (p != FINGERPRINT_OK) {
    Serial.println("Could not read the print - try again");
    return p;
  }

  p = finger.createModel();
  if (p != FINGERPRINT_OK) {
    Serial.println("The two scans did not match - enrol again");
    return p;
  }
  Serial.println("Prints matched!");

  p = finger.storeModel(id);
  if (p == FINGERPRINT_OK) {
    Serial.print("Stored as ID #");
    Serial.println(id);
  } else {
    Serial.println("Could not store the fingerprint");
  }
  return p;
}

Code Explanation

The top of the sketch creates a SoftwareSerial port on pins D2 and D3 and hands it to the Adafruit_Fingerprint object. D2 receives from the sensor and D3 transmits to it — the crossover from the wiring table, written in code. The LED and buzzer pins are D7, D8 and D6, the same outputs as the RFID door lock in the previous guide, so the two projects share one breadboard layout.

setup() opens the Serial Monitor at 9,600 baud, then starts the sensor at 57,600 baud with finger.begin(57600). verifyPassword() checks the sensor answers at all — if it fails, the sketch prints the wiring reminder and stops, because nothing else can work without the sensor. getParameters() reads the sensor’s capacity, and getTemplateCount() reports how many fingers are already stored, so you can see at a glance whether enrolment survived from an earlier session.

loop() does four jobs, all on millis() timing except enrolment. First, it switches the signal LEDs off once their 2 seconds are up. Second, it runs the beep pattern: while beeps remain, the buzzer toggles every 150 ms — one beep for a granted finger, two for a denied one — and it is forced silent when the pattern ends. Third, after a verdict it waits until the finger is lifted before scanning again, so one touch is never read twice — the waitingForRemoval flag does the job the RFID guide’s halt command did.

Fourth, it checks the two inputs. If you typed a number in the Serial Monitor, loop() reads the line and, for a number from 1 to 127, runs enrolment. Otherwise it calls checkFinger(): getImage() takes a picture, returning immediately when no finger is present; image2Tz() turns the picture into a character file; fingerFastSearch() searches the whole library and, on a match, fills in finger.fingerID and finger.confidence. A higher confidence number means a closer match. A search that finds nothing returns FINGERPRINT_NOTFOUND, which the code treats as denied — a different answer from “no finger”, and the lock must tell them apart.

enrollFingerprint() is the only part that waits for you, because enrolment is a setup step done at the Serial Monitor. It takes a first scan into slot 1, asks you to lift the finger, takes a second scan into slot 2, and calls createModel() to combine the two character files into one template. Two scans of the same finger are needed because one scan alone cannot be stored — the module insists on confirming the print before it keeps it. storeModel(id) then writes the template into the sensor’s flash under your ID number. If the two scans do not match, createModel() fails and you enrol again.

The one thing you will definitely change is the ID numbers. Enrol each finger under its own number — ID 1 for your thumb, ID 2 for your index finger, and so on — and the lock will print which ID opened it.

Demonstration: Expected Serial Monitor Output

If you have never uploaded code before, see our guide on how to upload code in Arduino Uno.

Upload the code, then open the Serial Monitor with Tools > Serial Monitor and set the baud rate to 9600. You should see:

Fingerprint sensor found
Sensor capacity: 1000 fingerprints
Fingerprints stored: 0
Fingerprint Door Lock ready
Type a number 1-127 and press Enter to enrol a finger
Or place a registered finger on the sensor

Type 5 and press Enter, then follow the prompts:

Enrolling ID #5
Place finger on sensor...
Image taken
Remove finger
Place the same finger again...
Image taken
Prints matched!
Stored as ID #5

Now place the same finger on the sensor. The green LED lights for 2 seconds, the buzzer beeps once, and the Serial Monitor shows something like this — your confidence number will be different:

Found ID #5 with confidence 102
ACCESS GRANTED

Place a finger you never enrolled, and it is denied — the red LED lights, the buzzer beeps twice, and the Serial Monitor shows:

Finger not registered
ACCESS DENIED

That is the whole lock: the sensor does not know names, only ID numbers, and the Arduino decides by the match.

Troubleshooting

  1. “Sensor not found” on the Serial Monitor. Check the crossover first: sensor TX goes to D2 and sensor RX goes to D3 — TX to TX never answers. Then check power: the sensor’s VCC must be on the Uno’s 5V pin, not 3.3V, and GND must be connected. Finally check the baud rate: the code uses finger.begin(57600), the sensor’s default.
  2. Enrolment fails with “The two scans did not match”. Place the same finger both times, in the same position and with the same pressure. A finger rolled to a different angle between the two scans looks like a different finger to the module. Keep the finger still until the prompt tells you to lift it.
  3. A finger that was enrolled is not recognised. Placement matters more than anything: press the finger flat on the window, centred, and hold it still for a second. A quick tap or a finger half off the window gives a partial image. As a workaround, enrol the same finger a second time under a different ID, placed slightly differently — the lock then accepts either version.
  4. “Communication error” while scanning. A Dupont wire is loose, or the SoftwareSerial link is struggling at 57,600 baud. Push every wire firmly into the breadboard, keep the sensor wires short, and check that D2 and D3 are not shared with anything else.
  5. The lock always says ACCESS DENIED. No finger has been enrolled yet — the setup message “Fingerprints stored: 0” tells you so. Enrol a finger first, then test it. Also check you are not still in enrolment: after storing, the sketch returns to matching automatically.
  6. The same touch triggers again and again. That happens if the waitingForRemoval check was edited out. The sketch waits until getImage() reports no finger before it scans again — check that block is still in loop() if you changed the code.
  7. “Adafruit_Fingerprint.h: No such file or directory” when compiling. The library is not installed. Install “Adafruit Fingerprint Sensor Library” by Adafruit from Sketch > Include Library > Manage Libraries — the error message names the missing file, so install the library that provides it. SoftwareSerial is built into the IDE and needs no install.
  8. A wet or very dry finger fails to scan. An optical sensor photographs the skin surface: water on the window blurs the image, and very dry skin gives a faint one. Dry the finger and the window, and for dry skin, breathe on the fingertip once or rub it lightly before scanning.

Project Ideas and FYP Ideas Using a Fingerprint Sensor

  1. Hostel room door lock. Add a relay module and a solenoid lock so a registered finger actually opens the door, with the red LED and buzzer for unknown fingers. Add a push button inside so the door opens from the inside without a finger.
  2. Classroom attendance system. Enrol every student’s finger under their roll number and log the ID with the time to the Serial Monitor — or add an SD card module and a DS3231 real-time clock for a register that survives a power cut. Our RFID card reader with LCD guide shows the same idea with cards instead of fingers.
  3. Fingerprint safe or locker. Mount the sensor on a small box and drive a servo to release the latch only for registered fingers. A second, hidden button can enrol a master finger, and the sketch already supports deleting a single ID with finger.deleteModel(id).
  4. Exam hall entry check. Each student’s finger is checked against the enrolled list before entry, with the buzzer for unregistered fingers. The list lives in the sensor, so the Arduino code stays short even for a whole class.
  5. Two-factor lock: fingerprint plus RFID card. Combine this guide with our RFID door lock guide — the door opens only when the right card is tapped AND the right finger is scanned. Two independent checks make a much stronger final-year project.
  6. Biometric voting or token system. Each voter enrols one finger and the system allows exactly one vote per ID, printing the ID to the Serial Monitor. A small LCD can show the running count, and the sensor’s 1,000-template capacity covers a whole college.

Need Help with the Build?

Frequently Asked Questions

What is the fingerprint sensor price in Pakistan?

The R307 module is available from QKZee Technologies for Rs 3,500. The whole project costs about Rs 5,177 with the parts listed above.

What is the difference between the R307 and the AS608?

They speak the same protocol and run the same code and library. The R307 stores 1,000 fingerprints and needs 4.2 V to 6 V; the AS608 stores 162 and runs on 3.3 V to 5 V. If your module says AS608, follow this guide exactly — only the capacity number changes.

How many fingers can the sensor store?

The R307 stores up to 1,000 templates in its own flash memory. This sketch enrols IDs 1 to 127, which covers a whole class; the sensor itself holds more, so change the range check in loop() if you need more IDs.

Does the fingerprint leave the sensor?

No. The sensor stores only a 512-byte template made from the fingerprint’s features, never a photograph, and the Arduino never receives the image. Templates stay in the sensor’s flash memory, so they survive unplugging the Arduino and uploading new code.

Why does enrolment need two scans of the same finger?

The module builds one template from two character files so it can confirm the print before storing it. One scan alone cannot be stored — createModel() combines the two and fails if they do not match, which is what stops a bad scan from becoming a permanent template.

Is a fingerprint lock secure?

For a student project or a hostel room, yes — the rated false acceptance rate is under 0.001%, so a random finger almost never matches. It is not bank security: an optical sensor can be fooled by a good fake fingerprint in laboratory conditions, and real security systems add liveness detection. Treat it as strong identification, not as proof against a determined attacker.

Conclusion

You have built a working fingerprint lock from a sensor, an Arduino and a few lines of code — and you have learned the three things that matter: the optical scan that turns a fingertip into a template stored inside the sensor, the UART link with its TX-to-RX crossover and its 5 V rule, and the honest limits, that a template is identification and not a photograph, and that placement matters more than anything. The same circuit grows into bigger projects: add a relay and it opens a real door, add an LCD and it greets each finger by ID, add an SD card and it keeps an attendance register.

Components for this project are available at QKZee Technologies, with nationwide Cash on Delivery across Pakistan. Message us on WhatsApp at +92-302-8577025 to order the R307 module and the rest of the parts, or visit our shop at https://qkzeetech.com/shop-2/.

If you missed them, our HC-SR04 ultrasonic sensor guide, our DHT11 temperature and humidity guide, our relay module guide, our MQ-2 gas sensor guide and our RFID RC522 door lock guide build on the same wiring and millis() skills.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *