A complete employee access control system built with STM32F401RE featuring biometric touch sensor, keypad authentication, and visual feedback.
- 🔐 Secure Access Control - Employee ID validation with authorized personnel database
- 📱 1.8" TFT Display - Real-time visual feedback with ST7735 driver
- ⌨️ 4x3 Matrix Keypad - Numeric ID entry with # to submit, * to clear
- 👆 Touch Sensor - Capacitive touch activation
- 🚨 Audio Alerts - Different buzzer patterns for granted/denied access
- 💡 LED Indicators - Green LED for access granted
- 🔓 Relay Control - Automatic door lock/unlock (10-second timer)
- 🚫 Security Alert - Continuous buzzer alarm for unauthorized access attempts
- MCU: STM32 Nucleo-F401RE
- Display: 1.8" TFT LCD (128x160) ST7735 via SPI1
- Keypad: 4x3 Matrix Keypad
- Touch Sensor: Capacitive touch sensor (PC8)
- LED: Green LED with 220Ω resistor (PC1)
- Buzzer: Active buzzer (PA4)
- Relay: 5V relay module for door lock (PB12)
- CS: PB6
- DC: PA9
- RST: PC7
- SCK: PA5 (SPI1_SCK)
- MOSI: PA7 (SPI1_MOSI)
- Rows (Output): R1=PA10, R2=PB15, R3=PB14, R4=PB13
- Cols (Input): C1=PB3, C2=PC4, C3=PB5
- Touch Sensor: PC8 (Input with pull-down)
- Green LED: PC1 (Output)
- Buzzer: PA4 (Output)
- Relay: PB12 (Output)
| Employee ID | Name |
|---|---|
| 1234 | ADI |
| 2005 | GREY |
| 2000 | DEX |
- Idle State: Display shows "TOUCH SENSOR TO START"
- Touch Activation: User touches capacitive sensor
- ID Entry: Enter employee ID using keypad (0-9)
- Press
#to submit - Press
*to clear entry
- Press
- Verification: System validates ID against database
- Access Granted (Valid ID):
- Green screen: "WELCOME [NAME]"
- Green LED turns ON
- 1-second buzzer beep
- Relay unlocks door
- Door remains unlocked for 10 seconds
- Returns to idle state
- Access Denied (Invalid ID):
- Red screen: "ACCESS DENIED"
- Continuous buzzer alarm (until reset)
- Door remains locked
Core/
├── Inc/
│ ├── buzzer.h - Buzzer control
│ ├── display_st7735.h - ST7735 TFT driver
│ ├── keypad.h - 4x3 keypad scanner
│ ├── led.h - LED control
│ ├── relay.h - Relay control
│ ├── simple_text.h - Text rendering
│ ├── system_state.h - State machine
│ └── touch.h - Touch sensor
└── Src/
├── buzzer.c
├── display_st7735.c
├── keypad.c
├── led.c
├── main.c - Main program
├── relay.c
├── simple_text.c
├── system_state.c - Core logic
└── touch.c
- Open project in STM32CubeIDE
- Build:
Project → Build All(Ctrl+B) - Flash:
Run → Debug(F11)
- STATE_IDLE: Waiting for touch sensor activation
- STATE_WAIT_ID: Accepting keypad input
- STATE_VERIFY: Validating employee ID
- STATE_UNLOCK: Door unlocked, access granted
Edit Core/Src/system_state.c:
static const Employee_t employees[] = {
{"1234", "ADI"},
{"2005", "GREY"},
{"2000", "DEX"},
{"YOUR_ID", "YOUR_NAME"} // Add here
};Edit Core/Src/system_state.c:
// Wait 10 seconds (change to desired duration in milliseconds)
while (HAL_GetTick() - unlock_timer < 10000) {- ✅ Employee ID validation
- ✅ Visual feedback for all states
- ✅ Audio alerts for access attempts
- ✅ Continuous alarm for unauthorized access
- ✅ Automatic door re-lock after timeout
- ✅ Touch sensor activation prevents accidental triggers
- RTC for timestamp logging
- SD card for access log storage
- WiFi connectivity (ESP32 integration)
- RFID card reader support
- Fingerprint sensor integration
- Web dashboard for monitoring
- Email/SMS notifications
MIT License - Feel free to use and modify for your projects!
Built with ❤️ for factory security and access control applications
⭐ Star this repo if you find it useful!