I was planning on 3D printing my own 30 cm stroke length 3D printed linear actuator and I don't know how I could read its position, or tell it to go say to 16.5 cm. I used this video, 3D Printed Linear Actuator??? Surprisingly Strong!, as reference


The problem is, the guy in the video is using only 2 mechanical endstops, which won't work for accurate positioning or anything between 0 and 30cm. Not only that, but since my actuator needs to be strong I will have to print a planetary Gearbox of 10:1, which means the input and output shaft will have completely different rotations, and thus positions!

I looked into Absolute Magnetic encoders and found this video of the AS5600, Measuring speed and position using the AS5600 magnetic encoder. And I had two problems:

  1. What happens if the rotation goes beyond 360 degrees? Does it go back to 0?

    And it turns out it keeps incrementing the value as shown in the video, so it won't go back to 0.

  2. BUT what if we cut the system power? Will its position be remembered? Say it was at rotation position 1053.2, will it go back to 0 when the power comes back? This will lead to losing the position data!

The solution I thought of

So if the position is not lost at power off, then calculating the position of the gearbox output shaft would be very simple:

Output Angle = Input Angle / Reduction Ration % 360

(If I got it right)

And it would be as easy as mounting the encoder on the back of the driver motor!

Is this right? Does the encoder remember the position even after the power off? Do you guys have experience with any absolute encoder that can do that, and NOT return to 0 once it reached 360 degrees?

  • $\begingroup$ the encoder does not need to "remember" anything ... use NVRAM for that $\endgroup$
    – jsotola
    Commented May 9, 2023 at 6:20

1 Answer 1


In a linear actuator usually there is a stepper motor or a DC brush(-less) motor. Together with an appropriate encoder you can measure its position deviation from the initial position on start-up.

Issue Comment: Even if you have multiple different gears, the input/output ratio of the gear combination will always be predictable and can be described as a (mostly linear) function. Hence to compute the actual position of the piston you just have to transform the deviation measured on the rotational motor based on this function. It takes a little paperwork if your gearbox is complicated but it should definitely be possible.

Comment 1.: In most cases this is done after reading the registers of encoder and handled in low-level software. For example if you are using an Arduino to read your encoder, you could handle this in your main.c code to account for overflow.

Comment 2.: The simplest and I assume the method used the most is to do a calibration on start-up. This means that you move your actuator to the max or min limit and set the origin point there.

In some cases you need to know which was the last position. This position can be stored in a NVRAM, as mentioned in one comment. This memory is kept even if there is no power. Just be aware that if you move your linear actuator when power is off, this will not update the NVRAM!

An alternative which knows the exact absolute position at all times is to use a closed loop encoder. This means that there is some feedback loop from a measurement method in the encoder or the motor. If you really need this feature there are for sure systems which can offer you a closed loop encoding. However, since this requires more technical affinity, these products will usually be more expensive.

I hope this answers some of your doubts and gives you some ideas to approach the problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.