This project utilizes the STM32F407VG development board and FreeRTOS real-time operating system to implement a smart lock system, featuring multiple authentication methods including PIN code, RFID, and Bluetooth, while providing remote monitoring capabilities through ESP8266 integration with a web server.
Traditional access control systems primarily rely on passwords or RFID cards, limiting convenience and flexibility. Our smart lock system addresses these issues by introducing:
- Bluetooth Remote Unlocking: Users can remotely control the lock via Android devices.
- Real-Time Logging: A website interface allowing administrators to monitor unlocking activities, including timestamps and methods used.
- STM32 Development Board × 2
- RFID Reader Module
- Keypad Module
- LCD Module
- Android Device
- WiFi Module
- Buzzer
- Bluetooth Module
The system operates on an STM32F407 microcontroller with FreeRTOS, managing concurrent tasks effectively:
- User Interaction: LCD displays, keypad inputs, RFID authentication.
- Communication Management: Handling Wi-Fi and Bluetooth modules for remote control and data transmission.
- Security Management: Logic for PIN and password verification.
-
main.c:- Contains the primary logic of the smart lock system, including setting up, changing, and verifying user PIN/passwords.
- Handles input/output operations related to keypad and LCD.
- Manages the lock/unlock state based on user authentication.
-
smart_lock.ioc:- Configuration file generated by STM32CubeMX.
- Specifies hardware configurations, such as pin mappings, peripherals (GPIO, UART, SPI, etc.), and system clocks.
- Includes FreeRTOS settings such as task priorities, stack sizes, and system timers.
-
STM32F407VGTX_FLASH.ld:- Linker script configuring the memory layout for firmware running from FLASH memory.
- Defines the memory sections and allocation for executable code, data, and interrupt vectors.
-
STM32F407VGTX_RAM.ld:- Linker script for RAM-based execution, typically used for debugging purposes.
- Similar to FLASH.ld but designed specifically to run code directly from RAM.
Follow these detailed steps to successfully set up, compile, and run the project:
- Install STM32CubeIDE.
- Ensure STM32CubeMX is installed (integrated within STM32CubeIDE).
-
Import the Project into STM32CubeIDE:
- Launch STM32CubeIDE.
- Click on
File > Import. - Choose
Existing Projects into Workspace. - Select the directory containing this project's files and complete the import process.
-
Configure Hardware Settings:
- Open the file
smart_lockby double-clicking it within STM32CubeIDE. - STM32CubeMX graphical interface will launch.
- Verify and adjust pin mappings for your specific hardware.
- Check peripheral settings (UART, GPIO, SPI, I2C, etc.) to ensure they match your setup.
- Open the file
-
Configure FreeRTOS Settings:
- Within the STM32CubeMX interface, navigate to the Middleware > FreeRTOS settings.
- Verify task configurations, priorities, and heap/stack sizes according to your application needs.
-
Generate Updated Code:
- Click the gear icon (
Generate Code) in STM32CubeMX to apply any configuration changes.
- Click the gear icon (
-
Compile the Project:
- Return to STM32CubeIDE main window.
- Build the project by clicking on
Project > Build Allor pressingCtrl+B.
-
Flash the Firmware:
- Connect your STM32F407 development board via an appropriate debug interface (e.g., ST-Link).
- Select your project, then click
Run > DebugorRun > Run As > STM32 Cortex-M C/C++ Application. - Follow IDE prompts to flash firmware onto the board.
-
Testing and Debugging:
- Use the provided launch configurations (
smart_lock Debug.launch,smart_lock.launch) for advanced debugging options. - Monitor the system behavior through the IDE debugging tools, console outputs, and connected peripherals.
- Use the provided launch configurations (

