Problem in PWM Block in Simulink Support Package for Arduino Hardware

16 visualizaciones (últimos 30 días)
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 comentarios
Muneer Wahbah
Muneer Wahbah el 26 de Jul. de 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 el 28 de Ag. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Jonas
Jonas el 26 de Jul. de 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 comentario
Muneer Wahbah
Muneer Wahbah el 26 de Jul. de 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

Iniciar sesión para comentar.

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by