A multi-authentication embedded security system built with ESP32-S3
Features β’ Hardware β’ Installation β’ Usage β’ Simulation β’ Team
The Digital Safe System is an embedded systems project for the Introduction to Embedded Systems (25CSCI11C) course at the British University in Egypt (BUE). It implements a secure, multi-authentication locking mechanism using an ESP32-S3 microcontroller.
The system supports three authentication methods: keypad password, RFID card scanning, and Bluetooth Low Energy (BLE) remote control β all with real-time feedback via an OLED display, LEDs, and a buzzer.
| Feature | Description |
|---|---|
| 4-Digit Password | Set, change, and enter passwords via a 4Γ4 keypad with masked input |
| Dual Input Mode | Switch between numeric (KEYPAD) and character (CHAR) mode using * key |
| RFID Authentication | Register and authenticate with MFRC522 RFID cards for one-tap unlock |
| BLE Remote Control | Lock, unlock, check status, and change password from any BLE terminal app |
| Servo Latch | Continuous rotation servo physically locks/unlocks the safe door |
| Security Lockout | 4 wrong attempts triggers escalating lockout (30s β 60s β 120s β ...) |
| Master Code | Emergency recovery code (default: 0000) to override lockout |
| OLED Animations | Splash screen, loading bar, lock/unlock animations, checking progress bar |
| EEPROM Persistence | Password and RFID UID survive power cycles |
| LED + Buzzer Feedback | Visual and audio feedback for every interaction |
| Component | Model | Interface | GPIO Pin(s) |
|---|---|---|---|
| Microcontroller | ESP32-S3 DevKitC-1 | - | - |
| OLED Display | 1.5" SH1107 128Γ128 | I2C | SDA=8, SCL=9 |
| RFID Reader | MFRC522 | SPI | SS=10, RST=14, SCK=12, MOSI=11, MISO=13 |
| Keypad | 4Γ4 Membrane | Digital | Rows: 1,2,42,41 β Cols: 40,39,38,37 |
| Servo Motor | SG90 (continuous) | PWM | 18 |
| Red LED | 5mm (+ 220Ξ© resistor) | Digital | 15 |
| Green LED | 5mm (+ 220Ξ© resistor) | Digital | 16 |
| Buzzer | Active 5V | Digital | 17 |
| Bluetooth | ESP32-S3 built-in BLE | - | Internal |
ESP32-S3 DevKitC-1
ββββββββββββββββββββββββββββββββββββ
β β
β GPIO 8 ββββ OLED SDA β
β GPIO 9 ββββ OLED SCL β
β 3V3 ββββ OLED VCC β
β β
β GPIO 10 ββββ RFID SDA(SS) β
β GPIO 14 ββββ RFID RST β
β GPIO 12 ββββ RFID SCK β
β GPIO 11 ββββ RFID MOSI β
β GPIO 13 ββββ RFID MISO β
β 3V3 ββββ RFID 3.3V β
β β
β GPIO 18 ββββ Servo Signal β
β 5V(VIN) ββββ Servo VCC β
β β
β GPIO 15 ββ¬ββ 220Ξ© ββ Red LED β
β GPIO 16 ββ¬ββ 220Ξ© ββ Green LED β
β GPIO 17 ββββ Buzzer + β
β β
β GPIO 1,2,42,41 ββ Keypad Rows β
β GPIO 40,39,38,37 ββ Keypad Cols β
β β
β GND ββββ All component GNDs β
ββββββββββββββββββββββββββββββββββββ
β οΈ RFID runs on 3.3V only β never connect to 5V. Servo needs 5V from the VIN pin.
- Arduino IDE 2.x
- ESP32 Board Package by Espressif (add URL in Preferences):
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Install via Sketch β Include Library β Manage Libraries:
| Library | Purpose |
|---|---|
MFRC522 |
RFID reader |
Adafruit SH110X |
OLED display (SH1107) |
Adafruit GFX Library |
Graphics primitives |
ESP32Servo |
Servo motor control |
Keypad |
4Γ4 matrix keypad |
BLE libraries are built into the ESP32 Arduino core β no extra install needed.
- Open
src/real_hardware/DigitalSafe_A1401.inoin Arduino IDE - Select board: ESP32S3 Dev Module
- Set USB CDC On Boot: Enabled
- Select your COM port
- Click Upload
| Key | Action |
|---|---|
0-9 |
Enter password digits |
# |
Confirm / Submit |
* |
Cancel / Toggle CHAR mode |
A |
Change password |
B |
Register RFID card |
D |
Enter master code |
- KEYPAD mode (default): keys
0-9enter digits directly - CHAR mode: press
*with empty input to switch. Keys map to letters (1βA, 2βB, ... 0βJ, AβK, etc.). Press*#to return to KEYPAD mode.
Connect to "DigitalSafe_A14" using any BLE terminal app (e.g., nRF Connect).
| Command | Description |
|---|---|
PASS:1234 |
Unlock with password |
LOCK |
Lock the safe |
STATUS |
Check current state |
CHPASS:5678 |
Change password remotely |
| Credential | Value |
|---|---|
| Password | 1234 |
| Master Code | 0000 |
Wrong password Γ 4 β LOCKOUT (30s)
β Wrong again Γ 4 β LOCKOUT (60s)
β Wrong again Γ 4 β LOCKOUT (120s)
β Doubles each cycle...
During lockout, all methods are blocked (keypad, RFID, BLE, master code). The system automatically unlocks after the timer expires.
The simulation sources are not included in this repository β the Wokwi project lives on the Wokwi site. To rebuild it:
- Go to wokwi.com β New Project β ESP32-S3
- Load the production sketch
src/real_hardware/DigitalSafe_A1401.inoand add the libraries listed under Required Libraries - Adapt any hardware-only calls (see the table below), then click Play
| Feature | Real Hardware | Wokwi |
|---|---|---|
| Bluetooth | BLE (built-in) | Serial Monitor |
| EEPROM | Persistent | Resets each run |
| OLED | SH1107 (I2C) | Grove SH1107 |
| First-run setup | Yes | Skipped (defaults) |
PASS:1234 β Unlock
LOCK β Lock
STATUS β Check state
CHPASS:5678 β Change password
Digital-Safe-Embedded-System/
βββ README.md
βββ LICENSE
βββ .gitignore
βββ src/
β βββ real_hardware/
β βββ DigitalSafe_A1401.ino # Production firmware with BLE
βββ docs/
β βββ datasheets/ # Component datasheets (PDF)
β β βββ ESP32-S3.pdf
β β βββ MFRC522.pdf
β β βββ SH1107.pdf
β β βββ 4x4 Matrix Membrane Keypad.pdf
β β βββ SG90.pdf
β β βββ Buzzer.pdf
β β βββ LED.pdf
β βββ poster/
β β βββ poster_A0.pdf # A0 project poster
β βββ report/
β βββ final_report.docx # Full project report
βββ hardware/
β βββ circuit/
β βββ wiring_guide.md # Pin-by-pin wiring
βββ assets/
βββ banner.svg # Repo banner image
Two things referenced below are not stored in this repository: the Wokwi simulation project and the 3D enclosure model. See Simulation and 3D Printed Maquette.
The safe enclosure is designed in Tinkercad 3D Design with 3 printable parts. The model file itself is not stored in this repository β it lives in Tinkercad.
Print Settings: PLA, 0.2mm layer height, 20% infill, no supports needed.
Project A1401 β British University in Egypt β 2025/2026
| Name | ID | |
|---|---|---|
| Zeina Alaaeldin | 254588 | zeina254588@bue.edu.eg |
| Zainab Sabit | 257156 | zainab257156@bue.edu.eg |
| Mahmoud Samir | 257678 | mahmoud257678@bue.edu.eg |
| Sondos Alaaeldin | 250362 | sondos250362@bue.edu.eg |
| Youssef Hassan | 250498 | youssef250498@bue.edu.eg |
| Ziad Youssef | 257745 | ziad257745@bue.edu.eg |
This project is developed for academic purposes as part of the 25CSCI11C course at BUE.