Simulink -- > Signal processing of Quadrature Encoders via Arduino Mega 2560

7 visualizaciones (últimos 30 días)
Hi,
Previously, I has created the parameter observer simulation with Simulink included the dynamic model. For further development, now I need to replace my dynamic model in simulation with my hardware (mobile robot) by using Arduino Mega2560 board. Therefore, my objective is to obtain the crucial parameter from my mobile robot, real-time displacement and velocity via the Quadrature Encoders. The overall connection is shown in figure below.
I had tried 3 method to obtain the quadrature Encoder signal in Simulink. However the 3 method has the different issues as below. Please help if you facing these issues before or if have any idea to solve the issues below. Any suggestion is appreciated. Thanks.
1) First method: I was using the "Simulink Support Package for Arduino Hardware" to obtain quadrature encoder signal via the "external mode" in order to get the real-time signal. The issues facing is the delay happened when I set the sample time less than 0.01s and it still no small enough to acquire the correct quadrature signal as below. Moreover, this method is only support "Fixed-step" solver and my previous works all the time is using the "variable-step" solver.
2) Second method: I was using the Arduino to calculate the displacement value then send the value to simulink with "Query Instrument" block via serial com port (9600 baudrate, 0.1s sample time). The displacement is able received and the velocity is obtain by derivative of displacement value. Hence, the value of velocity is not consistent and has very high value (1e13). The actual speed is only around -15 m/s
3) Third method: I was using the "Matlab Support Package for Arduino Hardware" to obtain quadrature encoder signal. The quadrature encoder signal is able to obtain correct. However, I cannot find any method to implement it into the Simulink and the library seem like doesn't support in Simulink because there have error when I using the "Matlab function" to compile the code Quadrature Encoders library: https://www.mathworks.com/help/supportpkg/arduinoio/quadrature-encoders.html

Respuestas (3)

Marc Tison
Marc Tison el 23 de Nov. de 2018
Hi,
I have the exact same problem. Did you solve it?

Mehrdad Moallem
Mehrdad Moallem el 11 de En. de 2019
Any update on this?

Alex Vasquez
Alex Vasquez el 20 de Feb. de 2019
Hey there,
Have you used the block "MATLAB System" and create a class that does the same thing as your MATLAB Function. It is not very optimal, but it works most of the times.
  1 comentario
Jaroslaw Oskroba
Jaroslaw Oskroba el 10 de Nov. de 2019
Hi,
I would be very grateful If You could show how to implement rotary encoder function in "MATLAB System" beacuse I've tryied to do this for several days and i failed.
Thank You

Iniciar sesión para comentar.

Categorías

Más información sobre Modeling 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