Problem in PWM Block in Simulink Support Package for Arduino Hardware

22 vues (au cours des 30 derniers jours)
Muneer Wahbah
Muneer Wahbah le 26 Juil 2019
Commenté : Walter Roberson le 28 Août 2019
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 commentaires
Muneer Wahbah
Muneer Wahbah le 26 Juil 2019
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 le 28 Août 2019
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.

Connectez-vous pour commenter.

Réponses (1)

Jonas
Jonas le 26 Juil 2019
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 commentaire
Muneer Wahbah
Muneer Wahbah le 26 Juil 2019
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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Arduino Hardware dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by