Based on the limit control of driving stepper motor in 3D printer

Publisher:素心轻语Latest update time:2021-11-02 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

principle:

In the field of 3D printing, it is often difficult for novices to understand how stepper motors are actually driven. For example, many engineers will ask questions like "My motor is rated at 4.6V, but my printer has a 12/24V power supply. Can I use it?".


This is because most of the electronics we use every day use constant voltage variable current power supplies, and that's what we're used to. A 12V LED strip will be powered by a stable, controlled 12V, and the current draw will increase with the number of diodes (load).


Stepper motors are powered the other way around - the current is constant/controllable (more on this later), and the voltage required varies with the load. This is why 12V power supplies are replaced by 24V or even higher voltage power supplies in 3D printing - because (among other benefits) this way the printer can supply more energy to the motor, achieving higher movement speeds and better dynamics, even though the motor current remains the same.


But a typical power supply provides a constant voltage, how is it converted into a regulated, controlled current? This is the job of a stepper motor driver, such as the TMC2208.

71b6b08c-3888-11ec-82a8-dac502259ad0.png

Current regulation is achieved through a technique called PWM (Pulse Width Modulation). The voltage is switched on and off very quickly using MOSFETs so that the current floats at a desired level. But this method of current control does not work with simple resistive loads - current regulation can only be achieved when the drive coil is used in conjunction with a magnet or other coil to rotate the stepper motor.


A coil - an inductor - has an interesting property - it "slows down" the current, adding "inertia" to it. This means that if a voltage is applied, the current through the inductor does not rise immediately, but slowly. The same thing happens when the voltage is cut off - the current does not drop to 0A immediately, but decreases over time.


By the way, LEDs are actually current controlled as well - but for a simple LED strip, a single resistor is enough to regulate the current, so ultimately the LED strip can be thought of as a constant voltage device.


Actual measurement

The described current control method can be clearly seen in actual measurements:

72f01920-3888-11ec-82a8-dac502259ad0.png

The yellow curve shows the current through the motor coils, the cyan line shows the voltage being switched on/off. This measurement was taken during standby, when the motor is not rotating, but holding its position. The current is almost constant, and the voltage is regularly switched on for short periods of time and then off again. Note that this switching is happening more than 30,000 times per second!


When the motor starts moving, something interesting happens, the shape of the current waveform is no longer flat, it is a sine wave. To make the motor rotate, the current needs to change to change the excitation magnetic field, thus generating movement. This principle applies to all brushless motors. The TMC2208 is used to actively measure and regulate the current, generating a sinusoidal current shape with a set amplitude, and the effective voltage changes accordingly. The rotation speed depends on the frequency of the current sine wave.


Do not worry about fluctuations in the voltage measurement. The amplitude - seen at the bottom of the screen is more or less equal to the supply voltage we use, 32V. The RMS value is an indicator of "how much" effective voltage is delivered to the motor coils. In this case the measured/calculated value is not very precise, but it shows that at this speed we are delivering a voltage less than 40% of the nominal supply voltage.


When we zoom in, we can clearly see the peculiar properties of the inductor mentioned earlier:

74486412-3888-11ec-82a8-dac502259ad0.png

When the voltage is turned on, the current rises, but quite slowly compared to how fast the voltage rises/falls. When we turn the voltage off, the current through the coil falls, but still quite slowly. Before it gets too low, the driver turns the power on again and the current rises again.


This is basically how we keep the current at the desired level, also note that the amount of time the MOSFET switch is on (how long the voltage stays on) depends on "where" on the sine wave. When we look at a sine wave we can see areas where it changes slowly (near the top/bottom) and areas where it changes faster (near zero on the Y axis). If we want the current to follow this shape we just need to apply the voltage for longer in the "fast area" of the sine wave!

7508f646-3888-11ec-82a8-dac502259ad0.png

Small irregularities, deviations from the ideal, smooth sinusoidal shape are called ripple, and are always present when PWM is used to control coil current.


Effect of Motor Load

At this point a very important question arises - what causes the required voltage (the actual power supplied to the motor) to vary with load? That's the BEMF - a property inherent to every motor. I don't want to go into the physical details of this phenomenon in this article - simply put, the motor coils during rotation generate a "back" voltage that opposes the voltage we apply to the motor from the power supply, which is why it is called back EMF. The higher the speed (or load), the higher the BEMF we need to fight.


BEMF is affected by three main factors:

• Motor coil inductance – the smaller the better

• Set the current - the higher the current, the more powerful the motor, but so is the BEMF produced

• Speed/Mechanical Load – Of course, BEMF increases with load. This is how sensorless homing with TrinamicStallGuard works – it measures BEMF!

Practical impact of BEMF:

In the measurement below, we can see the accelerated movement and a close-up of the two areas - low speed/high speed

76b5e26a-3888-11ec-82a8-dac502259ad0.png

When the speed is still low, the motor controller still has enough headroom to regulate the current very well, so the sine wave can be considered ideal. But if we zoom in a little later, we can see that the current looks more like a triangle and the applied voltage is not very precise. That's because the controller does not have the voltage headroom to regulate the current correctly, and in fact, although the motor is still running, the sine wave will be distorted.


Now that we understand how to control a stepper motor, we can move on to the next point and answer the last question - what happens when the BEMF is so high that it approaches the supply voltage? You might guess that the motor will start to lose steps - and it does, but not immediately! Honestly, I was amazed at how well the drive and motor could handle extreme speeds. Let's take a look:

78045fe8-3888-11ec-82a8-dac502259ad0.png

This is the current flowing through the motor coils during one complete run using a 24V supply. The printer starts from rest, then accelerates at 9000 mm/s2 to 900 mm/s and finally stops. So, what actually happens? At first, the driver is able to maintain a sine wave, but later, when the BEMF approaches the supply voltage, the waveform deteriorates, as we can see above. But at this point the printer still does not reach the desired speed - soon the back EMF voltage generated by the motor is too high to make it impossible to reach the set current value, it drops until the desired speed is reached, then the amplitude becomes stable, but we no longer see a sine wave - at this point it is closer to a square wave.


These results look bad, but in reality - they turned out fine! The machine ran with this setup for over a year without problems. This is normal in high-speed applications. Of course, the torque is greatly reduced and the accuracy may not be perfect, but after deceleration, the motor returns to nominal torque and the position is accurate. 900mm/s is the maximum speed I considered safe before I started to lose steps.


I also tried to use the raw data from the oscilloscope to calculate and display the average "voltage draw" during operation.

This turned out to be a bit harder than I expected, so the results are only indicative - that's why no numbers are provided. Anyway:

78fb565e-3888-11ec-82a8-dac502259ad0.png

Both graphs show the voltage and current in "Local RMS", which is more or less the average effective value.

We can see that as speed increases, we need to apply more and more voltage until we reach a limit, at which point the current drops a bit. There are two important conclusions to draw from these graphs:

• We can never provide 100% of the supply voltage because we need to vary the current -> we need some time for it to fall.

• At high speeds we cannot provide full power to the motor.

Benefits of Higher Supply Voltage

Some of you may have realized that for most of the measurements I used a 32V, not a 24V power supply. That's true - I upgraded my machine to 32V, which is why I decided to play around with my oscilloscope and compare the two options.

Is it worth it? Definitely!

7a24371c-3888-11ec-82a8-dac502259ad0.png

With the previous settings, the waveform shape looks much better and the current amplitude is about 60% higher than before, which means better stability and higher margin before the motor starts to lose steps. On the other hand, I can print with quite high acceleration, even up to 1200 mm/s, instead of a higher safety margin! Not that it means much for an FDM printer... But I'm very happy with the result.

Summary and suggestions!

Even a few volts difference will improve the operation of our stepper motor drivers or allow us to reach higher speeds. Sometimes higher print speeds can result in reduced print quality, but this is usually not a big deal, at least we can increase the travel speed, which will not only reduce print time, but also help with retraction adjustments.

With all the knowledge we have gained, we can now more confidently choose motors for our machines. So:

Make sure the motor rated inductance and resistance are as low as possible

For a driver like TMC2208 or TMC2130, a motor rated at 1.5-1.7A should be optimal.

For TMC2209, TMC2660 and TMC51X0, a motor rated current of 2.0 – 2.5A is sufficient

Choose the highest possible motor supply voltage, but double check the ratings of your driver and mainboard!

Personally I think that in the next few years we will see more and more 36V and later 48V motherboards for reprap/commercial 3D printers, so our machines get better and better and the speeds we can take advantage of increase. The only downside is that heaters are usually designed for 24V - but maybe that will change too!

[1] [1]
Reference address:Based on the limit control of driving stepper motor in 3D printer

Previous article:Machine vision: From 1D to 3D, improving its "vision" to the greatest extent
Next article:Introduction to Sine Wave Control of Brushless DC Motors

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号