<p>The gearbox approach is solid, but it will be 100x slower, and you said you wanted speed.</p>

CC BY-SA 4.0
2021-03-14T14:50:34.643Z
It will be much slower, indeed. And probably less reliable. Trying to build reasonable speed of the whole reduction setup 100:1 it would mean rotating stepper motor by two orders of magnitude. So it will have much less torque, will be probably loosing steps, and may be even impossible to turn this fast. (Otherwise with 1:100 increase, but I won't consider the impact ;) ).  Though, all this is just a remark, not a complete answer how to build a solution :(
octopus8
CC BY-SA 4.0
2021-03-13T22:46:14.420Z
2021-03-13T22:46:14.420Z
user103218
<p>You can use a magnetic position encoder.</p>
<p><a href="https://ams.com/as0548b" rel="nofollow noreferrer">AS5048B High Resolution Position Sensor</a></p>
<p>14-bit rotary position sensor with digital angle (interface) and PWM output</p>
<p>14 bit means 16k steps/rotation. With a stepper which does 200 steps/rotation and 16x microstepping, you will need only 11 bit, so you have plenty of extra accuracy you can use to filter noise.</p>
<p>You may use <a href="https://ams.com/as5600" rel="nofollow noreferrer">AS5600 Positioning Sensor</a> instead, which is 12 bits, since you don't need to track each microsteps in a closed loop, 4x is enough.</p>
<p>AS5600 in PWM mode does up to 920 Hz, AS5048 1 kHz. I'm not sure in I2C mode but surely more. Of course you have to take into account delay between measuring the position and transmission of the position.</p>

CC BY-SA 4.0
2021-03-15T11:53:55.670Z
Very interesting stuff. Would it just need to glue a flat magnet to the motor's shaft? --> found it. There are even links of recommended magnet suppliers.
octopus8
CC BY-SA 4.0
2021-03-15T12:46:23.120Z
@octopus8 I bought both boards on Aliexpress and they come with a magnet already. I guess you just need to be careful with iron parts nearby, because if they are VERY close they may distort the field and cause nonlinearity issues.
FarO
CC BY-SA 4.0
2021-03-15T13:46:29.560Z
Thanks for your answer. So I can do up to 1/64 microsteeping if it has 16k PPR. Which means 2.5 microns resolution without any error. Will this make any change in print quality compared to normal printers without an encoder?
Mahan Lamee
CC BY-SA 4.0
2021-03-15T13:50:30.467Z
Also, I don't have much information on encoders. So is it better to use absolute or incremental for this purpose?
Mahan Lamee
CC BY-SA 4.0
2021-03-15T14:10:37.593Z
No I would not step up to 64X, it's mechanically pointless because nothing in the 3D printer is accurate enough for that. 16X is plenty. Also, I guess you have not much experience with experimental measurement, but if you measure 1 mm with a ruler which has 1 mm ticks, your uncertainty will be 100%. You want the measurement tool to be much more accurate than whatever you measure. Also, those encoders have uncertainties of at least 2 bits, so 16X is already the max you can use to get meaningful data. For the rest you have to look it up, I never used them personally (yet).
FarO
CC BY-SA 4.0
2021-03-15T09:05:14.483Z
2021-03-15T12:03:21.427Z
2021-03-15T12:03:21.427Z
FarO
<p>So I was thinking of using a closed-loop motor in my 3D printer for better accuracy and high-speed printing without losing steps. I have analyzed options available including just tweaking stepper current and firmware changes to prevent step losses but I want to find the best way to do it with encoders. The problem is I need a pretty high resolution for a 3d printer and usually, high-resolution servo motors use potentiometers that are limited and not suitable for a 3d printer. I am thinking of building my own closed-loop continuous rotation servo using stepper/DC motors and encoders but I can't find any high-resolution encoder at a reasonable price. So is there any way to somehow use low-resolution encoders (like 36 pulse every full turn) or is there any encoder type that I can use for better accuracy at a reasonable price other than optical ones? Also is there any other solution for closed-loop systems at a reasonable price?<br />
Note that I am aware that I may need to modify firmware or write my own code for motors and program them from scratch.<br />
<strong>Note:</strong> You might consider this question <a href="https://3dprinting.stackexchange.com/questions/12087/closed-loop-stepper-motors">Closed-loop stepper motors</a> a possible duplicate but I have read that and my main problem is not being able to find any cheap high-resolution encoder for this purpose.<br />
<br />
Also for some reason, I can't use products like BTT S42B closed-loop stepper drives, my only option is to build them myself.<br />
<strong>TL;DR:</strong><br />
Is there any type of encoder with high resolution and cheap price for use in 3D printers? (I don't mean brand, I mean technology)</p>

CC BY-SA 4.0
2021-03-13T19:00:42.633Z
I am just asking for clarification: on one hand you say "I need a pretty high resolution for a 3d printer", and on the other you consider 36 "steps" per turn - while standard stepper motors make 200 steps (of 1.8 degree)?
octopus8
CC BY-SA 4.0
2021-03-13T19:06:12.860Z
@octopus8 The problem is exactly this. The cheap encoder pulses every 10 degrees that is so low. I had an idea in my head like a 1:100 gear reduction and attaching encoder to gearbox input part so the resolution will be 0.1 degrees. I am asking for solutions to this problem, including other encoder types and possibly any similar solution
Mahan Lamee
CC BY-SA 4.0
2021-03-14T05:23:49.013Z
Gears will have backlash, unless you can measure it you won't be gaining anything. And ironically to measure gear backlash will require an encoder ha. A high resolution encoder is your only option tbh.
FourierFlux
CC BY-SA 4.0
2021-03-14T14:55:25.690Z
What about stepper motors with attached planetary gearbox, like 3:1? Do they also have a backlash? Or maybe it is not really important, because achieved increase of resolution is still better?
octopus8
CC BY-SA 4.0
2021-03-17T08:47:21.647Z
If you're after accuracy, you're probably after quality as well. Since three to four axes need to work together in a printer, the delay of correcting a step will probably do more harm than good for print quality.
I still believe that proper drivers (e.g TMC5160) with proper steppers are a much easier way to prevent lost steps. I've had my CoreXY Direct Drive X-Axis up to 1200 mm/s at 20k mm/s^2 without lost steps.
towe
<resolution><closed-loop><servo>
What is the best way to build a closed loop continuous rotation servo for 3D printer?
Mahan Lamee
# What is the best way to build a closed loop continuous rotation servo for 3D printer?

(Asked by: username_0 on 2021-03-13)

So I was thinking of using a closed-loop motor in my 3D printer for better accuracy and high-speed printing without losing steps. I have analyzed options available including just tweaking stepper current and firmware changes to prevent step losses but I want to find the best way to do it with encoders. The problem is I need a pretty high resolution for a 3d printer and usually, high-resolution servo motors use potentiometers that are limited and not suitable for a 3d printer. I am thinking of building my own closed-loop continuous rotation servo using stepper/DC motors and encoders but I can't find any high-resolution encoder at a reasonable price. So is there any way to somehow use low-resolution encoders (like 36 pulse every full turn) or is there any encoder type that I can use for better accuracy at a reasonable price other than optical ones? Also is there any other solution for closed-loop systems at a reasonable price?  
Note that I am aware that I may need to modify firmware or write my own code for motors and program them from scratch.  
**Note:** You might consider this question [Closed-loop stepper motors](https://3dprinting.stackexchange.com/questions/12087/closed-loop-stepper-motors) a possible duplicate but I have read that and my main problem is not being able to find any cheap high-resolution encoder for this purpose.  
  
Also for some reason, I can't use products like BTT S42B closed-loop stepper drives, my only option is to build them myself.  
**TL;DR:**  
Is there any type of encoder with high resolution and cheap price for use in 3D printers? (I don't mean brand, I mean technology)

**Tags:** resolution, closed-loop, servo
> **Comments:**
> **username_1**: I am just asking for clarification: on one hand you say "I need a pretty high resolution for a 3d printer", and on the other you consider 36 "steps" per turn - while standard stepper motors make 200 steps (of 1.8 degree)?  
> **username_0**: @octopus8 The problem is exactly this. The cheap encoder pulses every 10 degrees that is so low. I had an idea in my head like a 1:100 gear reduction and attaching encoder to gearbox input part so the resolution will be 0.1 degrees. I am asking for solutions to this problem, including other encoder types and possibly any similar solution  
> **username_2**: Gears will have backlash, unless you can measure it you won't be gaining anything. And ironically to measure gear backlash will require an encoder ha. A high resolution encoder is your only option tbh.  
> **username_1**: What about stepper motors with attached planetary gearbox, like 3:1? Do they also have a backlash? Or maybe it is not really important, because achieved increase of resolution is still better?  
> **username_3**: If you're after accuracy, you're probably after quality as well. Since three to four axes need to work together in a printer, the delay of correcting a step will probably do more harm than good for print quality. I still believe that proper drivers (e.g TMC5160) with proper steppers are a much easier way to prevent lost steps. I've had my CoreXY Direct Drive X-Axis up to 1200 mm/s at 20k mm/s^2 without lost steps.  

---

## 2 answers

### Answer by username_5 on 2021-03-15. Score: 2 | Accepted answer

You can use a magnetic position encoder.

[AS5048B High Resolution Position Sensor](https://ams.com/as0548b)

14-bit rotary position sensor with digital angle (interface) and PWM output

14 bit means 16k steps/rotation. With a stepper which does 200 steps/rotation and 16x microstepping, you will need only 11 bit, so you have plenty of extra accuracy you can use to filter noise.

You may use [AS5600 Positioning Sensor](https://ams.com/as5600) instead, which is 12 bits, since you don't need to track each microsteps in a closed loop, 4x is enough.

AS5600 in PWM mode does up to 920 Hz, AS5048 1 kHz. I'm not sure in I2C mode but surely more. Of course you have to take into account delay between measuring the position and transmission of the position.

> **Comments:**
> **username_1**: Very interesting stuff. Would it just need to glue a flat magnet to the motor's shaft? --> found it. There are even links of recommended magnet suppliers.  
> **username_5**: @octopus8 I bought both boards on Aliexpress and they come with a magnet already. I guess you just need to be careful with iron parts nearby, because if they are VERY close they may distort the field and cause nonlinearity issues.  
> **username_0**: Thanks for your answer. So I can do up to 1/64 microsteeping if it has 16k PPR. Which means 2.5 microns resolution without any error. Will this make any change in print quality compared to normal printers without an encoder?  
> **username_0**: Also, I don't have much information on encoders. So is it better to use absolute or incremental for this purpose?  
> **username_5**: No I would not step up to 64X, it's mechanically pointless because nothing in the 3D printer is accurate enough for that. 16X is plenty. Also, I guess you have not much experience with experimental measurement, but if you measure 1 mm with a ruler which has 1 mm ticks, your uncertainty will be 100%. You want the measurement tool to be much more accurate than whatever you measure. Also, those encoders have uncertainties of at least 2 bits, so 16X is already the max you can use to get meaningful data. For the rest you have to look it up, I never used them personally (yet).  

---

### Answer by username_4 on 2021-03-13. Score: 1

The gearbox approach is solid, but it will be 100x slower, and you said you wanted speed.

> **Comments:**
> **username_1**: It will be much slower, indeed. And probably less reliable. Trying to build reasonable speed of the whole reduction setup 100:1 it would mean rotating stepper motor by two orders of magnitude. So it will have much less torque, will be probably loosing steps, and may be even impossible to turn this fast. (Otherwise with 1:100 increase, but I won't consider the impact ;) ).  Though, all this is just a remark, not a complete answer how to build a solution :(  

---

