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.
#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