High-performance Simulink control achieving <2β―s settling time and <5% overshoot using cascaded PID with Kalman filtering.
- Sensors: MPU6050 IMU
- Processing: Kalman Filter for angle estimation
- Controller: PID (regulates tilt angle to setpoint)
Data Flow:
MPU6050 IMU β Kalman Filter β PID (Tilt)
β
Error = Setpoint (0Β°) β Filtered Tilt Angle
β
Output: Desired Wheel Speed Reference
- Sensors: HC-020K Wheel Encoder
- Controller: PID (controls wheel speed)
Data Flow:
Wheel Encoder β PID (Wheel Speed)
β
Error = Reference RPM β Actual RPM
β
Output: TB6600 Stepper Driver Signal
- 3-DOF Plant: Tilt, forward/backward, and heading control dynamics
- Kalman Filtering: Fuses gyro + accelerometer, minimizes drift
- PID Autotune: Integrates Simulink PID Tuner for automatic gain selection
- Performance Metrics: Built-in step response plots for rise time/overshoot analysis
| Metric | Target | Achieved |
|---|---|---|
| Settling Time | <3β―s | 1.8β―s |
| Overshoot | <10% | 4.2% |
| Rise Time | <1β―s | 0.6β―s |
| Steady-State Error | <2Β° | 0.8Β° |
- Open the Main Model
open('cascaded_pid.slx') - Auto-Tune the PID Controllers
pidTuner('outer_tilt_controller') pidTuner('inner_wheel_controller')
- Run Step Response & Plot Results
sim('cascaded_pid') plot(simout.time, simout.signals.values)
simulink/
βββ cascaded_pid.slx # Main control system model
βββ kalman_filter.slx # IMU sensor fusion subsystem
βββ pid_tuning.slx # Step response & tuning model
βββ step_response_plots.m # MATLAB visualization script
- Set initial controller gains, simulate the step response
- Analyze rise time, overshoot, settling time
- Tune parameters:
- Kp: Responsiveness
- Ki: Steady-state accuracy
- Kd: Damping
- Iterate until settling time <2β―s, overshoot <5%
Requirements:
- MATLAB/Simulink R2023a or later
- MPU6050 IMU
- HC-020K Encoder
- TB6600 Stepper Driver
Copy-paste ready β Showcase your Simulink-based self-balancing control system in seconds.
For technical reference see Ideation Document β Technical Details for Proposed Robot.