MATLAB Answers

0

Arduino - Simulnik serial data speed

Asked by Omar Perez on 21 Jun 2013
Latest activity Commented on by 111
on 6 Apr 2016
Hi all,
I want to read data from incremental encoder using arduino and simulink. I have programmed the external interrupt zero in order to get thew pulses from the encoder and send them to simulink via serial communication. It works but, it's slow, I reduced the time on block sample time in serial receive block but it's still slow. When the motor turns one revolution, simulink is stil receiving data, and after some time I get all values. How can I improve the data communication in order to get a good response in real time?
PD: I set the baud rate till the maximum value (115200 bauds) but it's still slow.

  2 Comments

You might try writing code on the Arduino itself to handle the encoder interrupts and calculations, then send updated values via Serial at say 30Hz. Your simulink model would only be updated at 30Hz, but it's likely that is sufficient.
111
on 6 Apr 2016
tank you

Sign in to comment.

1 Answer

Answer by Madhu Govindarajan on 9 Oct 2015

Have you looked at this post - http://www.mathworks.com/matlabcentral/fileexchange/39354-device-drivers. It works with the Simulink support package

  0 Comments

Sign in to comment.