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.