Overview:
In this project, we will build a Biometric Security System using Arduino and a Fingerprint Sensor. Biometric security systems are becoming increasingly popular due to their enhanced security features and ease of use. Unlike traditional security systems that rely on passwords or physical keys, biometric systems use unique physical or behavioral characteristics, such as fingerprints, to verify an individual’s identity.
By integrating the Arduino microcontroller with a fingerprint sensor, we can create a reliable and efficient security system that can be used for various applications, from door locks to attendance systems. The Arduino processes the data from the fingerprint sensor and determines whether access should be granted or denied based on the stored fingerprint data. This project offers a hands-on approach to understanding the intricacies of biometric security and the potential of Arduino in real-world applications.
Earlier we build Password based Security System as well as RFID Security System using an Arduino. You may follow them for more security system projects.
Bill of Materials
The following are the components required for making this project. You can purchase all the components from the given links.
| S.N. | Components Name | Quantity | Purchase Links |
|---|---|---|---|
| 1 | Arduino Nano Board | 1 | Amazon | AliExpress | SunFounder |
| 2 | R305/R307 Fingerprint Sensor | 1 | Amazon | AliExpress |
| 3 | 12V Solenoid Lock | 1 | Amazon | AliExpress |
| 4 | 16x2 I2C LCD Display | 1 | Amazon | AliExpress | SunFounder |
| 5 | 1 Channel Relay Module | 1 | Amazon | AliExpress | SunFounder |
| 6 | Push Button Switch | 4 | Amazon | AliExpress | SunFounder |
| 7 | Resistor 1K | 2 | Amazon | AliExpress | SunFounder |
| 8 | LED 5mm Red/Green | 2 | Amazon | AliExpress | SunFounder |
| 9 | 7805 Voltage Regulator IC | 1 | Amazon | AliExpress |
| 10 | Capacitor 100uF/35V | 1 | Amazon | AliExpress | SunFounder |
| 11 | 12V Power Supply | 1 | Amazon | AliExpress | SunFounder |
| 12 | Connecting Wires | 20 | Amazon | AliExpress | SunFounder |
| 13 | Breadboard | 1 | Amazon | AliExpress | SunFounder |
All these components can be connected in a breadboard to build the complete system.
Block Diagram & System Operations
Here’s the block diagram of the Biometric Security System using Arduino and Fingerprint Sensor:
Components Used
The system uses Arduino Microcontroller and Fingerprint Sensor along with some other sensors and modules which are explained below:
- Arduino: This is the central processing unit of the system. It receives the signal from the fingerprint module, processes it, and then sends a command to either grant or deny access.
- 16×2 LCD: This is a display module that provides feedback to the user. It can display messages like “Access Granted”, “Access Denied”, or “Place your finger”.
- Fingerprint Module: This module scans the fingerprint of the user. If the fingerprint matches with the stored data, it sends a signal to the Arduino.
- Push Buttons: There are four push buttons that are used to enroll, delete, scan, select operations
- Relay: A relay is an electrically operated switch. When the Arduino sends a command to grant access, the relay is activated.
- Solenoid Lock: A solenoid lock is an electronic lock that can be locked or unlocked when an electrical current is passed through it. When the relay is activated, it provides power to the solenoid lock, unlocking it.
System Operation
The Biometric Security System is designed to provide secure access control using fingerprint verification. At its core, the system comprises a R305 fingerprint module, an Arduino microcontroller, a relay, a solenoid lock, an LCD display, and four push buttons. Users interact with the system primarily through the push buttons and the LCD display. The push buttons allow users to enroll new fingerprints, delete existing ones, initiate a scan for access, or select a specific location in the system’s memory for fingerprint storage or deletion.
Upon pressing the scan button, a user is prompted to place their finger on the fingerprint module. The module scans the fingerprint and sends the data to the Arduino for verification. The Arduino processes this data and checks it against stored fingerprints. If a match is found, the Arduino activates the relay, which in turn powers the solenoid lock, unlocking it. Throughout this process, the LCD display provides feedback to the user, indicating actions to be taken or the result of the verification, such as “Access Granted” or “Access Denied“.
Circuit Diagram & Connection
Here’s the circuit diagram of the Fingerprint Biometric Security System made using Fritzing Software:
Let us take a closer look at the connection between various components in this project.
Arduino – LCD Connection:
- SDA (Serial Data): Connected to the A4 pin of the Arduino.
- SCL (Serial Clock): Connected to the A5 pin of the Arduino.
- VCC: Connected to the 5V pin of the Arduino, providing power to the LCD.
- GND (Ground): This is connected to the GND pin of the Arduino
LED Indicators:
- Led1: Indicates the door’s closed status and is connected to the D4 pin of the Arduino.
- Led2: Another indicator for the door’s closed status is connected to the D5 pin of the Arduino.
Push Buttons:
- S1: Connected to the D8 pin of the Arduino.
- S2: Connected to the D9 pin of the Arduino.
- S3: Connected to the D10 pin of the Arduino.
- S4: Connected to the D11 pin of the Arduino.
R305 Fingerprint Sensor
- VCC (Red Wire): Connected to 5V of Arduino
- GND (Black Wire): Connected to GND of Arduino
- TX (Yellow Wire): Connected to the D2 pin of Arduino
- RX (Blue Wire): Connected to the D3 pin of Arduino
Relay Module
- VCC: Connected to 5V of Arduino
- GND: Connected to GND Pin
- IN: Connected to D6 of Arduino
- COM: Connected to Solenoid Lock
- NC: Connected to 12V
For the Power Supply unit, the entire device is powered using a 12V DC Power Adapter. The 7805 Voltage regulator IC powers all other devices like the Fingerprint Sensor and relay using the 5V output of the 7805 regulator. The 12V Supply is also connected to the Vin Pin of Arduino Nano. The 100uF/35V Electrolytic Capacitor is used for Voltage Stability at Power Supply Pins.
All the connection can be done in breadboard as per circuit diagram.
Source Code/Program
The code for Biometric Security System using R305 Fingerprint Sensor is written in Arduino IDE.
The code requires following library for compilation. First download the library and add it to the Arduino folder.
Here is a complete code for the project. You can copy this code and paste it on your Arduino IDE.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
#include <Adafruit_Fingerprint.h> #include <SoftwareSerial.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display SoftwareSerial fingerPrint(2, 3); uint8_t id; Adafruit_Fingerprint finger = Adafruit_Fingerprint(&fingerPrint); #define enroll 8 #define del 9 #define up 10 #define down 11 #define Door_Open 4 #define Door_Close 5 #define RELAY_PIN 6 void setup() { delay(1000); pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, LOW); // Initially, relay is off pinMode(enroll, INPUT_PULLUP); pinMode(up, INPUT_PULLUP); pinMode(down, INPUT_PULLUP); pinMode(del, INPUT_PULLUP); pinMode(Door_Open, OUTPUT); pinMode(Door_Close, OUTPUT); lcd.init(); lcd.backlight(); lcd.print("Fingerprint"); lcd.setCursor(0, 1); lcd.print("Security System"); delay(2000); lcd.clear(); Serial.begin(9600); finger.begin(57600); lcd.clear(); lcd.print("Finding Module"); lcd.setCursor(0, 1); delay(1000); if (finger.verifyPassword()) { Serial.println("Found fingerprint sensor!"); lcd.clear(); lcd.print("Found Module "); delay(1000); } else { Serial.println("Did not find fingerprint sensor :("); lcd.clear(); lcd.print("module not Found"); lcd.setCursor(0, 1); lcd.print("Check Connections"); while (1); } } void loop() { lcd.setCursor(0, 0); lcd.print("Press UP/Down "); lcd.setCursor(0, 1); lcd.print("to start System"); digitalWrite(Door_Close, HIGH); if (digitalRead(up) == 0 || digitalRead(down) == 0) { for (int i = 0; i < 5; i++) { lcd.clear(); lcd.print("Place Finger"); delay(2000); int result = getFingerprintIDez(); if (result >= 0) { digitalWrite(Door_Open, HIGH); digitalWrite(Door_Close, LOW); lcd.clear(); lcd.print("Allowed"); lcd.setCursor(0, 1); lcd.print("Gate Opened "); digitalWrite(RELAY_PIN, HIGH); delay(5000); digitalWrite(RELAY_PIN, LOW); digitalWrite(Door_Close, HIGH); digitalWrite(Door_Open, LOW); lcd.setCursor(0, 1); lcd.print("Gate Closed "); return; } } } checkKeys(); delay(1000); } void checkKeys() { if (digitalRead(enroll) == 0) { lcd.clear(); lcd.print("Please Wait"); delay(1000); while (digitalRead(enroll) == 0); Enroll(); } else if (digitalRead(del) == 0) { lcd.clear(); lcd.print("Please Wait"); delay(1000); delet(); } } void Enroll() { int count = 0; lcd.clear(); lcd.print("Enroll Finger "); lcd.setCursor(0, 1); lcd.print("Location:"); while (1) { lcd.setCursor(9, 1); lcd.print(count); if (digitalRead(up) == 0) { count++; if (count > 25) count = 0; delay(500); } else if (digitalRead(down) == 0) { count--; if (count < 0) count = 25; delay(500); } else if (digitalRead(del) == 0) { id = count; getFingerprintEnroll(); return; } else if (digitalRead(enroll) == 0) { return; } } } void delet() { int count = 0; lcd.clear(); lcd.print("Delete Finger "); lcd.setCursor(0, 1); lcd.print("Location:"); while (1) { lcd.setCursor(9, 1); lcd.print(count); if (digitalRead(up) == 0) { count++; if (count > 25) count = 0; delay(500); } else if (digitalRead(down) == 0) { count--; if (count < 0) count = 25; delay(500); } else if (digitalRead(del) == 0) { id = count; deleteFingerprint(id); return; } else if (digitalRead(enroll) == 0) { return; } } } uint8_t getFingerprintEnroll() { int p = -1; lcd.clear(); lcd.print("finger ID:"); lcd.print(id); lcd.setCursor(0, 1); lcd.print("Place Finger"); delay(2000); while (p != FINGERPRINT_OK) { p = finger.getImage(); switch (p) { case FINGERPRINT_OK: Serial.println("Image taken"); lcd.clear(); lcd.print("Image taken"); break; case FINGERPRINT_NOFINGER: Serial.println("No Finger"); lcd.clear(); lcd.print("No Finger"); break; case FINGERPRINT_PACKETRECIEVEERR: Serial.println("Communication error"); lcd.clear(); lcd.print("Comm Error"); break; case FINGERPRINT_IMAGEFAIL: Serial.println("Imaging error"); lcd.clear(); lcd.print("Imaging Error"); break; default: Serial.println("Unknown error"); lcd.clear(); lcd.print("Unknown Error"); break; } } // OK success! p = finger.image2Tz(1); switch (p) { case FINGERPRINT_OK: Serial.println("Image converted"); lcd.clear(); lcd.print("Image converted"); break; case FINGERPRINT_IMAGEMESS: Serial.println("Image too messy"); lcd.clear(); lcd.print("Image too messy"); return p; case FINGERPRINT_PACKETRECIEVEERR: Serial.println("Communication error"); lcd.clear(); lcd.print("Comm Error"); return p; case FINGERPRINT_FEATUREFAIL: Serial.println("Could not find fingerprint features"); lcd.clear(); lcd.print("Feature Not Found"); return p; case FINGERPRINT_INVALIDIMAGE: Serial.println("Could not find fingerprint features"); lcd.clear(); lcd.print("Feature Not Found"); return p; default: Serial.println("Unknown error"); lcd.clear(); lcd.print("Unknown Error"); return p; } Serial.println("Remove finger"); lcd.clear(); lcd.print("Remove Finger"); delay(2000); p = 0; while (p != FINGERPRINT_NOFINGER) { p = finger.getImage(); } Serial.print("ID "); Serial.println(id); p = -1; Serial.println("Place same finger again"); lcd.clear(); lcd.print("Place Finger"); lcd.setCursor(0, 1); lcd.print(" Again"); 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"); return; } } // OK success! p = finger.image2Tz(2); switch (p) { case FINGERPRINT_OK: Serial.println("Image converted"); break; case FINGERPRINT_IMAGEMESS: Serial.println("Image too messy"); return p; case FINGERPRINT_PACKETRECIEVEERR: Serial.println("Communication error"); return p; case FINGERPRINT_FEATUREFAIL: Serial.println("Could not find fingerprint features"); return p; case FINGERPRINT_INVALIDIMAGE: Serial.println("Could not find fingerprint features"); return p; default: Serial.println("Unknown error"); return p; } // OK converted! Serial.print("Creating model for #"); Serial.println(id); p = finger.createModel(); if (p == FINGERPRINT_OK) { Serial.println("Prints matched!"); } else if (p == FINGERPRINT_PACKETRECIEVEERR) { Serial.println("Communication error"); return p; } else if (p == FINGERPRINT_ENROLLMISMATCH) { Serial.println("Fingerprints did not match"); return p; } else { Serial.println("Unknown error"); return p; } Serial.print("ID "); Serial.println(id); p = finger.storeModel(id); if (p == FINGERPRINT_OK) { Serial.println("Stored!"); lcd.clear(); lcd.print("Stored!"); delay(2000); } else if (p == FINGERPRINT_PACKETRECIEVEERR) { Serial.println("Communication error"); return p; } else if (p == FINGERPRINT_BADLOCATION) { Serial.println("Could not store in that location"); return p; } else if (p == FINGERPRINT_FLASHERR) { Serial.println("Error writing to flash"); return p; } else { Serial.println("Unknown error"); return p; } } int getFingerprintIDez() { uint8_t p = finger.getImage(); if (p != FINGERPRINT_OK) return -1; p = finger.image2Tz(); if (p != FINGERPRINT_OK) return -1; p = finger.fingerFastSearch(); if (p != FINGERPRINT_OK) { lcd.clear(); lcd.print("Finger Not Found"); lcd.setCursor(0, 1); lcd.print("Try Later"); delay(2000); return -1; } // found a match! Serial.print("Found ID #"); Serial.print(finger.fingerID); return finger.fingerID; } uint8_t deleteFingerprint(uint8_t id) { uint8_t p = -1; lcd.clear(); lcd.print("Please wait"); p = finger.deleteModel(id); if (p == FINGERPRINT_OK) { Serial.println("Deleted!"); lcd.clear(); lcd.print("Figer Deleted"); lcd.setCursor(0, 1); lcd.print("Successfully"); delay(1000); } else { Serial.print("Something Wrong"); lcd.clear(); lcd.print("Something Wrong"); lcd.setCursor(0, 1); lcd.print("Try Again Later"); delay(2000); return p; } } |
Working of Arduino Biometric Security System Project
After uploading the above code to Arduino Nano Board, the Fingerprint Biometric Security System project is ready to get tested.
It will start searching for the Fingeprint Module.
If module is found, the LCD will display module found.
Finally the LCD will display the message to press the button to start the scanning.
The 4 push buttons are used for all the operations here:
- Enroll/Back:
- Enroll: Starts the process to add a new fingerprint.
- Back: Exits the current operation or goes to the previous menu.
- Delete/Ok:
- Delete: Removes an existing fingerprint.
- Ok: Confirms a selection or action.
- Up/Match:
- Up: Scrolls up through options or increases values.
- Match: Initiates a fingerprint verification.
- Down/Match:
- Down: Scrolls down through options or decreases values.
- Match: Also used for fingerprint verification.
Fingerprint Enrollment/Deletion
Press the Enroll/Back Button to enroll a fingerprint.
It will ask you to select the location to enroll the fingerprint. Press the UP and Down button to increase or decrease the location.
After pressing the OK button, the LCD will display the message to place the finger on the sensor.
Place the finger on the sensor so that the sensor will take image. Remove the finger when the LCD Displays Remove Finger.
It will again ask you to place the finger again. So place the finger again and remove it when it asks to remove.
Finally the fingerprint is stored and it will be shown in LCD too.
The fingerprint deletion process is similar. Press the delete button and then select the location. Finally press OK to delete it.
Fingerprint Security Locking/Unlocking
After the fingerprint enrollment is done, its time to scan the finger and open the Solenoid Lock. Press the Up/Down Button to start the scanning process.
To scan the finger, place the enrolled finger on the sensor.
If the finger placed is matched, then the Relay get activated and Solenoid Lock Opens for 5 seconds. Also the green LED turns ON. After 5 seconds the Solenoid lock closes again.
In case the wrong finger or the finger which is not enrolled is placed the LCD will display Try Again message.
This is how the Arduino Biometric Fingerprint Security System works.
Conclusion
The Biometric Security System, leveraging the capabilities of Arduino and a Fingerprint Sensor, represents a significant advancement in security solutions. Moving beyond traditional methods like passwords or physical keys, this system harnesses unique biometric identifiers, specifically fingerprints, to ensure enhanced security. The integration of components like the LCD display, relay, solenoid lock, and push buttons makes the system both user-friendly and efficient. Users receive real-time feedback and have the flexibility to manage their fingerprint data seamlessly.
In essence, this project not only showcases the potential of biometric security but also highlights the versatility of Arduino in crafting innovative, real-world solutions.
























