A low-cost adaptive multi-factor lock for healthcare housing in Zimbabwe, combining RFID, fingerprint, PIN, and facial recognition on ESP32. It operates offline, stores data encrypted locally, and includes a live web dashboard offering secure, hardware-affordable access control without stable internet.
# adaptive multi-factor lock
A low-cost adaptive multi-factor lock for healthcare housing in Zimbabwe, combining RFID, fingerprint, PIN, and facial recognition on ESP32. It operates offline, stores data encrypted locally, and includes a live web dashboard offering secure, hardware-affordable access control without stable internet.
## Features
- Four independent authentication factors: RFID, fingerprint, PIN, and facial recognition (ESP32-CAM)
- Two-of-four authentication policy (minimum two distinct factors)
- Offline-first operation – no cloud dependency
- AES-256-GCM encrypted local storage (LittleFS)
- Real-time web dashboard served directly from ESP32 (WebSocket updates)
## Hardware Requirements
| Component | Model | Purpose |
|-----------|-------|---------|
| Microcontroller | ESP32 DEVKIT-1 | Main processor |
| Camera module | ESP32-CAM (OV2640) | Facial recognition |
| RFID reader | RC522 (13.56 MHz) | Contactless tag reading |
| Fingerprint sensor | R307 (optical) | Biometric verification |
| Keypad | 4×4 matrix membrane | PIN entry |
| Servo motor | MG90 (metal gear) | Physical lock actuator |
| Power supply | 5V DC with battery backup | System power |
## Pin Connections
| Component | ESP32 Pins |
|-----------|-------------|
| RC522 RFID | MOSI(23), MISO(19), SCK(18), SS(5) |
| R307 Fingerprint | TX(17), RX(16) |
| 4×4 Keypad | Rows(32,33,25,26), Cols(27,14,12,13) |
| Servo motor | PWM pin 15 |
| ESP32-CAM | Connected via UART (TX/RX) or as standalone |
## Software Dependencies
- Arduino IDE (with ESP32 board support)
- Libraries: MFRC522, Adafruit_Fingerprint, Eloquent Face Recognition, ESPAsyncWebServer, LittleFS, ArduinoJSON, WebSockets
- ## wifi conectivity
- uses wifimanager libriries
- make sure that when accessing the website the accessing device and the esp32 are connected to the same network.
- ## how to run the code
- all the files must be added in a single folder and open the lock.ino file
-