Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino-Based Biometric and RFID Security System

Image of Arduino-Based Biometric and RFID Security System

Circuit Documentation

Summary

The circuit is designed to authenticate users via RFID and fingerprint scanning before allowing access to a system, which could be an ATM or a secure entry system. It includes an Arduino UNO microcontroller interfaced with an RFID-RC522 module, a fingerprint scanner, multiple LEDs of different colors, a 5V relay, a buzzer, and an I2C LCD screen. The Arduino UNO controls the logic and processes the inputs from the RFID reader and the fingerprint scanner. The LEDs indicate the system's status, the relay controls power to the buzzer, and the LCD displays messages to the user.

Component List

  • RFID-RC522: A radio frequency identification (RFID) reader module for reading RFID tags.
  • Fingerprint Scanner: A biometric sensor that captures fingerprints for authentication purposes.
  • LED (yellow, red, blue, green): Light-emitting diodes of various colors used as status indicators.
  • 5V Relay: An electromechanical switch that allows the Arduino to control higher power devices like the buzzer.
  • Arduino UNO: A microcontroller board based on the ATmega328P, used as the central controller for the circuit.
  • Buzzer: An electronic sounder that provides audio feedback.
  • 9V Battery: A power source for the circuit.
  • I2C LCD 16x2 Screen: A liquid crystal display that shows text messages to the user.

Wiring Details

RFID-RC522

  • VCC (3.3V): Connected to the 3.3V pin on the Arduino UNO.
  • RST: Connected to digital pin D9 on the Arduino UNO.
  • GND: Connected to the ground (GND) on the Arduino UNO.
  • IRQ: Not connected.
  • MISO: Connected to digital pin D12 on the Arduino UNO.
  • MOSI: Connected to digital pin D11 on the Arduino UNO.
  • SCK: Connected to digital pin D13 on the Arduino UNO.
  • SDA: Connected to digital pin D10 on the Arduino UNO.

Fingerprint Scanner

  • VCC: Connected to the 5V pin on the Arduino UNO.
  • TX: Connected to digital pin D2 on the Arduino UNO.
  • RX: Connected to digital pin D3 on the Arduino UNO.
  • GND: Connected to the ground (GND) on the Arduino UNO.

LEDs (yellow, red, blue, green)

  • Cathode: All cathodes are connected to the ground (GND) on the Arduino UNO.
  • Anode (yellow): Connected to digital pin D8 on the Arduino UNO.
  • Anode (red): Connected to digital pin D5 on the Arduino UNO.
  • Anode (blue): Connected to digital pins D4 and D6 on the Arduino UNO.
  • Anode (green): Connected to digital pin D7 on the Arduino UNO.

5V Relay

  • Normally Open (NO): Connected to the positive terminal of the 9V battery.
  • Common terminal (COM): Connected to the positive pin of the buzzer.
  • Normally Closed (NC): Not connected.
  • In: Connected to analog pin A3 on the Arduino UNO.
  • GND: Connected to the ground (GND) on the Arduino UNO.
  • VCC: Connected to the IOREF pin on the Arduino UNO.

Buzzer

  • POSITIVE: Connected to the common terminal of the 5V relay.
  • NEGATIVE: Connected to the negative terminal of the 9V battery.

I2C LCD 16x2 Screen

  • SCL: Connected to analog pin A5 on the Arduino UNO.
  • SDA: Connected to analog pin A4 on the Arduino UNO.
  • VCC (5V): Connected to the IOREF pin on the Arduino UNO.
  • GND: Connected to the ground (GND) on the Arduino UNO.

Arduino UNO

  • 3.3V: Provides power to the RFID-RC522.
  • 5V: Provides power to the fingerprint scanner.
  • GND: Common ground for all components.
  • Digital Pins (D2-D13): Interface with the RFID-RC522, fingerprint scanner, LEDs, and relay.
  • Analog Pins (A3-A5): Interface with the relay and I2C LCD screen.

9V Battery

  • +: Connected to the normally open terminal of the 5V relay.
  • -: Connected to the negative pin of the buzzer.

Documented Code

#include <SPI.h>
#include <MFRC522.h>
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h> // Include SoftwareSerial for communication
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// RFID Pin definitions
#define SS_PIN 10
#define RST_PIN 9
const int buzzerPin = 17; // Define the buzzer pin
MFRC522 rfid(SS_PIN, RST_PIN);
const int activeled = 7;
const int sleepled = 8;
const int rfidblue = 4;
const int unauthorizedled = 5;
const int fpblue = 6;

LiquidCrystal_I2C lcd(0x27, 16, 2);

// Define pins for SoftwareSerial communication
#define fingerprintTX 2  // TX pin of fingerprint sensor to Pin 2
#define fingerprintRX 3  // RX pin of fingerprint sensor to Pin 3
SoftwareSerial mySerial(fingerprintTX, fingerprintRX); // Set up software serial
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

// Your RFID ID and corresponding fingerprint ID
String authorizedRFID = "536435FB"; // The authorized RFID ID
int assignedFingerprintID = 1;
int assignednomineeID = 3;   // Assign this fingerprint ID to the RFID

void setup() {
  Serial.begin(9600);
  pinMode(buzzerPin, OUTPUT); // Set buzzer pin as an output
  digitalWrite(buzzerPin, HIGH);
  pinMode(sleepled, OUTPUT);
  pinMode(activeled, OUTPUT);
  pinMode(rfidblue, OUTPUT);
  pinMode(unauthorizedled, OUTPUT);
  pinMode(fpblue, OUTPUT);
  digitalWrite(sleepled, HIGH); // Sleep mode yellow light on by default
  digitalWrite(activeled, LOW);
  // Initialize LCD
  lcd.begin(16, 2);
  lcd.init();
  lcd.noBacklight();
  // Initialize RFID
  SPI.begin();
  rfid.PCD_Init();
  Serial.println("RFID Reader initialized.");
  delay(5000);
  // Initialize SoftwareSerial for fingerprint sensor
  mySerial.begin(57600); // Start SoftwareSerial communication with the fingerprint sensor
  finger.begin(57600);   // Initialize the fingerprint sensor

  // Check if fingerprint sensor is found and password is correct
  if (finger.verifyPassword()) {
    Serial.println("Fingerprint sensor ready.");
  } else {
    Serial.println("Fingerprint sensor not found or not responding. Please check connections.");
    while (1); // Halt execution if fingerprint sensor is not working
  }
  // Get sensor parameters
  finger.getParameters();
  Serial.print("Status: 0x"); Serial.println(finger.status_reg, HEX);
  Serial.print("Sys ID: 0x"); Serial.println(finger.system_id, HEX);
  Serial.print("Capacity: "); Serial.println(finger.capacity);
  Serial.print("Security level: "); Serial.println(finger.security_level);
  Serial.print("Device address: "); Serial.println(finger.device_addr, HEX);
  Serial.print("Packet len: "); Serial.println(finger.packet_len);
  Serial.print("Baud rate: "); Serial.println(finger.baud_rate);
}

void loop() {
  // RFID blue light on
  digitalWrite(rfidblue, HIGH);
  Serial.println("Place your card near the reader...");
  delay(5000);
  // Step 1: RFID authentication
  if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
    Serial.println("RFID Card detected.");
    String scannedRFID = ""; // To store the scanned RFID ID

    // Build the scanned RFID ID
    for (byte i = 0; i < rfid.uid.size; i++) {
      scannedRFID += (rfid.uid.uidByte[i] < 0x10 ? "0" : "");
      scannedRFID += String(rfid.uid.uidByte[i], HEX);
    }

    // Check if scanned RFID matches the authorized ID
    if (scannedRFID.equalsIgnoreCase(authorizedRFID)) {
      // FP blue light on, RFID blue light off
      Serial.println("Welcome dear user. Please place your finger on the sensor...");
      digitalWrite(fpblue, HIGH);
      digitalWrite(rfidblue, LOW);
      // LED fully on
      finger.LEDcontrol(FINGERPRINT_LED_ON, 0, FINGERPRINT_LED_RED);
      delay(250);
      finger.LEDcontrol(FINGERPRINT_LED_ON, 0, FINGERPRINT_LED_BLUE);
      delay(250);
      finger.LEDcontrol(FINGERPRINT_LED_ON, 0, FINGERPRINT_LED_PURPLE);
      delay(250);
      // Add a small delay before the fingerprint scan