Problem in PWM Block in Simulink Support Package for Arduino Hardware

조회 수: 9 (최근 30일)
Muneer Wahbah
Muneer Wahbah 2019년 7월 26일
댓글: Walter Roberson 2019년 8월 28일
I have watched many videos from MathWorks for speed controlling DC motors. I tried to use one to control a 5v DC motor. I found some thing strange in the PWM block in Simulink Support Package for Arduino Hardware. The block accepts duty cycle, thus if the input to the block is 255, the DC motor should get the full 5v and rotate with its max speed. However, when I tried, this is not what happened. the DC motor rotated very slowly.
When I used Arduino IDE and wrote a PWM value of 255 to the DC motor, it rotated with its max speed, as what should be. The problem is in the PWM block. I can't undestand why but maybe the block generates less voltage or less frequency than what should be.
Here is my code in Simulink, I tried to change the motor, the power supply and everything else... the problem is in that block. Please, can anyone help me? Has anyone else encountered the same problem?
Thanks in advance.
  댓글 수: 2
Muneer Wahbah
Muneer Wahbah 2019년 7월 26일
I also tried something different, I used a MOSFET transistor and connected the DC motor to it. I used the Digital Output block, instead of the PWM block, to switch the MOSFET on and off manually. (I used it as an electronic switch)
When the MOSFET is on, the DC motor should get its full power and rotate wit its max speed. However, when I did so, the DC motor rotated slowly. Its speed was the same as when I used PWM block with 255 input value. This is expected because the value 255 means 100% duty cycle, which also means ON all the period. However, still it is not the max speed of the motor. I checked many times by connecting the DC motor directly to the source and by using Arduino code.
Now the question is: why does the DC motor rotate slowly when its driver (or MOSFET) is being switched (on and off) by either a PWM block or a digital output block? I'm really confused!
Thanks in advance.
Walter Roberson
Walter Roberson 2019년 8월 28일
Muneer Wahbah comments
Now, I discovered that the PWM block -in the Arduino Support Package in Simulink- has no problem and it works good. The problem was in my components.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jonas
Jonas 2019년 7월 26일
Have you tried providing it with more than 255 as duty ratio? Are you sure the input needs to be an 8 bit signal (between 0 and 255)?
  댓글 수: 1
Muneer Wahbah
Muneer Wahbah 2019년 7월 26일
Thank you for the reply, but yes, I tried to provid it with less 0 values and more 255 values. But, as the block parameters says the maximum value is 255 and the minimun value is 0. Any value above 255 is considered 255. Here is the block parameter dialog:
Untitled.jpg

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by