Note
This project is currently in active development. Features and documentation are subject to change.
This project aims to develop a high-precision Brushless DC (BLDC) motor controller from scratch, covering both hardware and firmware aspects. The controller is designed for advanced motor control applications, leveraging a powerful STM32 microcontroller, a dedicated motor driver IC, and comprehensive sensing capabilities for precise operation and rotor position estimation.
The core of the system is a custom two-board stack: an MCU board housing the main control logic and a power board managing motor drive and sensing.
The project is organized into logical directories to enhance maintainability and readability:
simulation/
: Contains code and files related to motor control simulation.mechanical/
: Houses all mechanical design files (CAD models, part designs).electronics/
: Stores KiCad project files for both the MCU and Power PCBs, including schematics and PCB layouts.firmware/
: Contains all the embedded software for the STM32 microcontroller.controller/
: Specific implementations of motor control algorithms (trapezoidal, FOC).common/
: Shared utilities and communication definitions across different parts of the project.
The mechanical aspects of this project are centered around integrating the custom electronics with an off-the-shelf EM3215 BLDC motor. It's important to note that, for this specific project, the motor's original windings are being utilized, and there are no plans to re-wrap the wire around the coils. The mechanical
folder contains various CAD files (FreeCAD) for components like the rotor adapter, chassis, and PCB cutouts, ensuring a perfect fit and robust assembly.
The electronics consist of two interconnected custom-designed Printed Circuit Boards (PCBs), designed using KiCad. Both boards are 4-layer designs to facilitate efficient signal routing and power integrity. A Molex PCB stack connector is used to establish a robust electrical connection between the MCU and Power PCBs.
The top PCB serves as the brain of the controller, housing the main microcontroller and various sensors and interfaces for user interaction and precise feedback.
Top Layer | Layer 1 | Layer 2 | Bottom Layer | 3D Top View | 3D Bottom View |
---|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
MCU PCB Key Components:
- STM32F4 Microcontroller: The central processing unit for control algorithms, sensor data acquisition, and communication.
- AS5048A Angle Position Encoder: Provides 14-bit absolute rotor position feedback for precise commutation and control.
- SK6805 LED Ring: A customizable visual indicator for status and debugging.
- Reset Button: For convenient system resets.
- ISM330DHCX IMU (Inertial Measurement Unit): Provides acceleration and angular velocity data, useful for advanced motion control or system stabilization.
MCU PCB v1.0 Release Package:
The bottom PCB handles the high-current motor driving functions and essential power monitoring.
Top Layer | Layer 1 | Layer 2 | Bottom Layer | 3D Top View | 3D Bottom View |
---|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Power PCB Key Components:
- TMC6300 Motor Driver: A 3-phase motor driver that translates the MCU's PWM and control signals into high-current outputs for the motor phases.
- TCAN1462 CAN Transceiver: Enables robust CAN FD communication for daisy-chaining motors in series.
- J-Link Connector: Provides easy SWD debugging and programming for the STM32 microcontroller.
- USB Connector: Facilitates direct USB Full-Speed communication for data logging, control, and power input.
- Micro-Lock Plus Connectors: Robust 4-pin Molex connectors that provide a vibration-resistant link for power delivery and CAN bus communications.
- Voltage Sensors (x4): One monitors the DC bus voltage, while three dedicated sensors measure filtered phase voltages for safe operation and FOC.
- INA240 Current Sensors (x3): Three precision analog-output current sensors enable high-speed, accurate phase current measurement for FOC.
Power PCB v1.0 Release Package:
The firmware, developed for the STM32F4 microcontroller, is the intelligence behind the motor control. It includes:
- Low-level Peripheral Drivers: Custom drivers for ADC, timers, GPIO, SPI, I2C, UART, USB, and DMA to efficiently manage hardware resources.
- Motor Control Algorithms: Implementation of both trapezoidal and Field-Oriented Control (FOC) algorithms, located in the
controller
directory, to provide flexible and high-performance motor driving capabilities. - Sensor Integration: Code to interface with the MT6701 encoder, INA239-Q1 current sensors, voltage sensor, and ISM330DHCX IMU for comprehensive feedback.
- System Utilities: Logging, error handling, and platform-specific configurations for the STM32 environment.
The firmware architecture and design decisions will be documented in the future.
The simulation
directory contains resources for simulating the BLDC motor system and visualizing the sensor data in real time. This allows for testing and validating control algorithms and system behavior in a virtual environment before deployment on the hardware. The bldc.atta
file can be opened with Atta, and it implements a basic motor model simulation and plotting of sensor data.
Instructions on how to run the BLDCM simulation with Atta will be added in the future
Below are some pictures/videos taken during the development. The controller design and calibration procedures will be explained in depth in the future :)
doc_2025-06-03_18-25-15.mp4
This project is licensed under the MIT License - check LICENSE for details.