Arduino UNO-Based Biometric and Voice-Controlled Access System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control access using a combination of a fingerprint scanner and a voice recognition module. The main controller is an Arduino UNO, which interfaces with the fingerprint scanner for biometric authentication and a voice recognition module for voice command recognition. Upon successful authentication, the Arduino controls a relay that operates a 12V solenoid lock. Additionally, the circuit includes visual indicators (LEDs) and an audible indicator (buzzer) to signal the system's status.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
Fingerprint Scanner
- A biometric sensor that captures fingerprints for authentication purposes.
Voice Recognition Module
- A module capable of recognizing pre-programmed voice commands.
KF-301 Relay
- An electromechanical switch used to control the solenoid lock, allowing for the lock to be opened or closed electronically.
12V Solenoid Lock
- An electrically-controlled lock that can be actuated by the relay to secure or grant access.
Buzzer
- An audible signaling device that can produce a tone when powered.
LED: Two Pin (red)
- A red light-emitting diode used as a visual indicator.
LED: Two Pin (green)
- A green light-emitting diode used as a visual indicator.
12V Power Supply
- Provides the necessary power to the solenoid lock.
Resistor (200 Ohms)
- A component used to limit current, often to protect LEDs or other sensitive components.
Wiring Details
Arduino UNO
3.3Vconnected to Fingerprint ScannerVCC5Vconnected to Voice Recognition ModuleVCCand KF-301 RelaypowerGNDconnected to the cathodes of both LEDs, Fingerprint ScannerGND, BuzzerNEGATIVE, and KF-301 RelaygroundD9connected to the anode of the green LED through a 200 Ohm resistorD8connected to the anode of the red LED through a 200 Ohm resistorD7connected to BuzzerPOSITIVED6connected to KF-301 RelaysignalD5connected to Voice Recognition ModuleRDXD4connected to Voice Recognition ModuleRTXD1connected to Fingerprint ScannerRXD0connected to Fingerprint ScannerTX
Fingerprint Scanner
VCCconnected to Arduino UNO3.3VTXconnected to Arduino UNOD0RXconnected to Arduino UNOD1GNDconnected to Arduino UNOGND
Voice Recognition Module
GNDconnected to Arduino UNOGNDVCCconnected to Arduino UNO5VRDXconnected to Arduino UNOD5RTXconnected to Arduino UNOD4
KF-301 Relay
signalconnected to Arduino UNOD6powerconnected to Arduino UNO5Vgroundconnected to Arduino UNOGNDNCnot connectedCconnected to 12V Solenoid Lock-NOconnected to 12V Power Supply-
12V Solenoid Lock
-connected to KF-301 RelayC+connected to 12V Power Supply+
Buzzer
POSITIVEconnected to Arduino UNOD7NEGATIVEconnected to Arduino UNOGND
LED: Two Pin (red)
cathodeconnected to Arduino UNOGNDanodeconnected to Arduino UNOD8through a 200 Ohm resistor
LED: Two Pin (green)
cathodeconnected to Arduino UNOGNDanodeconnected to Arduino UNOD9through a 200 Ohm resistor
12V Power Supply
+connected to 12V Solenoid Lock+-connected to KF-301 RelayNO
Resistor (200 Ohms)
- One resistor connected between Arduino UNO
D9and the anode of the green LED - Another resistor connected between Arduino UNO
D8and the anode of the red LED
Documented Code
#include <Adafruit_Fingerprint.h>
#include <VoiceRecognitionV3.h>
// Define pins
#define VOICE_RX_PIN 4
#define VOICE_TX_PIN 5
#define RELAY_PIN 6 // Define relay control pin
#define BUZZER_PIN 7 // Define buzzer pin
#define RED_LED_PIN 8 // Define red LED pin
#define GREEN_LED_PIN 9 // Define green LED pin
// Hardware serial for fingerprint sensor (pins 0 and 1)
#define fingerprintSerial Serial
// Create instances
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&fingerprintSerial);
VR myVR(VOICE_RX_PIN, VOICE_TX_PIN); // Voice recognition instance
// Variables
bool fingerprintAuthenticated = false;
bool voiceAuthenticated = false;
bool accessGranted = false;
unsigned long unlockStartTime = 0;
const unsigned long unlockDuration = 10000; // 10 seconds unlock duration
const unsigned long lockoutDuration = 120000; // 120 seconds lockout duration
unsigned long lockoutStartTime = 0;
bool inLockout = false;
void setup() {
// Initialize serial communication
Serial.begin(9600);
delay(100);
// Initialize relay
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, HIGH); // Ensure relay is off initially (active low)
// Initialize buzzer
pinMode(BUZZER_PIN, OUTPUT);
digitalWrite(BUZZER_PIN, LOW); // Buzzer off initially
// Initialize LEDs
pinMode(RED_LED_PIN, OUTPUT);
pinMode(GREEN_LED_PIN, OUTPUT);
digitalWrite(RED_LED_PIN, HIGH); // Red LED on as power indicator
digitalWrite(GREEN_LED_PIN, LOW); // Green LED off initially
// Initialize fingerprint sensor using hardware serial
fingerprintSerial.begin(57600);
finger.begin(57600);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) {
delay(1);
}
}
finger.getTemplateCount();
Serial.print("Sensor contains ");
Serial.print(finger.templateCount);
Serial.println(" templates");
// Initialize voice recognition module
myVR.begin(9600); // Initialize SoftwareSerial for VR module
// Load voice commands: 0-5
for (uint8_t i = 0; i <= 5; i++) {
if (myVR.load(i) >= 0) { // Load each command
Serial.print("Command '");
Serial.print(i);
Serial.println("' loaded.");
} else {
Serial.print("Failed to load command '");
Serial.print(i);
Serial.println("'.");
}
}
Serial.println("Waiting for valid finger...");
}
void loop() {
// Handle lockout state
if (inLockout) {
if (millis() - lockoutStartTime >= lockoutDuration) {
inLockout = false;
Serial.println("Lockout period ended.");
} else {
return; // Stay in lockout
}
}
// Check fingerprint authentication
if (!fingerprintAuthenticated && !inLockout) {
int fingerID = getFingerprintIDez();
if (fingerID >= 0 && fingerID <= 6) {
fingerprintAuthenticated = true;
digitalWrite(GREEN_LED_PIN, HIGH); // Green LED on after fingerprint recognition
Serial.println("Fingerprint authenticated. Please provide voice command.");
delay(2000); // Hold green LED on for 2 seconds
digitalWrite(GREEN_LED_PIN, LOW); // Turn off green LED after 2 seconds
unlockStartTime = millis(); // Record time of fingerprint authentication for voice input timing
}
}
// Check voice authentication if fingerprint is authenticated
if (fingerprintAuthenticated && !voiceAuthenticated && !inLockout) {
uint8_t buf[64];
int ret = myVR.recognize(buf, 50);
if (ret > 0) {
if (buf[1] >= 0 && buf[1] <= 5) { // Command IDs 0-5
voiceAuthenticated = true;
unlock();
beep(1); // Beep once for both authentications
}
}
// If 20 seconds pass without valid voice input, lockout
if (millis() - unlockStartTime > 20000) {
lockout();
}
}
// Check if solenoid should be closed
if (accessGranted