3D printing guides – How steppers work and how to adjust their drivers

Learn about the way stepper motors work, what that means when using them and what i think is important when adjusting their drivers!

Resonance test

How steppers work and how to adjust their drivers

Hello everyone, i’m Tom and today we’re going to do some tuning. Particularly, of the stepper drivers. But instead of showing you some magical procedures that work for some mystical reason, i’ll also try to explain why and how those things work.

So to get started, what is a stepper motor? Well, most of all, it is a brushless, synchronous DC motor – the same basic type that is used in RC cars, planes, quadcopters and full-size electric cars. And just like most other electric motors, they rely on magnetic repulsion and attraction in the right spots to generate torque on the output shaft. If these motors only used permanent magnet, they would be stuck in a single position and if you tried to rotate them, they would generate / opposing torque to return to that position. Now, because one half of the magnets in actual # motors are electromagnets, we can control which ones attract and which ones repulse the magnets on the rotor. In our case, those are the ones that are standing still in the casing of the motor. When you apply more current to these electromagnets, they generate a stronger magnetic field and consequentially, also / more torque. If the current through the coils changes polarity, it also inverts the magnetic field, so the spots that used to attract / now repulse each other. Now, if the coils get energized and de-energized in the right sequence, that one spot the rotor wants to rest in / starts moving / and the rotor starts turning to align with that spot again. Regular brushless DC motors have a layout and accompanying electronics that are geared towards efficiency and often towards higher speeds, while # steppers are optimized for high torque and accurate positioning. Still, the only way they position their shaft is by generating torque through magnetic fields, and the closer the rotor gets to its resting position, the smaller that torque gets. Which you can easily test out on a stepper: Try rotating its shaft when it’s powered up and standing still: you’ll notice that it feels a lot like it’s spring-loaded – the harder you twist, the further it will turn. And the #higher you set the current, the #harder it will be to flex by hand as the motor generates #more torque pulling it back to its idle position. On the other hand, if you set the current too low or push too hard, you might be able to feel the motor snapping forward: that’s when it skips a steps and snaps back into place in the next spot where the magnetic fields match up again. Congratulations, your motor just skipped a step! Ideally, you don’t want that to happen when printing something, as your electronics have no idea about whether or not they motor is still at the position it thinks it is, so it has to rely on the motor running perfectly.

Now i’ve only mentioned current so far and haven’t talked about the voltages involved in driving a stepper motor, and that’s because they mostly are none of your concerns. The stepper drivers we use are all chopper drivers, so they are essentially a DC-DC converter formed together with the motor’s coils and they will limit the current the stepper sees to what they think is appropriate for the position it is trying to get to. So by itself, it will increase or decrease the voltage the motor sees to get the current it wants – and that’s really all that matters for the motor and its performance, as the magnetic fields the electromagnets inside the motor generate are directly proportional only to the current through that coil. To get to the wanted current faster, the driver will use the overhead it has from the power supply to get there faster, which is why we typically use motors that require spec-sheet voltages of around 3 volt with supply rails of 12 of 24 volt. /

Now, when you’re setting the current to your motors, there are a few things that limit the range of values that will work. The friction of your linear slides, the inertia of your moving parts when accelerating and decelerating # and possible resonances due to the springiness of the motors and belts will all require a certain amount of torque to overcome – set the current too low, and your motor will start skipping steps on faster moves / or on the second the hotend scrapes over a part of the print that somehow stuck up too far. On the other end of the adjustment range, if you set the current too high, the first thing that will happen is that your stepper driver will go into overtemperature protection. On Allegro chips, that is usually well below 2 amps without extra cooling, but on Texas Instruments DRV8825 chips, you can actually also go past the rated current of your stepper motors. Now, that’s not all too bad, because the motors can run for quite some time at a higher current, but they will eventually heat up past the softening point of your motor holders and warp those. The maximum rated temperature for most stepper motors is 130 degrees celsius, which is well past what plastic motor holders can handle. The other problem that especially the Allegro chips have at higher current is that they won’t be able to accurately move the motor to its microstep positions, which will be visible as resolution artifacts, so for example as tree rings on rounded surfaces.

So for the actual current adjustment, there are two schools of thought: One says that you should measure the driver’s reference voltage, which adjusts its output current, and set it to the exact setting you want. On the common driver board-lets, this is done by adjusting a tiny potentiometer. On more modern boards, you can control the output current precisely through software and a bunch of extra chips on your control board. The problem i have here is that you usually won’t be able to set your drivers to the rated current of your motors, which is usually at least two amps, without overheating the driver. So you compromise on a lower setting, but still don’t know if that new setting is going to work out. Plus, with different reference voltage levels and different sense resistors on the different driver boards, saying something like “you need to set your potentiometers to 0.68V” doesn’t make too much sense unless you know the exact hardware used.

So what i like to do is to go with the other school of thought and just experiment until i find a setting that doesn’t overheat the driver or introduces ripple artifacts, but still provides enough torque to keep the motors from losing steps under all conditions. As stupid as that sounds, it’s what i think is the best way to go about it, especially since you’ll have already verified the setting you want to use when you’re done adjusting. For me, that means jacking the current all the way up to where the driver just barely overheats, then backing down a good bit to leave some leeway in case the airflow changes, the drivers degrade or some other things happens that puts more stress on the drivers. Also, running them right at the edge of the overheat protection isn’t exactly good for the life expectancy of the drivers, even though they are pretty robust little things.

Once i’ve found a current setting that is low enough to be reliable, i’d start adjusting the maximum speed, acceleration and jerk settings in the firmware. Because that’s the other part of the current adjustment game – you’re basically always trying to provide enough current and torque for your little motors to master the challenges of driving a 3D printer. And while current and torque is limited, you can also make it easier for the motors by reducing the maximum speed, but also lowering acceleration and jerk values. I’ve already made a video on adjusting the speed settings, and out of those, the most important one, i think, is the acceleration setting, because that’s what determines both the dynamic load on the motor, which is what it will mostly be dealing with, but also whether or not an axis will go into resonance, and it can seriously screw up your prints and your motivation to keep printing / when your 3D printer seems to randomly lose steps on certain parts. And you’re just standing there, looking like an idiot. It’s frustrating. I’ve been there, i don’t want to be in that position again.

So do it right, test for resonances, for example with the test file linked to in the video’s description. Print that, check if an axis loses steps and adjust accordingly.

So, i don’t really know what else to talk about as far as driver adjusting goes – you know, any setting that works for you is perfectly fine. If the motor’s losing steps, lower the speed settings or increase the current, if the driver or motor overheats, lower the current. That’s it.

And even if you set the current accurately by measuring reference voltages or configuring the firmware, you still need to check if they actually work in the same way.

So, as always, thank you for watching. And thank you to everyone who has been watching my videos so far, you guys and gals have accumulated almost one million minutes of play time so far, which is pretty hard to wrap my head around, to be honest. But it also means that making videos is way more efficient for me than explaining the same topic over and over again in person. And that’s what i was going for in the first place, and i think it’s working out pretty well. To maximize the future efficiency, please subscribe if you haven’t done so already, leave a like and feel free to share this or any of my other videos with people that you think could find them useful.

Adios amigos, see you next week!

Music by UncleBibby


You can support me without spending a single penny!