This project involves creating a security lock system using a Raspberry Pi 4 and various peripherals, including a 12V solenoid door lock, IR sensor, Raspberry Pi camera module, RFID scanner, and more. The system employs facial recognition and RFID technology to grant access to authorized personnel while logging unrecognized faces on a Flask website.
- Raspberry Pi 4 Model B (8GB)
- 12V solenoid door lock
- 12V relay
- IR sensor
- Raspberry Pi camera module v3
- RFID scanner
- Battery pack for solenoid
- USB battery pack for Raspberry Pi
- SD card
- Micro HDMI cable
-
Set Up the Raspberry Pi:
- Connect the Raspberry Pi camera module and configure it to work with OpenCV.
- Set up the IR sensor to detect the presence of a user.
-
Face Recognition with OpenCV:
- Implement face recognition using OpenCV. Train the system with images of allowed persons and create a face recognition model.
-
Face Recognition and Door Unlocking:
- Integrate the face recognition script with the door lock system.
- When a recognized face is detected, log the successful attempt and unlock the door by sending a signal to the relay.
-
Master Override with RFID Scanner:
- Connect the RFID scanner to the Raspberry Pi.
- Implement a script that reads RFID cards and compares the scanned RFID against a master list.
- If the master RFID is detected, log the successful attempt and open the door by activating the solenoid.
-
Logging Denied Attempts with Images:
- Modify the face recognition and RFID scripts to capture an image when an access attempt is denied.
- Save the captured image along with other relevant information to a file or database.
-
Scheduled Deletion of Old Logs:
- Implement a scheduled task to delete older log entries, ensuring efficient use of storage.
-
Flask Web Application:
- Install Flask on the Raspberry Pi.
- Create a Flask web application that displays a list of previous access attempts, including details such as timestamp, type of attempt, and associated images.
-
Serve Static Images with Flask:
- Create a folder named
staticfor storing access attempt images. - Modify the Flask app script to include the
staticfolder.
- Create a folder named
-
Run the Flask App:
- Execute your Flask app script on the Raspberry Pi.
- Access the website from your computer's web browser by navigating to
http://<raspberry_pi_ip>:5000.
-
Power Management:
- Ensure stable power sources for both the Raspberry Pi and the solenoid.
-
Testing and Calibration:
- Test each component individually and calibrate the face recognition system and RFID scanner.
-
Security Measures:
- Implement additional security measures, such as encryption for stored face data and secure handling of log information.
-
Upload Training Data Through WiFi:
- Implement a feature to upload training data for face recognition from devices connected to the same WiFi network through the flask website.
-
RFID Override:
- Incorporate an RFID override functionality, allowing authorized personnel to use RFID cards for immediate door access.
-
user Authentication:
- Require user to login when accessing the flask website.
Huge thank you to these people for their extremely helpful resources