Which Arduino board (Name) can be used to read the speed directly using the Encoder block of Simulink?

Hi,
I am using Arduino Uno to read the Speed of my motor using simulink Encode block, But simulink says Uno board can not be used for Encoder block. Can somebody please tell me which Arduino Board can be used to read the speed from encoder block?

 Accepted Answer

Hi Aakash,
Which release of MATLAB are you using?
Till R2021a, the encoder block supports only encoders on motor carrier shield which is specifically for MKR boards and Nano 33 IoT board.
Supported shields:
In R2021b, support for rotary encoder was added which can be used for all encoders on all arduino boards.

8 Comments

Thanks Arun for help. I am using MATLAB R2021b version.
I wanted to ask you that is there any modification needs to be done in any part for this application?
Hi Aakash,
You can use the encoder block mentioned in the answer above in R2021b.
I didnt understand the modification question. Can you share more details?
Thanks,
Arun
Thanks again Arun for response.
I just wanted to confirm that can I use that block in simulink directly? or do I need to do anything else (e.g., library installation etc.)
Hi Aakash,
You don't need to install anything else other than Simulink support package for arduino hardware. All the required libraries are downloaded as part of the supportpackage installation.
Thanks,
Arun
I was using Matlab R2021a version with Arduino Uno. After comming across this post, I updated my MatLab to R2022b. When I deploy, it is still giving me the same motor carrier error
  • Motor carrier library block can only be used with Arduino MKR1000, Arduino MKR WiFi 1010 and Arduino Nano 33 IoT target.
Any help with this would be really helpful. Also, does it work with R2021b only like how you have mentioned? I haven't tried with that.
Hi Nagaraj,
From the error it looks like you are using encoder block from the Motor carrier library which is supported only on the boards mentioned in the error.
Please use the following block from arduino sensors library
https://in.mathworks.com/help/supportpkg/arduino/ref/encodersensors.html
Hope this helps!

Sign in to comment.

More Answers (1)

I have used Arduino due, mkr with motor driver shield and nano board for this purpose.
Due would be the best choice because of high clock frequency, which can read very very high speed also.

Categories

Products

Community Treasure Hunt

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

Start Hunting!