Smart Lock System Based on STM32: Hardware Selection

In the previous article

HS, WeChat public account: Ordinary Inspiration Dock, Smart Lock System Based on STM32, System Interface Design

We introduced the overall functions and interface design of the smart lock system. This section will analyze in detail the core hardware selection scheme used in the system. The hardware part is the foundation of the entire smart lock system, and its performance, power consumption, and interface capabilities directly affect the system’s operational stability and functional scalability.

1. Main Control Chip – STM32F401RET6

The core control unit of this system uses the STM32F401RET6 microcontroller. This chip is based on the ARM Cortex-M4 core, with a maximum frequency of 84 MHz, and integrates 512 KB Flash and 96 KB SRAM. It has rich peripheral interface resources and good power consumption control capabilities, making it very suitable for embedded application scenarios involving complex logic control and multi-module collaboration.

Main features are as follows:

  • Core: ARM Cortex-M4 with single-precision FPU floating-point unit

  • Frequency: 84 MHz

  • Flash: 512 KB

  • SRAM: 96 KB

  • Pin count: 64 Pin (LQFP64 package)

  • Interface resources: USART, SPI, I²C, ADC, TIM, PWM, etc.

  • Operating voltage: 1.7 V ~ 3.6 V

This chip has stable performance, low power consumption, and strong compatibility, capable of managing multiple peripheral modules (such as fingerprint recognition, RFID, touch buttons, LCD display, etc.) simultaneously, making it an ideal main control solution for the smart lock system.

2. Data Storage Module

To ensure that password, fingerprint, card information, and system parameters are not lost during power outages, the system adopts a combination of EEPROM and external Flash storage.

EEPROM: AT24C04

  • Capacity: 4 Kb (512 Byte)

  • Communication interface: I²C

  • Usage: Store system configuration parameters (such as administrator password, screen brightness, volume settings, etc.)

  • Features: Data retention during power loss, high write cycles, small size

External Flash: W25Q64

  • Capacity: 64 Mbit (8 MB)

  • Communication interface: SPI

  • Usage: Store fingerprint feature templates, voice data, UI font libraries, and other large-capacity data

  • Features: High storage density, fast access speed, long lifespan

3. Input Module

Touch Button: BSB116 Capacitive Touch Sensor

  • Communication method: I²C

  • Function: Recognize user touch operations for password input and menu selection

  • Features: High sensitivity, waterproof and dustproof, supports multi-point detection

RFID Radio Frequency Identification Module

  • Communication interface: UART/SPI

  • Function: Identify and verify registered RFID cards

  • Operating frequency: 13.56 MHz

  • Application: Card swipe to unlock, user card registration and deletion

4. Fingerprint Recognition Module

The system selects the MG200 capacitive fingerprint collector. This module can communicate with the main control via UART interface, and has a built-in algorithm chip that supports various command operations such as fingerprint registration, comparison, and deletion.

Main features:

  • Collection method: Capacitive fingerprint recognition

  • Communication interface: UART

  • Storage capacity: Supports thousands of fingerprint templates

  • Features: Fast recognition speed, high security level, strong resistance to fake fingerprints

5. Display and Voice Module

LCD Display

  • Type: Color TFT LCD

  • Communication interface: SPI

  • Function: Used to display operation interface, menus, and prompt information

  • Features: Low power consumption, lightweight, can achieve multi-level menus and graphical display with font libraries

Voice Chip Module

  • Function: Voice prompts and announcements (e.g., “Fingerprint recognition successful”, “Password incorrect”, etc.)

  • Communication interface: UART or SPI

  • Features: Built-in DAC audio output, can be directly connected to a speaker

  • Application: Enhance user interaction experience and intelligence level

6. Communication Module

The system integrates the ESP32 Wi-Fi & Bluetooth dual-mode module, enabling remote control and networking functions for the smart lock. Users can remotely unlock, query information, and manage devices through a mobile app or cloud server.

Main features:

  • Communication interface: UART

  • Supported protocols: Wi-Fi (2.4 GHz), BLE low-energy Bluetooth

  • Functions:

    • Report lock status and logs

    • Receive remote unlocking commands

    • OTA online upgrade

  • Advantages: Low power consumption, stable performance, strong compatibility

This concludes the hardware selection for our project. Next, we will start setting up the environment and writing the relevant code.

Leave a Comment