Can not Autotune PID controller for DC motor with Arduino feedback speed through encoder

5 views (last 30 days)
First I wanted to control speed of 4 DC motors for a robot with 4 Mecnum wheels, But i faced the problem of analog world which is the speed of each dc motor differs from the other so the robot could not move with the correct path i want (specific speed in direction with angles). So i decided to control each motor with a digital IR encoder and PWM channel from arduino with PID but i can not find the correct values of Kp, Ki, Kd to control the motor so after some search i found PID autotuner (closed loop - open loop) but after integreating each of them in simulink it tells me always the tuned gains are not ready so what should i do to FIND MY KP, KI, KD.

Answers (1)

MULI
MULI on 22 Jan 2025
Edited: MULI on 22 Jan 2025
To find the correct PID gains for your system using Simulink's PID Autotuner, you can follow these steps:
  • Before starting the tuning process, make sure your system is running in a stable state. If needed, manually set approximate PID gains (e.g., just proportional gain) to help the system stabilize.
  • If you are using serial communication, double-check that the signals, like encoder data, are being transmitted and received correctly in Simulink. Any data loss or mismatched sampling rates can interfere with the tuning process.
  • If the encoder signal (y) is noisy, add a low-pass filter before connecting it to the PID Autotuner block. Noise can interfere with accurate tuning.
  • Configure the PID Autotuner Block using the following:
Bandwidth: Set a range such as 10–50 rad/s, depending on the desired speed of your motor's response.
Transient Behavior: Use "Moderate" or "Slow" to ensure smooth tuning and avoid aggressive oscillations.
  • Once the PID Autotuner gives you the gains, test them in your model. If they don't give the expected performance, try adjusting the bandwidth or transient behavior settings and retune.
You can refer to following links related to PID autotuning:

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!