I was looking into the operation of a certain stepper motor driver, and probed the phase lines to see how they looked. As expected, I found that there were two 50% duty cycle signals with a 90 degree phase shift. What I did not expect to see was some high frequency PWM right before the phase change. This PWM appeared to be of constant (but not 50%) duty cycle. Can someone tell me what the purpose of the PWM here is? Evidently it must be because they don't want to drive the current into the phase all at once, but I'm unable to see why that would be a bad thing.

Any input would be much appreciated.

All four phase lines on an oscilloscope

  • \$\begingroup\$ In addition to correct answer by @linuxfan I'd like to suggest AN822 application note by Microchip. It provides more details on using PWM and higher voltage to increase slew rate as well as using PWM for microstepping. It also has a lot of free code to play with. \$\endgroup\$
    – Maple
    Dec 22, 2021 at 23:18
  • \$\begingroup\$ It doesn't really look like microstepping. Could be dI/dt limit on the current control. If it is "stepped" in the duty cycle as per description, it might be a simple but good-enough strategy to reduce overshoot on something being underdamped in the system. It would be nice to zoom in on one of the transitions in the scope screenshot. \$\endgroup\$
    – Pete W
    Dec 23, 2021 at 3:05

2 Answers 2


Stepper motors are externally-commutated motors. So the speed is controlled by the driver which varies the speed operating on how quick the phases are exchanged.

Often they also run in open loop, i.e. there is not an encoder to tell if the motor is spinning or not.

All this makes it necessary to control the current very well: at every step change, if there is too little current the motor stalls, and if there is too much current the motor wastes energy and can even have resonance which leads, again, to stall. They are also driven with a much higher voltage than what their characteristics would imply. This is because at every phase change the coil inductance limits the slope of the rising of the current but, instead, current is needed quickly.

So, stepper motors are driven by controlling current in the phases. You energize phase A(+), then B(+), then A(-) and so on, each time with a PWM or a chopper (an automatic circuit which regulates PWM in order to maintain a fixed given current).

Then there is microstepping, which signifies that the single phases (steps) are modulated with a varying current in order to create sub-steps. In this case, instead of changing from A(+) to B(+) abruptly, the change is made gradually, for example A(+100%), A(+75%) / B(25%), A(+50%) / B(+50%) and so on. (In reality it is not so simple). In this case, a scope on a single phase will see different PWMs every step.

I can't tell what is you situation, the scope diagrams you posted are not so clear to me, but I see two options. One is microstepping. The other option could be some algorithm to optimize current/torque/speed/whatever.

The fact is that stepper motors are a different beast than normal DC (brushed) motors, but they have anyway, but more more strange, the same effects: back EMF, coil inductance and resistance etc. They are simple, robust, cheap, and very problematic, and every drive may implement more or less "hidden" optimizations on how to energize the coils.

You should monitor the current, together with PWM. That could reveal (or not) why the PWM is changing. A typical cycle on a phase (when not microstepping) would reveal a high duty PWM, while the current starts to increase; when the current reaches the correct value, the PWM duty reduces in order to mantain that current. I call it PWM, but often it is instead a waveform generated by a chopper, which simply gives full voltage if the current is too low, and shorts the coil, when the current is equal or bigger than the preset value, for a fixed short time. This chopper generates a quite messy signal, also depending on what the motor is actually doing.

  • \$\begingroup\$ "You should monitor the current, together with PWM." - yep, super useful when looking into steppers... a cheap clamp-on current sense transformer on just one of the windings is often enough to learn something useful \$\endgroup\$
    – Pete W
    Dec 23, 2021 at 3:09

Stepper motors are limited as to how much current they can handle. Putting too much current through a stepper motor can cause it to overheat (and it will waste a lot of power, too).

I have a project that involves some stepper motors that are rated for 1.5 A through each phase, and the resistance of each phase is 2.4 ohms. So in order to power these stepper motors correctly, I need a mean voltage that is no more than 3.6 V (which is 1.5 A * 2.4 ohms). This will cause the motors to burn about 5.4 W of power (which is 3.6 V * 1.5 A).

However, the power supply that I'm using is actually a 24 V power supply. If I put that directly into the motor, then it would end up drawing 10 A of current, and so it would burn 240 W of power. It would produce over 40 times as much heat as it's supposed to! That would destroy the motor (and waste a lot of power, too).

Instead of doing that, the stepper motor driver will actually use PWM with about a 15% duty cycle in order to maintain a current of about 1.5 A through each phase.

  • \$\begingroup\$ ... or you can use power supply correctly sized for your motors \$\endgroup\$
    – Maple
    Dec 22, 2021 at 15:13
  • \$\begingroup\$ @Maple My power supply is correctly sized. The drivers I'm using have a supply voltage range of 8 V to 45 V. \$\endgroup\$ Dec 22, 2021 at 16:55
  • \$\begingroup\$ You missed "for motors" part, which is how power supply is normally sized \$\endgroup\$
    – Maple
    Dec 22, 2021 at 17:05
  • \$\begingroup\$ @Maple What are you suggesting, then? Are you suggesting that I get a 3.6 V (or smaller) power supply and connect it directly to the motors? \$\endgroup\$ Dec 22, 2021 at 18:52
  • 1
    \$\begingroup\$ I am suggesting that your answer is technically correct in that PWM is used to control coil current, however this is not done to accommodate oversized power supplies. In fact, higher than necessary voltage is often used with high-power steppers to increase slew rate in high inductance coils, but then you are forced to use PWM to control this rate. \$\endgroup\$
    – Maple
    Dec 22, 2021 at 23:12

Your Answer

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

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