Adaptive PID Controller For DC Motor Speed Control

조회 수: 30 (최근 30일)
Mnh
Mnh 2025년 10월 11일
댓글: Umar 2025년 10월 15일 12:53
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일 6:01

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일 12:53

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일 8:22
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 CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by