Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Access Control System with Fingerprint and RFID Authentication

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Access Control System with Fingerprint and RFID Authentication

Circuit Documentation

Summary

The circuit is designed to control access through a solenoid lock, which can be unlocked by either a recognized fingerprint, an RFID card, or a certain level of sound detected by a sound sensor. The system uses an Arduino UNO as the central microcontroller to process inputs from the fingerprint scanner, RFID-RC522 module, and sound sensor. It provides feedback to the user through an LCD display, a red LED, a green LED, and a piezo buzzer. The circuit also includes a pushbutton, a potentiometer for LCD contrast adjustment, and resistors for current limiting purposes.

Component List

Microcontroller

Actuators

Sensors

Display

Input

Power Supply

Miscellaneous

Wiring Details

Arduino UNO

12V Solenoid Lock

LCD Display 16x2

Piezo Buzzer

Pushbutton

Potentiometer

LED: Two Pin (red)

LED: Two Pin (green)

12v Relay

Power Supply

Documented Code

#include <Adafruit_Fingerprint.h>
#include <LiquidCrystal.h>
#include <SPI.h>
#include <MFRC522.h>

// Pin Definitions
const int relayPin = 2; // Relay control pin
const int redLEDPin = 3; // Red LED pin
const int greenLEDPin = 4; // Green LED pin
const int buzzerPin = 11; // Buzzer pin
const int soundSensorPin = A0; // Analog pin for sound sensor

// LCD Pins
LiquidCrystal lcd(10, 9, 8, 7, 6, 5);

// Fingerprint Sensor Pins
SoftwareSerial mySerial(12, 13); // RX, TX
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

// RFID Pins
#define SS_PIN  10  // RFID SS/SDA Pin
#define RST_PIN 5   // RFID RST Pin
MFRC522 rfid(SS_PIN, RST_PIN);

// Variables
int soundThreshold = 500;  // Sound threshold for detection

void setup() {
  // Initialize Serial Monitor
  Serial.begin(9600);
  
  // Initialize LCD
  lcd.begin(16, 2);
  lcd.clear();
  
  // Initialize Fingerprint Sensor
  finger.begin(57600);
  if (finger.verifyPassword()) {
    Serial.println("Fingerprint sensor detected.");
    lcd.print("Fingerprint ready");
    delay(2000);
  } else {
    Serial.println("Fingerprint sensor not detected.");
    lcd.print("Sensor failure");
    while (1);
  }

  // Initialize RFID
  SPI.begin();
  rfid.PCD_Init();
  Serial.println("RFID ready");
  
  // Set Pin Modes
  pinMode(relayPin, OUTPUT);
  pinMode(redLEDPin, OUTPUT);
  pinMode(greenLEDPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(soundSensorPin, INPUT);

  // Lock the door initially
  lockDoor();
}

void loop() {
  int fingerprintID = getFingerprintID();
  bool rfidDetected = checkRFID();
  int soundLevel = analogRead(soundSensorPin);

  // Debugging prints
  Serial.print("Fingerprint ID: ");
  Serial.println(fingerprintID);
  Serial.print("RFID Detected: ");
  Serial.println(rfidDetected);
  Serial.print("Sound Level: ");
  Serial.println(soundLevel);

  if (fingerprintID >= 0) {
    // Fingerprint recognized
    lcd.clear();
    lcd.print("FINGERPRINT");
    lcd.setCursor(0, 1);
    lcd.print("RECOGNISED");
    delay(5000);
    unlockDoor();
  } else if (rfidDetected) {
    // RFID card detected
    lcd.clear();
    lcd.print("RFID CARD");
    lcd.setCursor(0, 1);
    lcd.print("RECOGNISED");
    delay(5000);
    unlockDoor();
  } else if (soundLevel > soundThreshold) {
    // Sound detected above threshold
    lcd.clear();
    lcd.print("SOUND DETECTED");
    delay(5000);
    unlockDoor();
  } else {
    // No valid input, keep door locked
    lcd.clear();
    lcd.print("ACCESS DENIED");
    delay(5000);
    lockDoor();
  }
}

// Unlock the door
void unlockDoor() {
  digitalWrite(relayPin, HIGH);
  lcd.clear();
  lcd.print("DOOR OPEN");

  // Activate the buzzer and green LED
  digitalWrite(greenLEDPin, HIGH);
  tone(buzzerPin, 1000); // 1000 Hz frequency
  delay(4000); // Buzzer on for 4 seconds
  noTone(buzzerPin);
  digitalWrite(greenLEDPin, LOW);
}

// Lock the door
void lockDoor() {
  digitalWrite(relayPin, LOW);
  lcd.clear();