Choice of rotary encoder: problem with shift over time

Hey guys,

im planning to build a belt driven, inverted pendulum and control it with MPC. Two measure the position of the cart im planing to use a rotary encoder on one of the axis of the belt drive. I thought about using a normal AB rotary encoder since it seems they are easy to use and simpler to work with for example somthinh like this:

Since the application will run over 5 hours im afraid that i will experience shifting over time so the position becomes more and more inaccurate. At our university i found this ABZ rotary encoder:

From a quick research, it seems as if those encoders are way harder to work with. What do you think i should choose?

The first one probably needs a pullup network but the second one i got the NPN+PNP output version so its more plug in play.

Thanks in Advance!!!

Why would 5 hours do that?

If something goes wrong using those fast controllers it will go wrong in seconds.

Search for similar projects and find out what devices they used.

You could try an absolute encoder.

1 Like

Perhaps, if there are errors in your code.

1 Like

From your description I assume that from start to end the axis controlling the encoder will turn multiple times. In that case, even with an absolute encoder, you can't know the position after power up. You'll need at least one end switch to get an absolute position.

In industrial applications often end switches are applied at both ends, and the encoder is used for speed control, to brake before it hits the end, or to create intermediate stops. Missed pulses, though rare with carefully built circuits, can automatically be corrected.

1 Like

I will train the MPC with reinforcement learning and the learning will take place in the real world. And that will take aproximately 5 hours:)

In times of CHATGPT and DEEPSEEK i think code errors will be minimized

But as long as i always start the cart in the middle of the rail and tell the encoder that it is always at point 0 when it starts then the encoder should now the exact postion until the application shuts down or?

Thanks for the fast replies guys!

Surely you are joking.

2 Likes

Of course i am:) I dont think that code will be the issue. The code is not really complicated and there are many books, videos and posts in this forum about it. Im afraid that the Hardware glitches/shifts.

Not an issue with professional circuit design and high quality equipment. However, a hobbyist should worry about using cheap junk purchased from Alibaba or Amazon.

For those who are interested: i chose the CALT Encoder. Code with the help of this forum wasnt complicated and i do not experience drifting!