I want to add two pulse generator in simulink and dump it into arduino uno...the result i am getting is change in the frequency at arduino output what i have set in pulse generator?

47 visualizaciones (últimos 30 días)
i want to generate 0.02 (50 hz) time period pulse by adding this two pulse generator, i am getting the output from the arduino but frequncy is not 50 hz, kindly suggest
this is the pulse i want to generate at arduino output for 0.02 time period.

Respuesta aceptada

Madhu Govindarajan
Madhu Govindarajan el 12 de Feb. de 2019
Editada: Madhu Govindarajan el 12 de Feb. de 2019
The correct way would be to have one pulse generator with period 0.02 seconds and appropriate Pulse Width. Adding two blocks does not add their sampling periods, it instead adds the contents within the same sampling period.
  1 comentario
Aniket Manjare
Aniket Manjare el 13 de Feb. de 2019
Editada: Aniket Manjare el 13 de Feb. de 2019
But how can i generate this pattern of pulses at different time delay for 0.02 time period?
kindly help me to generate this pulse pattern at 50hz at arduino's output

Iniciar sesión para comentar.

Más respuestas (3)

Madhu Govindarajan
Madhu Govindarajan el 13 de Feb. de 2019
Here is what I would recommend -
1) Create a new Simulation only model and put two pulse generators both with a sampling period of 0.02.
2) Adjust the square waves as you see fit and add them up and send it to a scope.
3) Simulate this model and make changes as you see fit.
4) Once you have established you have the square wave of your choice, then bring it back into Arduino model and send it to the digital pin.
  5 comentarios
Madhu Govindarajan
Madhu Govindarajan el 15 de Feb. de 2019
Thanks for that response, it is odd that the frequency is 400 Hz. If you can share the new model that would be great, as other users can chime in with their expertise as well.
Aniket Manjare
Aniket Manjare el 17 de Feb. de 2019
For this Configuration i have got the pulse at arduino digital pin output but frequency i am not getting 50hz frequecy at DSO
I have kept the time period 0.01 so atleast i should get 100Hz, but its not

Iniciar sesión para comentar.

Madhu Govindarajan
Madhu Govindarajan el 19 de Feb. de 2019
Here is what I think is going on - the model is overrunning itself as the sample time for model is small (0.000625 or 1600 Hz). To detect and fix task overruns - https://www.mathworks.com/help/supportpkg/arduino/ug/detect-and-fix-task-overruns-on-arduino-hardware.html
You can also try deploying to hardware, which might avoid overruns sometimes (you are only reducing the scope overhead). Although I doubt it would help at this sampling rate.
  3 comentarios
MITHUN P S el 5 de Jul. de 2022
Sir Iam not able to create high frequency from matlab arduino digital out pin using simulink plss help its urgent...

Iniciar sesión para comentar.

bella risky ananda
bella risky ananda el 16 de Sept. de 2019
Hi all...I have problem set PWM frequency for SIMULINK support package of Arduino..I am using MATLAB 2017b and arduino mega2560...for the control i need a PWM signal 25000 Hz but the Simulink support package (PWM) has only 490 Hz and i can change only the duty-cycle.
What can I do? I would welcome your response. If you don't mind, can I ask for a soft file of simulink simulation as a reference for my final assignment. I still didn't understand for change pwm frequency arduino in simulink matlab.
Thank you
  2 comentarios
Arun Kumar
Arun Kumar el 25 de Sept. de 2019
Editada: Arun Kumar el 26 de Sept. de 2019
Use this Library to change frequency of PWM.
Using this library, you can configure PWM to some extent.
Request for supporting variable PWM frequnecy on arduino is under consideration.

Iniciar sesión para comentar.


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





Community Treasure Hunt

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

Start Hunting!

Translated by