For the effective movement of the platform using mecanum wheels, precise velocity control on each wheel is very important. To address this I designed and implemented a closed-loop Motor controller. This critical subsystem provided the required precision and control for the omnidirectional platform.
Block Diagram of the Motor Controller
The Motor Controller translates the high-level velocity and distance command received by the main controller using the RS485 interface to precise physical movement.
The Motor Controller has a cascaded control architecture, which contains an outer velocity loop and an inner current loop.
Outer velocity Loop
A PI (Proportional-Integral) controller compares the desired and actual velocities, which generates a current set point required to achieve the desired speed. Outer Velocity loop is operated at a frequency of 20Hz using Timer interrupts.
Inner Current Loop
Another PI controller regulates the motor current using the current set point and the current sense output from the VNH5019 motor Driver. This loop provides a fast response to dynamic changes and ensures smooth and efficient motor operation. The inner current loop is operated at a frequency of 10Hz using Timer interrupts.
A moving average filter is used in the current feedback to reduce the switching noise created by the motor Driver.
Custom PCB for the motor Controller
A 4-layer custom PCB was designed using Altium Designer.
STM32F446RE
PCB is built around the STM32 microcontroller, which includes its crystal oscillator circuit, Reset circuit, and debug interfaces.
Power Management System
Dual Power input rails to support motor and logic sections.
A 24V rail with a 1000uf Decoupling capacitor near the motor driver inputs to smooth the transient currents.
A 7V rail is used with two L7805 Linear Voltage regulators for the Microcontroller section and Motor encoder / Fans sections.
3.3V rail is obtained through 5V regulated rail using LD1117 low drop voltage regulator to supply power to the microcontroller.
VNH5019 Motor Drivers
Two Dagaya Pulse Duos are used as the Motor Drivers.
Motor Connection Interface
Screw Terminals are used for secure motor connection.
Encoder Interfaces
JST-XH 4-pin headers are used to supply power and get quadrature signals from the Motors.
Communication System
Dual RS485 transceiver implementation with UART to RS485 conversion using Rs485 differential signal drivers.
RJ-45 Connector to connect with the Main Controller.
Impedance matching using differential pairs
PCB Layout
The PCB employs a 4-layer stack-up designed under STM32 PCB design guidelines to ensure signal integrity and electromagnetic compatibility (EMC). Dedicated ground and power planes are used to minimize EMI and provide low-impedance return paths. Careful trace spacing and routing practices are followed to reduce crosstalk and noise coupling. The layout also adheres to Design for Manufacturing (DFM) rules to ensure reliable fabrication, assembly, and long-term performance.
Custom Enclosure for the motor Controller
Motor Controller Enclosure
Custom Modular enclosure designed to provide robust protection for the electronics and prevent accidental contact.
Dual integrated cooling fans ensure effective heat dissipation, maintaining optimal operating temperatures even during intensive use.