A real-time DC motor speed control system using PID algorithm on STM32F4, monitored via a Qt C++ PC application.
- PID Control: Real-time speed stabilization with adjustable Kp, Ki, Kd parameters.
- Visual Monitoring: Live speed plotting, dashboard, and status indicators.
- Fail-Safe Mechanism:
- Independent Tx/Rx connection check.
- Auto-Stop: Microcontroller automatically stops the motor if the connection is lost for more than 3 seconds.
The system uses UART (ASCII Strings) for data exchange.
| Command | Description | Example Data |
|---|---|---|
C_ALV |
Keep-alive signal (sent periodically) | C_ALV |
M_STR |
Start motor with parameters | M_STR [Kp] [Ki] [Kd] [SP] |
M_STP |
Stop motor immediately | M_STP |
M_INV |
Reverse motor direction | M_INV |
M_FRE |
Set PWM Frequency (Hz) | M_FRE 1000 |
| Command | Description | Example Data |
|---|---|---|
S_ACK |
Connection Acknowledge (Rx OK) | S_ACK |
E_LST |
Error: Connection Lost (Tx Broken) | E_LST |
M_PLT |
Real-time speed for plotting | M_PLT 120.5 |
- Flash firmware to STM32 using Keil C.
- Connect hardware wiring and plug in USB-TTL.
- Run the GUI Application on PC.
- Select the correct COM port and click CONNECT.
- Enter PID parameters (Kp, Ki, Kd) & Setpoint, then click START.