Skip to content

alluth-sys/SmartLock_FreeRTOS

Repository files navigation

Smart Lock System (FreeRTOS-based STM32F407VG Project)

Project Overview

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.

Motivation

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.

Hardware Components

image

  • STM32 Development Board × 2
  • RFID Reader Module
  • Keypad Module
  • LCD Module
  • Android Device
  • WiFi Module
  • Buzzer
  • Bluetooth Module

System Architecture

image

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.

Project Files Description

  • 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.

Getting Started

Follow these detailed steps to successfully set up, compile, and run the project:

Prerequisites:

  • Install STM32CubeIDE.
  • Ensure STM32CubeMX is installed (integrated within STM32CubeIDE).

Step-by-Step Guide:

  1. 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.
  2. Configure Hardware Settings:

    • Open the file smart_lock by 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.
  3. 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.
  4. Generate Updated Code:

    • Click the gear icon (Generate Code) in STM32CubeMX to apply any configuration changes.
  5. Compile the Project:

    • Return to STM32CubeIDE main window.
    • Build the project by clicking on Project > Build All or pressing Ctrl+B.
  6. Flash the Firmware:

    • Connect your STM32F407 development board via an appropriate debug interface (e.g., ST-Link).
    • Select your project, then click Run > Debug or Run > Run As > STM32 Cortex-M C/C++ Application.
    • Follow IDE prompts to flash firmware onto the board.
  7. 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.

About

An embedded system built on STM32F407VG with FreeRTOS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages