Reading rotary encoder from Arduino Mega ADK in Simulink

4 vues (au cours des 30 derniers jours)
Sertan Bitmezler
Sertan Bitmezler le 22 Jan 2021
Commenté : Arun Kumar le 22 Mar 2021
Dear Community Members,
I have been trying to read counts of an incremental rotary encoder by Simulink's Arduino Support Package. We also have an Arduino code for reading the encoder that works well. However, I want to read encoder in Simulink to develop a control system to control PWM. I attached some captures to show the Simulink model that I am using to read the encoder for your reference. (note that I used the following video as a reference https://www.youtube.com/watch?reload=9&v=FCUNFx7_Z3E&feature=youtu.be)
The whole system : https://ibb.co/Z28ZYJZ
Lower if action subsystem : https://ibb.co/wSTXGHK
Upper if action subsystem : https://ibb.co/Z68qCxb
My questions are as follows.
1) I am unable to read anything from the digital input pins of the Simulink's Arduino Support Package when I turn the encoder in any direction. I tried to read something else with that (in which I connected a led to a board, gave input from Simulink and read the output from an Arduino's digital input pin) and which worked flawlessly. So the problem is definitely reading the encoder because I cannot see any response at the initial scopes that I connected to digial input pins. Is there any other way to read encoder in Simulink or do I make any mistake in my Simulink system?
2) I also tried to used some libraries that I found in the file exhance but they did not work. Is there any thrustable libraries to do this operation?
3) On the other hand, I also tried to use Matlab's Arduino Support Package however, it did not connected to my device. Thereafter I checked comments and saw that a lot of people had the same issue. Is there any way to fix that?
Thanks in advance for your interest.
  1 commentaire
Arun Kumar
Arun Kumar le 22 Mar 2021
Hi Sertan,
Consider using external interrupt block available in Simulink's Arduino support package to capture and count the edges.
Currently encoders are not supported by Simulink support package for Arduino hardware and request for supporting the same on arduino is under consideration.
Cheers,
Arun

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Arduino Hardware dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by