
Smart Lock UNO
A multi-level authentication smart lock system utilizing facial recognition, RFID authentication, and web API control using Arduino Uno and Python.
Smart Lock UNO - Multi-Level Authentication Smart Lock š
A comprehensive security system that combines facial recognition, RFID scanning, and web API authentication to create an affordable, versatile access control solution built on Arduino and Python.
Project Overview
Smart Lock UNO was developed as a flexible, open-source prototype for secure access control. With its modular design and accessible codebase, it serves as an excellent starting point for innovators looking to build customized security solutions. The system offers a cost-effective approach to access management while incorporating advanced authentication technologies.
Key Features
Authentication Methods
- Facial Recognition: OpenCV-powered recognition using laptop/external webcam
- RFID Authentication: Contact-free card scanning with RC522 module
- Web API Control: Remote access through Flask web server
- Voice Feedback: Real-time audio notifications using PYTTSX3
- Telegram Notifications: Instant alerts for unauthorized access attempts
Technical Implementation
- Multi-threaded architecture for concurrent authentication processing
- LBPH algorithm for reliable facial feature extraction
- Secure token-based API authorization
- Shared serial connection management for efficient Arduino communication
- Intruder detection with automatic image capture
Hardware Components
Core System
- Arduino Uno R3 microcontroller
- 12V solenoid lock for physical door control
- 5V single-channel relay for power management
- RFID-RC522 module with RFID tags
- Laptop with webcam for processing and facial recognition
Circuit Integration
The system features a carefully designed circuit that connects the Arduino to various components:
-
Relay Connection:
- VCC/+ pin to Arduino 5V
- GND/- pin to Arduino GND
- IN/S pin to Arduino digital pin 2
-
Solenoid Lock Integration:
- 12V power supply positive to relay NO port
- 12V power supply negative to solenoid lock negative
- Relay COM port to solenoid lock positive
-
RFID Reader Configuration:
- SDA pin to Arduino pin 10
- SCK pin to Arduino pin 13
- MOSI pin to Arduino pin 11
- MISO pin to Arduino pin 12
- RST pin to Arduino pin 9
- Power connections to GND and 3.3V
Software Architecture
Processing Approach
The system uses the laptop for all computational tasks, with the Arduino serving primarily as an I/O controller. This approach provides:
- Enhanced processing capabilities for facial recognition
- Reduced hardware requirements for the microcontroller
- Simplified upgradeability and maintenance
Directory Structure
āāā š src
ā āāā facial.py
ā āāā website.py
ā āāā rfid.py
āāā š faces š¦š»
ā āāā š [Person Name]
ā ā āāā [Images]
āāā š intruders š§
ā āāā [Captured Images]
āāā š models āļø
ā āāā trainer.yml
āāā haarcascade_frontalface_default.xml
āāā config.py
āāā main.py
āāā train.py
Authentication Implementations
Facial Recognition
The system uses the LBPH (Local Binary Patterns Histograms) algorithm through OpenCV to:
- Extract unique facial features from images
- Form histograms representing face characteristics
- Compare detected faces against trained models
- Make access decisions based on confidence thresholds
Training data is organized by person, with each authorized user having their own folder of reference images. The haarcascade_frontalface_default.xml
classifier detects faces in camera frames, and unauthorized faces are automatically captured and saved for review.
RFID Authentication
The system implements contact-free identification using:
- An RC522 RFID reader connected to the Arduino
- Serial communication to transmit tag IDs to the computer
- Comparison against authorized card database in
config.py
- Temporary unlock triggering on successful match
Web API
The Flask-based API provides remote control capabilities:
- Token-based authorization for secure access
- Endpoints for lock control and system status
- Access to captured intruder images
- Integration with external applications
Development Process
The project followed a systematic approach:
- Requirements Analysis: Identifying security needs and hardware constraints
- Component Selection: Choosing cost-effective, reliable hardware
- Circuit Design: Creating efficient, stable electrical connections
- Software Architecture: Implementing multi-threaded processing
- Integration Testing: Ensuring reliable operation across all authentication methods
- Documentation: Providing comprehensive setup and usage guides
Future Enhancements
Planned improvements include:
- Enhanced machine learning for more accurate facial recognition
- Mobile application development for simplified management
- Biometric fingerprint integration as a fourth authentication method
- Encrypted communication between components for enhanced security
- Solar/battery backup systems for power redundancy
Impact and Applications
Smart Lock UNO demonstrates that advanced security doesn't require expensive proprietary systems. The open-source approach enables:
- Educational applications for STEM learning
- Small business security on limited budgets
- Customized access control for specific requirements
- Experimentation platform for security concepts
Technologies Used
- Arduino (Hardware Control)
- Python (Core Processing)
- OpenCV (Facial Recognition)
- Flask (Web API)
- PYTTSX3 (Voice Synthesis)
- RFID-RC522 (Contactless Authentication)
- Serial Communication
- Multi-threaded Processing