Advertisements

DRV8825 Stepper Driver: Fast vs. Mixed Decay Current Waveforms

Herewith, a look at CNC 3018-Pro stepper motor current waveforms as a function of supply voltage, PWM decay mode, and motor speed.

The scope displays X and Y axis motor current at 1 A/div, with sensing through a pair of Tektronix Hall effect current probes:

CNC 3018-Pro - XY axes - Tek current probes
CNC 3018-Pro – XY axes – Tek current probes

The X axis driver is an unmodified DRV8825 PCB operating in default mixed-decay mode. The Y axis DRV8825 has its DECAY pin pulled high, thereby putting it in fast decay mode.

The scope timebase varies to match the programmed feed rate. Because the X and Y axes move simultaneously, each axis moves at 1/√2 the programmed speed:

G1 X10 Y10 F100 → 71 mm/min on X and Y

The motor generates minimal back EMF at slow speeds, so the winding sees nearly the full supply voltage. As described in the previous post, the basic problem arises when the current rises too fast during each PWM cycle:

V = L di/dt
di/dt = 24 V / 3 mH = 8 kA/s

The first 1:32 microstep away from 0 calls for 5% of max current = 50 mA at a 1 A peak. The DRV8825 datasheet says the PWM typically runs at 30 kHz = 33 µs/cycle, during which the current will change by 270 mA:

267 mA = 8 kA/s × 33.3 µs

Notice how the current slams to a nearly constant, much-too-high value just after the first microstep. The incorrect current level decreases with lower supply voltage, because the rate-of-change decreases and the commanded current level reaches the actual (incorrect) current sooner.

Varying the motor voltage at a constant 10 mm/min:

3018 XY - Mixed Fast - 24V - 10mm-min 1A-div
3018 XY – Mixed Fast – 24V – 10mm-min 1A-div
3018 XY - Mixed Fast - 20V - 10mm-min 1A-div
3018 XY – Mixed Fast – 20V – 10mm-min 1A-div
3018 XY - Mixed Fast - 15V - 10mm-min 1A-div
3018 XY – Mixed Fast – 15V – 10mm-min 1A-div
3018 XY - Mixed Fast - 12V - 10mm-min 1A-div
3018 XY – Mixed Fast – 12V – 10mm-min 1A-div
3018 XY - Mixed Fast - 10V - 10mm-min 1A-div
3018 XY – Mixed Fast – 10V – 10mm-min 1A-div

Note that reducing the supply voltage doesn’t change the motor winding current, because the DRV8825 controls the current during each microstep, at least to the best of its ability.

Also note that the current overshoots the target for those microsteps, even when the motor is stopped, because there’s no back EMF, so the power dissipation is too high even at rest.

Enough back EMF appears at 100 mm/min to begin tamping down the current overshoot at 24 V:

3018 XY - Mixed Fast - 24V - 100mm-min 1A-div
3018 XY – Mixed Fast – 24V – 100mm-min 1A-div

The current waveform looks good at 12 V:

3018 XY - Mixed Fast - 12V - 100mm-min 1A-div
3018 XY – Mixed Fast – 12V – 100mm-min 1A-div

The back EMF at 1000 mm/min nearly eliminates the overshoot at 24 V, with fast decay in the Y axis causing some PWM ripple:

3018 XY - Mixed Fast - 24V - 1000mm-min 1A-div
3018 XY – Mixed Fast – 24V – 1000mm-min 1A-div

Both decay modes look good at 12 V:

3018 XY - Mixed Fast - 12V - 1000mm-min 1A-div
3018 XY – Mixed Fast – 12V – 1000mm-min 1A-div

At 1500 mm/min, the highest reasonable speed for the thing, and a 24 V supply, both waveforms still look good:

3018 XY - Mixed Fast - 24V - 1500mm-min 1A-div
3018 XY – Mixed Fast – 24V – 1500mm-min 1A-div

However, the back EMF is now high enough to buck the 12 V supply, preventing the current from decreasing fast enough in mixed decay mode (top trace):

3018 XY - Mixed Fast - 12V - 1500mm-min 1A-div
3018 XY – Mixed Fast – 12V – 1500mm-min 1A-div

Tweaking the GRBL config to allow 2000 mm/min feeds shows the waveforms starting to become triangular, even at 24 V:

3018 XY - Mixed Fast - 24V - 2000mm-min 1A-div
3018 XY – Mixed Fast – 24V – 2000mm-min 1A-div

And a 12 V supply opposed by the back EMF simply can’t change the current fast enough to keep up with the DRV8825 microstep current levels:

3018 XY - Mixed Fast - 12V - 2000mm-min 1A-div
3018 XY – Mixed Fast – 12V – 2000mm-min 1A-div

Bottom line: a +12 V motor supply and DRV8825 drivers modified to run in fast decay mode look like the best setup for the 3018-Pro: good current control at low speeds with enough moxie to handle higher speeds.

I should hack the DRV8825 boards into 1:8 microstep mode to reduce the IRQ rate by a factor of four, then see what happens to the back EMF at absurd speeds.

Advertisements

, ,

  1. #1 by Vedran on 2019-08-26 - 14:05

    You might find this interesting: https://cabristor.blogspot.com/2015/02/drv8825-missing-steps.html

    He “solved” the problem by adding a few diodes in series with each coil. I tried it and it does sort of work, but as you’d expect it puts out a lot of heat. The usual suspects sell small adapter boards populated with SMD diodes which look as they could maybe dissipate enough at 100C raise :)

    I’d really like to hear your comment on this

    • #2 by Ed on 2019-08-26 - 15:07

      The diodes just burn two volts to reduce the di/dt slope and maybe tame the overshoot in those first few low-current steps at slow speeds. However, the diodes also reduce the supply’s ability to tamp the current on the other side of the sine wave, so at high speeds it’ll get ugly over there.

      Fast decay mode wrestles the current on the rising side and doesn’t have any real disadvantage on the falling side, maybe apart from some audible noise I can’t hear.

      The Allegro A4988 doesn’t have a pure fast decay mode, but the data sheet tells you to not use slow decay at slow speeds, which is what the DRV8825 does in its mixed decay mode.

      AFAICT, if you must run the motors slowly, hack the DRV8825 PCBs for fast decay mode and reduce the motor supply voltage as needed.

      Of course, being able to look at the current waveform helps a lot … [grin]

  2. #3 by Vedran on 2019-08-27 - 07:15

    I used stock DRV8825 modules with 12V on the Ultimaker and motion was always reasonably smooth and noise not horrific. On the Leapfrog machine I had to use 24V otherwise I’d need dual supplies. Just for kicks I added a switch that toggles the drivers through all three modes. Fast decay gives best positional accuracy visible when watching the carriage by naked eye and toggling the switch. I didn’t bother measuring the error compared to mixed mode but I can usually clearly see 2 thou movement and this felt like a bit more in worst conditions. Noise in mixed mode is significantly better but still way worse then on 12V Ultimaker. Slow mode was horrible and sounded like munching gravel :)

    I’d argue (at least for a printer) that positional accuracy is important at low speeds where you’re doing the actual work, not so much on G0 traverse moves so a diode trade off might make sense there. However, 12V proved to be more then enough for all 1.64A motors I have at hand at all practical speeds so reducing supply to 12V seems like the most reasonable fix… or just live in the future and use TMC drivers.

    • #4 by Ed on 2019-08-28 - 09:07

      Seems about right to me, although an SPI-configured driver requires even more problem-solving skills!

  3. #7 by Zerg32 on 2019-08-27 - 15:12

    What drivers and voltage do you use for your MPCNC ? the same DRV8825 ? do you recommend tweaking the decay mode if I use DRV8825 ?

    • #8 by Ed on 2019-08-28 - 08:16

      Feed MPCNC stepper current into the search box to get more than you really want to know! [grin]

      The MPCNC has series-connected motors requiring more voltage than the stock 12 V supply, 1:32 microstepping doesn’t make any sense, and the A4988’s standard setup works fine.

      Bottom line: it’s a completely different machine with a different setup!

  1. DRV8825 Stepper Driver: Adding a Home Output | The Smell of Molten Projects in the Morning
  2. CNC 3018-Pro: DRV8825 Drivers at the Edge of Madness | The Smell of Molten Projects in the Morning

Spam comments get trashed, so don't bother. Comment moderation may cause a delay.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s