Cannot read encoder ticks that fast

I have an encoder that gives me 2150 ticks per revolution. I am trying to control the position. If the motor goes slow, it functions just fine, but I need it to go faster, when I try this, I stop reading the encoder correctly, like it's missing ticks. I am already at 0.00001s as sample time, which I think it's already quite small, but it is still not enough. Any recommendations? Thanks!

4 Kommentare

Walter Roberson
Walter Roberson am 3 Nov. 2022
You have not said anything about how you are reading the encoder, or about what kind of connection there is between the host and the encoder.
If you are trying to read individual ticks over a USB connection, then you will not be able to do that nearly that fast.
Laura
Laura am 3 Nov. 2022
I am using an STM32F4 and trying to ready it through Simulink with the Waijung Blocksets.
Walter Roberson
Walter Roberson am 4 Nov. 2022
Unfortunately I do not know anything about that blockset, other than what I see at https://link.springer.com/chapter/10.1007/978-3-031-79927-3_2
However, I see there mention of "USB to TTL serial adapter - * Rx goes to PA2 * Tx goes to PA3". That hints to me that the board itself might have an actual TTL serial port. If so, then if you could connect that to a true serial port on your host (not a TTL to USB connection) then that would have the potential to talk to the board with lower latency.
Based on what people have done with other boards such as Arduino, I would suspect that you would be better off having code running on the board that does the counting for you, only sending summary or occasional information to the MATLAB host. But I do not know that particular blockset: some blocksets are designed to be deployed to boards like these, that might possibly already be what is happening.
Laura
Laura am 4 Nov. 2022
Hi Walter, got it, this does help me. I will try that communication, see if that helps. Thank you!

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Gefragt:

am 3 Nov. 2022

Kommentiert:

am 4 Nov. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by