Skip to content

Repository files navigation

SMART_DOOR — STM32F103 Multi-Factor Access Control

A personal project: an electronic door-lock controller for the STM32F103C8T6 ("Blue Pill") supporting three independent unlock methods — keypad password, RFID card, and fingerprint — with an LCD UI, buzzer/LED feedback, and persistent storage in an external I²C EEPROM.

Note: built and tested on a physical demo model (mock door driven by a servo), not a production lock. See the Disclaimer below.


Features

  • Keypad password: 4-digit unlock; change password at runtime (saved to EEPROM).
  • Brute-force lockout: 3 wrong attempts → 30-second lockout with on-screen countdown.
  • RFID (RC522): tap-to-unlock; add / remove cards in admin mode.
  • Fingerprint (AS608): 2-pass enrollment, 1:N search unlock, delete by ID (up to 127 templates).
  • Admin mode: password-protected enrollment of new cards / fingerprints.
  • Servo lock: PWM-driven lock/unlock, auto-relock after 3 s.
  • Feedback: 16×2 I²C LCD status screens, status LED, buzzer patterns.
  • Debug log: human-readable trace over USART1 @ 57600 baud.
  • Persistence: password, enrolled cards, and next-fingerprint-ID survive power loss (I²C EEPROM).

Hardware

Module Interface STM32 pins
AS608 fingerprint USART2 PA2 (TX), PA3 (RX)
RC522 RFID SPI1 PA5 (SCK), PA6 (MISO), PA7 (MOSI), PA4 (SS), PA8 (RST)
LCD 1602 (PCF8574) I²C1 PB8 (SCL), PB9 (SDA)
Servo (lock) TIM1_CH2 PWM PA9
Buzzer GPIO PB3
Keypad 4×4 — rows GPIO PB12, PB13, PB14, PB15
Keypad 4×4 — cols GPIO PA10, PA11, PA12, PA15
Debug UART USART1 PB6 (TX), PB7 (RX)
EEPROM I²C1 shared with LCD

Servo timing: TIM1 @ 20 ms period (prescaler 71), lock pulse 833, unlock pulse 1833, door-open time 3000 ms — see Core/Inc/door_control.h.


Default credentials

Value Where
User password 6666 PASS_DEFAULT in Core/Inc/password.h
Admin password 9999 PASS_ADMIN in Core/Inc/password.h

Change both before using this for anything real (see Disclaimer). The user password can also be changed at runtime from the keypad; the admin password is compile-time only.


Build & flash

This is an STM32CubeIDE project (.ioc + .cproject included).

  1. Open STM32CubeIDE → File → Open Projects from File System → select this folder.
  2. Build (Project → Build, or Ctrl+B).
  3. Flash to the board via ST-Link (Run / Debug).

Regenerating from the .ioc in CubeMX will re-create the HAL init code if you change the pin configuration.

To watch the debug log, connect a USB-TTL adapter to PB6/PB7 and open a serial terminal at 57600 baud, 8-N-1.


Usage

  • Idle: tap an enrolled card, place an enrolled finger, or type the 4-digit password + confirm to unlock.
  • Admin menu (from keypad): enroll/remove card, enroll/delete fingerprint, change password — each guarded by the admin password.
  • Fingerprint delete: enter the 3-digit ID (e.g. ID 5 → type 005).

Project layout

Core/
  Inc/            module headers (pin maps, constants)
  Src/            drivers + app logic
    main.c            init + super-loop
    app_tasks.c       LED / RFID / fingerprint polling tasks
    password.c        keypad UI, password, admin flows
    fingerprint.c     AS608 packet protocol over USART2
    rc522.c           RFID over SPI1
    lcd_i2c.c         1602 LCD over I²C
    door_control.c    servo lock + buzzer + card store
    eeprom.c          I²C EEPROM read/write
Drivers/          STM32 HAL + CMSIS

⚠️ Disclaimer

This is a personal project. It runs on my specific demo hardware (STM32F103C8T6 + AS608 + RC522 + 4×4 keypad + 1602 I²C LCD + servo), but it has not been security-audited or tested beyond my own model.

  • Do not use this as-is to protect anything you actually care about.
  • Change PASS_DEFAULT and PASS_ADMIN in Core/Inc/password.h before flashing.
  • Different modules or wiring may need pin/timing changes — check the .ioc file and the per-module headers in Core/Inc/.

Use at your own risk.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages