Protect Your Drivers When The Motor Stalls

The circuit, assembled on a purple PCB, with a large capacitor and a sizeable white resistor, wires soldered to holes in the PCB

[Mark Rehorst] tells us about a tragic incident involving an untimely demise of $200 worth of motor driving hardware, and shares a simple circuit so that we can prevent such tragedies in the future. His Arrakis sand table project has quite a few motors involved, and having forgotten to add limits into the software, he slammed a motor-driven mechanism into a well-fixed part of the table. The back EMF of the motor created a burst of energy, taking out the motor driver, the controller board, and the power supply.

With the postmortem done, he had to prevent this from happening again – preferably, in hardware. Based on a small appnote from Gecko Drives, he designed a simple PCB that shunts the motor with a high-power resistor, as soon as the current starts flowing into a direction it’s not supposed to flow into. He goes in depth about the way that the circuit works and the reasoning behind parts selection, as well as shows an LTSpice simulation and shares the PCB files. This was his first time designing PCBs in KiCad, and we believe he’s done a great job! This worklog is certainly worth reading if you’d like to understand how such circuits work and what goes into building one.

He dubs this a “bank account protection” circuit, and we can absolutely relate. It’s not just CNC tables that need such protections of course – we’ve seen a solution for small hacky makeshift electric vehicles, for instance. A motor’s generative properties aren’t always a problem, however – here’s just one example of a hacker trying to put them to good use.

We thank [P-Storm] for sharing this with us!

46 thoughts on “Protect Your Drivers When The Motor Stalls

  1. When I was building RobotWars robots I found that a beefy bridge-rectifier module could be used to protect motors and drivers. I think that this only works with battery-powered devices, though, where you can dump the excess energy back into the batteries.
    You just connect the motor cables to the AC inputs and the battery to the DC outputs. In normal use the battery voltage is higher than the voltage at the motor (due to the forward voltage of driver components if nothing else) but if there is a lot of back-emf then that get clamped to the motor voltage.

    I was running single-phase rectifiers with DC motors, but this should also work with three-phase bridges and motors.
    I am unclear without drawing myself a picture whether this would work with two bridges and a stepper, but I think it would.

    This wouldn’t help in the application described here, as the PSU can’t absorb power like a battery will, I am mentioning this only as an additional option usable in some cases.

      1. That’s a much better circuit than the gecko drive one. Gecko puts a diode in series with the motor, which always carries the full motor current and this is quite a waste of energy. Letting the smoothing capacitors accumulate a bit of voltage and then only shunt current around them when this threatens to become excessive is a much neater solution.

        1. Such diodes are usually specified anyways with SMPS current sources, because they don’t take reverse current well.

          I’ve had a few cases where despite having twice the specified minimum input capacitance, the power supply would still shut down to fault mode because of residual voltage spikes reflecting back whenever the motors were slowing down. It would take it a few times and then randomly just cut off.

    1. A TVS (if we are talking about the 2 leg passive type) can’t handle this amount of energy. Those are designed for short (nanoseconds to maybe a millisecond) pulses. A motor breaking can take multiple seconds, a simple TVS will just overheat/melt.

      1. If your motor is breaking, then you did something wrong.

        If you’re actually performing motor braking (not just catching spikes like this device does), then you need to use a dump resistor, and any decent driver will include provision for one.

        A TVS is perfect for these sorts of spikes. If it’s melting, you didn’t do your engineering very well. They are available in quite large sizes: 10 watt power, or kilojoule energy devices are about the same cost as a power resistor. If you need more power, it’s easy to augment with a transistor.

          1. Righto. Not decent drives then. Got it.
            But they have internal overvolt clamps at 65V. If you have stuff connected to the same power line that feeds these drivers, and that stuff can’t take the potential 65V spikes, then *those things* are the sacrificial circuit elements…

            The inputs to those drives are optoisolated. That should be a hint.

            Other drives in the same category (like Applied Motion Products) counsel you to put a overvoltage protector (energy dump) on the power line if you intend to drive loads that have potential to need braking. It’s essentially what you implemented, but even simpler: a power Zener (or TVS).

            Simple solution: Put the drives on their own power supply. Put the stuff that can’t tolerate the spikes on their own supply.

        1. What is the 10W power, 1kJ energy TVS device you’re thinking of (do you have a manufacturer and or part number)? Littelfuse has a lot of parts with high peak pulse power ratings ratings, but only at very short (10us) pulses and a very low duty cycle (and no joule rating).

          Doing some testing with electric braking of a few hundred W brushed DC motor, Littelfuse TP1.5KE16A parts blow molten solder after 10’s of joules over a couple hundred milliseconds despite being rated for 1500W (here’s a nice picture, if you’re interested
          We have a rather nice new Epilog laser cutter with 3 phase brushless drive motors. The rather nice looking motor drivers it uses rely on a stand-alone resistive dump load with a controller that seems similar to the one in the article. (… a voltage spike sensor with a semiconductor switch to control a power resistor). The dump load is from the same manufacturer as the motor controllers. If you’re braking a few hundred watts of power for hundreds of ms, presuming you don’t have a mechanical brake or a battery to dump the energy into, I think a centralized dissipative load that looks for the voltage spike that energy produces can make sense. I actually developed this line of shunt regulator products that do that:

          1. Correct. My misrecollection. I use the bigger brother equivalent of those Littelfuse devices, from Bourns: The 15KPA series steady-state rating is 8 watts, and can tolerate 4kW for a 60 Hz half-cycle (8 ms), 32 J (not kJ).

            And you’re right: A TVS is not appropriate as a dissipative load dump. They really are good for suppressing fast spikes, not dumping bulk power.

            Conversely, an active load dump circuit is great to absorb excess energy, but they are not appropriate to suppress fast spikes.

  2. When stopping the motor by reducing the step-frequency like shown in the video there is back EMF generated by the motor coils. This may destroy the power supply. When driving the motor into a mechanical endstop this should not be the case as all mechanical energy will be converted into heat by deforming the mechanism. This circuit will not protect driver or power supply in this condition, I think.

    1. Right? If hitting the wall means the motor stops dead, the emf should drop to zero, too, as emf depends on the spin rate.

      I though back emf was more about scenarios like you got your system up to speed and decide to stop sending it power, but the motor’s still spinning, any momentum of the moving parts supplying energy to keep that motor spinning, and causing it to act as a generator, maintaining the emf, which would initially be just a hair less than the applied power.

      1. Since stepper motors are essentially synchronous AC motors, you can sometimes run them into mechanical oscillations at speed. It’s like a cyclist on a fix bike without a freewheel hub: if you lose the correct pace, the bike will start to pedal you.

        You can destroy the drive by finding a mechanical resonance frequency where oscillations start to grow naturally until the motor slips out of phase with the drive and starts to slam against it like the bike on the rider. The generated back-EMF grows with the oscillations, which can make it many times larger than the input voltage.

        Likewise, when you slam things really hard to a stop, metal to metal, it’s a mechanical impulse that tends to excite all resonant frequencies in the system and the motor rings like a bell until the energy is spent.

    2. Something blew the power supply and other connected electronics, and the most obvious event was the sudden stop with the motor spinning at about 3k rpm. Energy stored in inductors (motor coils) gets dumped back on the supply lines through the transistors in the driver.

      This circuit will not protect the motor drivers in these particular motors but the drivers seem to be able to protect themselves. With these motors, the protection is for the power supply and any other electronics that are connected to it. I suspect an old-school analog power supply with a lot of capacitance might be able to absorb the surge but how much capacitance is enough?

      1. Still the stated reason cannot be correct. When the motor stops by external reasons, there is no back-EMF generated because the stored kinetic energy is spent elsewhere. The energy stored in the inductors does get dumped back, but that’s a relatively small amount and is well absorbed by the input capacitors. Drive manufacturers specify a minimum amount specifically for this reason.

        The app-note too is talking about a situation where the motor controller is itself doing a hard-stop by reversing the power supply at speed, which causes a large dump of current back, which does not fit in the input capacitors.

        In order to get energy back out of a hard mechanical stop would require that there is some sort of a bounce or “reflection” that reverses the motor, causing the same condition. You can imagine if you run a heavy duty lead screw into a jam at very high speeds, and things don’t explode into pieces, the drive shaft gets twisted in a millisecond and then uncoils back just as fast. The motor basically goes BING! and oscillates until the kinetic energy is spent.

    1. I was using a Duet2 WiFi 3D printer controller board which ignores endstop switches once homing is complete, so extra limit switches wouldn’t have helped. Also, at 2000 mm/sec, how far do you put the switch from the end of travel so you’ll have time to decelerate the motion before it gets to the end of travel? In my table that would drastically reduce the drawing area.

      1. Your Duet ignoring endstops after homing is a configuration issue. If configured ‘correct’ Duet or better RepRapFirmware is well capable of reacting on endstops even after homing.

  3. I run servo Geckodrives. They are good for 80volts but only running 36volt linear power supply with big capacitor bank. Plenty of headroom available in case of sudden stop. Has happened a number of times over the years. The running into clamp while rapid, slamming into part due to gcode mistake, forget to set Z axis zero etc. The servo drivers still going strong.

    I’ve blown up stepper drivers in the past by running voltage near driver max and unexpected deceleration. Had a argument on Reddit with someone who said this wasn’t possible. Ya well it happens.

    Bench testing a Trinamic stepper driver at max voltage and spinning a motor at nearly 6000rpm. Motor suddenly stalled due to high step pulse rate and chip blew its top off. Nice magic smoke was let out. Trinamic are very nice stepper drivers and perform much better than many others.

    1. If the motor stops while your PS is still trying to drive it, the motor emf drops to about zero, and you may as well be trying to drive a simple piece of wire with the same resistance as the motor. I.e., this seems more like an over current situation than a back-drive one.

        1. The energy in the motor inductance is very small compared to the mechanical energy stored in the rotating rotor. These are two very different things.
          In a 200 step/rev stepper motor the current through the motor windings is reversed 100 times for each revolution of the motor during normal operation, and this energy can easily be dumped back into the power supply without any problem. (but the circuit has to have the flyback diodes to handle this safely, just like with a relay)

          It only is a real problem if the mechanical energy of the rotor is dumped back into the power supply. That can dump enough energy into the electrolytic capacitors of the power supply to raise them to an unacceptable limit.

          This is also where the Hackaday article is misleading and [Mark Rehorst] explains it wrongly in his video. If the motor is stopped by some mechanical way, this energy is dumped elsewhere and not put back into the power supply. These are two quite different situations.

          1. In a very hard stop, the kinetic energy does not instantly go away, but instead will cause the motor to oscillate backwards and forwards with the motor shaft acting like a twisted spring, and the rotor as the oscillating mass.

            Think about what happens when you strike hard steel against hard steel – it bounces back.

    2. >Trinamic are very nice stepper drivers and perform much better than many others.

      They’re also somewhat temperamental and easy to break.

      Seen some stepper driver modules where you can turn a trimmer to set the motor current higher than the driver maximum specs, and instantly destroy the module.

  4. Ah, small scale dynamic braking.

    Back in the day of large brush DC motors and motor generator sets, they knew that shorting the motor would stop the motor fast. However, that would also destroy everything. So, they used a double contactor to open the generator output and put a series of high energy resistors across the line.

    As technology moved to the modern 3 phase AC drive, they started regenning back to the DC bus naturally through the modern semiconductors (early ones would just explode). First they were added as external components (as per the Geckodrive example) as this allowed for modularity, external cooling, and rapid replacement for when it failed. More recently, they’re included on the boards, just add external resistor (which on higher end units there’s already a low duty one onboard).

    I’ve built a few turkey cookers in my time (before the current availability of line regen AC drives with rapid response, when we were abusing a 200HP drive as a rapid reversing servo drive in one machine mode). It was a retrofitted metal shaper with a 14 inch cut width. Most of the time, it was a slow process unless they were doing extremely small cuts to fine shape a prehardened part, then it might as well have been on a cam. You could see the heat from the resistors and hear the static snap of the braking resistor kicking on on every cycle.

  5. There’s a lot of talk about BEMF here. I think this has more to do with simple inductance. If the base of a half-bridge opens suddenly underneath a coil with a lot of current running through it, the voltage above the coil increases a ton as the current keeps trying to flow. This was a big problem at an old job where we had some pretty hefty solenoid valves. We neglected to spec the version with the flyback diode, and blew some very expensive PLC modules before we learned our lesson. I suspect this is more of an issue with whatever driver that stepper has piggybacked on it than anything else.

    1. I think it would be useful with steppers rated for high voltages. Some people make the mistake of buying steppers for 3D printers that match the supply voltage rating. That means high inductance. If you manually push the axis the motor generates power that ends up back on the supply lines. It isn’t usually a problem with low voltage/inductance motors.

      1. > Some people make the mistake of buying steppers for 3D printers that match the supply voltage rating.

        It’s not a mistake if you don’t have active PWM current limiting in your drive. It’s a legitimate design choice if you’re going for budget and simplicity.

        1. What kind of stepper drive doesn’t limit current?

          I guess if budget was the primary spec for your 3D printer and performance didn’t matter you could save a few $ by using the 12V motors and produce something that looks an awful lot like a 3D printer.

          1. Until recently, I’d say *most* commercial implementations of simple stepper systems did NOT use PWM. The stepper motors themselves limited the current. It’s the simplest, cheapest way to implement a stepper drive.

            Now, you pay the price in top speed, and don’t get microstepping, but it’s cheap, efficient, and easy.

    2. DC/AC drives (BLDC, stepper, servo, inverter…) larger than a few dozen Watts can benefit from the added protection – except unless the power supply can accept current in reverse, such as using a large rechargeable battery. Then it’s called “regenerative braking”.

  6. Years ago I was involved with a cable-cam company that did those flying sports cameras.

    Those cameras have to travel pretty fast, the camera balls weighed 30 pounds, and the servomotors are big-multi horsepower units.

    One season we ran into a production in a very tall stadium that had us regularly reposition 40 or 50 vertical feet very quickly, and you had to dump a *lot* of energy fast. Well in excess of what you could absorb in regen, but the legacy servo packs we had didn’t really make provisions for a conventional fan-cooled dynamic resistor braking pack, and we didn’t have time to build them anyway.

    Our mid-season solution were braking resistors made of water heater elements built into a 5 gallon pail. At the start of the event the pail was loaded with a ice from the central concessions facility. At intervals the slurry was topped up with fresh ice.

    Melting ice absorbs a *lot* of energy as it goes through the phase-change to water, and we never had problems.

    As an unexpected benefit, the resistors were amazingly light and compact to transport and store, much smaller than the “real” forced-air units we eventually built. Those buckets stayed the company for quite some time.

    1. One could think of an even smaller version if you allow the water to blow off into steam.

      There’s no functional reason why the heater elements need to stay below room temperature. They’re designed to boil water. You just need a double walled container so it stays cool on the outside for safe handling.

      1. Oh, and for future reference, electric sauna stoves have heating resistors that are designed to run red hot in air and have water thrown at them. Would be interesting to see how much heat you could dump by putting one in a box and blowing air through an ultrasonic mist generator into the box.

  7. Yeah, so hitting a hard stop isn’t (by itself) going to cause a back EMF spike: the mechanical energy is really going to go into something else.

    Those JMC “servo” drives are really 1.8 degree stepper motors closing the loop with an encoder, so you can drive them like a smart servo. They’ll also take step/direction so they can still pretend to be the stepper they really are under the hood too. They are a pretty good solution to this kind of problem, but have their quirks.

    If these drives hit a hard stop, their PID loop will wind up as they pull all the current they are allowed to. Depending on how they get configured, they can then fault out, going open circuit. So the power supply sees full current, going to an open. Depending on how good *it* is and how much inductance it’s driving, it can overshoot, causing a potentially overvoltage spike on the power line. A 24V supply pushing a few amps into a few feet of cable andsuddenly seeing an open circuit could easily hit the 40V damage threshold of many devices.

    A TVS or power Zener is the simplest solution here. That, and not putting other electronics on the same supply as your motor drives.

    1. JMC makes both motor types. Some are closed loop stepper motors, while others are BLDC/PMSM motors such as the iHSV60-30-20-36 AC (I think this one has 4 pole pairs)

  8. “back EMF of the motor created a burst of energy”
    No! The increeased torque caused a massive surge in current demand due to the lack of any back EMF being present once the motor stopped.

    1. That doesn’t sound right. Increased current demand would suck current from the power supply (which has overcurrent protection) and wouldn’t blow the power supply or the other attached electronics, which is what happened. Looking at the video, you can see the abrupt stop, just in the driving signals, causes a voltage spike at the motor. The meter says 31V, but I wouldn’t trust it to capture the peak. A scope might reveal a much larger voltage spike.

      1. In your video, you are ramping down the commanded speed manually. The stored kinetic energy in the motor goes into your load dump, as designed. That works great, an will happily accommodate up to an amp or so of current. If the motor is told to slow down faster, the back EMF will of course rises, and the current through the resistor will increase. At just 2 amps, the voltage is going to spike to >65 volts, and still only 130 watts of braking power.

        In the video, the motor is not hitting a hard stop: its stored kinetic energy is being dumped into the resistive load. It is not a fair simulation of hitting a hard stop. If the motor were to drive into a stop, the kinetic energy would be dissipated into the mechanical components. The drive would try to compensate to maintin the commanded speed or position profile, increasing current to its limits. Depending on its configuration it will either hold torque at some current limit and do nothing spectacular, or it will fault out, disconnecting the drive from the power supply.

        The correct test would be to put full load current on the supply, at the location of the motor (to include the effect of the inductance of the power supply lines), then disconnect the load. Measure the resulting voltage overshoot at the load location. Compare that overshoot with and without the protection circuit.

        Then, for grins, compare it with just the capacitor on the line (no transistor or diode).

        The spike will be very short (microseconds). You’ll want to measure it with an oscilloscope. Nice as that Fluke is, it’s not fast enough to see the fast damaging spikes.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.