Adaptive PID Controller For DC Motor Speed Control

11 ビュー (過去 30 日間)
Mnh
Mnh 2025 年 10 月 11 日
コメント済み: Umar 2025 年 10 月 15 日
I am currently working on a project titled “Speed Control of a DC Motor Using an Adaptive PID Controller.” However, during the control process, I have encountered several issues that cause the motor to operate unstably. Specifically, the plant does not closely follow the reference model at low and medium speed ranges. Therefore, I would like to ask if anyone has a Simulink diagram related to this topic that I could refer to.
  4 件のコメント
Umar
Umar 2025 年 10 月 15 日

Hi @Mnh,

This will take some time to figure out the root cause. Let me review it carefully and I will get back to you. Hope you are not in rush.

Umar
Umar 2025 年 10 月 15 日

Hi @Mnh,

Thanks for your patience. I went through your code thoroughly and did some extensive research on this error. The root cause is that your 30ms sample time is too fast when combined with real-time plotting and encoder communication - the Arduino can't keep up with the data requests, which is why you're getting the "unable to receive data" error at the readCount() line.

The main issues are: (1) T = 0.03s is too aggressive for this complexity, (2) updating 6 animated plots every cycle creates massive overhead that conflicts with hardware timing, and (3) Arduino Uno's limited 2KB RAM struggles when running RotaryEncoder library with intensive operations.

Quick fixes that should solve it: increase your sample time to T = 0.05 or 0.06, reduce plotting frequency by only updating plots every 5 iterations instead of every cycle (add a counter), and wrap your readCount() in a try-catch block for error handling. Also make sure Arduino IDE is closed when running MATLAB since they can conflict on the serial port.

The timing pressure is what's killing the communication.

サインインしてコメントする。

回答 (1 件)

Sabin
Sabin 2025 年 10 月 13 日
Without a sample model we can not really point to any specific problem. You can start building the simulation model using existing examples in Simscape Electrical. This example shows a cascade speed-control structure for a DC motor:
Simscape Electrical also provide a discrete-time PID-based model reference adaptive control that can be used in the example I mentionded:

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by