I am trying to do a Hardware-in-the-loop (HIL) system with Arduino and Simulink but the driver of my motor (Pololu VNH5019) works at 20kHz and simulink PWM block only supports 490Hz.

I would like to read and modify the code before it is sent to the Arduino to modify this and add other libraries.

It would be that possible?

If it is not possible, there is any other visual environment (with blocs, like simulink or Xcos) to generate Arduino Code?


Simulink just supplies code for all the things you could be up to, triggered by a serial command of yours. This is very slow and I think it's obvious, that you would want a fast and slim realization of everything possible, if you attempt to do HIL.

If there is a special part you think is only easy for you with blocks, just ask right away, but it is really easy to do everything you can wish for in a few simple lines. Also this is better for you, because you really know, what's going on.

I could provide some detail code, since I'm doing HIL myself atm, but you would need to specify a bit, what you are up to.

To really answer your question: I don't know of any other visual programming tool for arduino and as stated above, my best knowledge is, that simulink uses pretty messy things. And loads them onto the board right away, right?

  • Thanks a lot, the thing is that I am developig fast HIL protyping systems.
    – fizcris
    Jun 25 '14 at 16:09
  • Thanks a lot, the thing is that I am developing HIL rapid protyping systems. For do that I am using Scilab/Xcos that provide me a serial monitor of my system in real time, about 8ms, with that i can monitor and create models of my plants to introduce controllers. Simulink is only for ensure that you can do all the project in a easy way, without programming anything. Once that you have your models and your prototype ready you start to write the code and polish it. If you didn't undertood me let me know and I will show you the projects that I am currently doing.
    – fizcris
    Jun 25 '14 at 16:17

Simulink most definitely supports higher PWM frequencies than 490Hz. I know because I have used it to generate PWMs in the 20kHz range on microcontroller boards. I suggest you post more details or screenshots of your work. Have someone help you determine where you are going wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.