Fly-back diodes for stepper motor

Discussion in 'General Electronics Chat' started by hrs, Oct 7, 2016.

  1. hrs

    Thread Starter Member

    Jun 13, 2014

    I've bought a cheap unipolar stepper motor for the purpose of learning how to work with steppers. It is wired such that there is a single common for all 4 phases (schematic).

    Now I'm trying to figure out how to arrange fly-back diodes around a stepper. According to this source you shouldn't put diodes across the windings or generative braking will occur when the winding is shut off. Near the bottom of the page below "Simpler smart brakes" it says you should put the diodes across the transistor, but I don't see how D2 protects Q1 and I can't get it to work in a simulation.

    Any thoughts on this? Or regardless of the above how would you arrange fly-back diodes in a stepper motor circuit?
  2. ci139


    Jul 11, 2016
    i don't think you can get adequate results from spice unless you couple your drive coils with "rotor emulator" -- but setting such up correct requires for you to know what to expect from in a first place - and it makes the simulation to run very unpredictably e.g. you also must know how to overcome any speciffic situations in Spice

    i guess basic practical testing such as ? energy input to drive ►► motor power output ? will give you quickest progress
    do simple things first driving the motor at certain rpm braking(or intended)-load

    i assume the accelerating/braking the motor has higher power draw than constant speed


    by: Google image search
    Last edited: Oct 9, 2016
    hrs likes this.
  3. hrs

    Thread Starter Member

    Jun 13, 2014
    Ah, of course. That's going to be complicated, I think I'll skip the simulations.

    I understand how voltage spikes are suppressed if you place a diode in parallel with each coil. What I don't understand is how this configuration works where the diodes go from emitter to collector.
  4. sailorjoe


    Jun 4, 2013
    Try thinking about it this way: when a single transistor turns on it allows current to flow through the motor winding. In your diagram, imagine current flows from the motor power point, through the transistor to ground. As you may know, current flowing through a coil also creates a magnetic field around the coil. So far so good. Now instantaneously switch off the transistor. The current stops, but that makes the magnetic collapse. Remember that a changing magnetic field can induce a current in a wire, or a coil. So as the magnetic field collapses, it induces a current in the coil, and that new current is opposite to the original one. It wants to flow from ground, through the transistor, and into the motor power point. That's bad for the transistor, and makes it behave badly, and perhaps burn out. So the diode saves the transistor by allowing the current to run through it instead of the transistor. Does this help?
  5. Sensacell

    Senior Member

    Jun 19, 2012
    This diode configuration is not correct and will NOT protect the transistors.
    When the transistors open (switch off) the energy stored in the inductance of the windings makes the collector voltage RISE until something conducts- in this case, it's either the diode or transistor that breaks down, potentially killing it.

    The correct configuration is to place the diodes from collector to Vcc, clamping the voltage to the positive rail.

    This will work, but it will provide slow current decay and poor speed performance. For better motor performance, you need to dump the coil energy as fast as possible, while keeping the collector voltage within safe limits.

    A resistor or zener in series with the clamp diode can be sized to provide adequate voltage clamping, while dissipating the energy rapidly.

    Investigate "bipolar drive" circuits, these are far more efficient as they return the coil energy to the power supply.
  6. crutschow


    Mar 14, 2008
    That is absolutely not true. :eek: (Where did you get the idea that it reverses?)
    When you try to stop the flow of current in an inductor by turning off the transistor, the collapsing magnetic field of the inductance will try to keep the current flowing in the same direction, and the collector voltage will increase until either the transistor or diode breaks down.
    Thus to protect the transistor, the diode would need to be a zener with a voltage rating below the maximum Vce rating of the transistor.
  7. MrAl

    Distinguished Member

    Jun 17, 2014
    Hello there,

    I am sorry to say this but unfortunately it looks like all of the replies and all of the drawings and even the simulations shown so far do not seem to be correct, at least not for a unipolar stepper motor.

    A unipolar stepper motor is wound differently than a bipolar, and is therefore made to be connected differently to the driver transistors and back emf diodes. For one thing, each winding of the two windings has a center tap. We dont have to use this center tap, but then we loose part of the torque available for that unipolar stepper.
    The attached drawing shows the proper connections as well as the proper diode connections. Note this connection scheme is only valid for a unipolar motor.

    Now we could drive it like a bipolar by simply ignoring the center tap of each winding, and then we would find that we need 8 diodes to properly shunt the back emf currents. That is an option, but it reduced the available torque we can get from the motor based on the power supply. The wire in these steppers will be sized according to the way it is intended to be used, with the center tap to +Vcc, and doing it as a bipolar means we cant get enough current through the winding without a power supply that is two times higher in voltage. That's of course if we intend to use the motor to it's full capability. If not, then wiring it as a bipolar may be good enough. That however will require 8 diodes: 4 to ground and 4 to +Vcc.

    Note that the drawing shown does not show the current sense resistors that are usually present in the driver circuit.
    Also note that in the simulation the two inductors L1 and L2 should be given a common core (shown as "STEEL" in the drawing which in spice is a core "K") and that would represent one of the two center tapped coils. The polarity of the two coils however is such that the top of L1 would be positive (the polarity dot) and the bottom of L2 would be positive (the polarity dot). Alternately the dot for L1 is at the bottom and the dot for L2 is at the top. In no case should the dots for both coils be both on the top or both on the bottom.
    If you really think you need 'faster' coil current dump action and you use zeners you have to be careful about the reverse current in the zener as well as the more anticipated forward current. It's always a good idea to check both because a zener across one winding acts as a plain diode in the other direction.
    Last edited: Oct 10, 2016
  8. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    Apart from the coil designations, isn't that circuit the same as in post #3?
  9. MrAl

    Distinguished Member

    Jun 17, 2014
    Hi Alec,

    Well, there is actually a big difference, and that is how the coils are wound. In post 3 all the coils appear to be independently wound on four separate cores and all with the same polairity, while in the drawing i provided the two coils for each half of the stepper are shown as both wound on the same core and have opposite polarities. That makes all the difference. Thanks for bringing this up though because i forgot to show the dots on part of my drawing, which i'll add now. I did mention it in the description though.

    Ok the dots have been added. Also note that the coils are labeled differently, one as A and the other as B making it clear that there are really only two coils (each with a center tap).
    Last edited: Oct 10, 2016
  10. hrs

    Thread Starter Member

    Jun 13, 2014
    Thanks everyone for your comments.
    How about the following:
    Suppose that Q1 was conducting and is now shutting off. An instantaneous voltage V = L di/dt must exsist across A1and A2 due to the mutual inductance of A1 and A2. This leads to a high voltage wrt ground at the collector of Q1 and some low voltage at the collector of Q2. D2 clamps the collector of Q2 to ground. The instantaneous voltage V must be equally shared between A1 and A2* and since the center tap is at V+ the voltage at the collector of Q1 cannot exceed 2*V+? Is that how it works?

    * Note the big assumption that A1 and A2 share the voltage equally.
  11. MrAl

    Distinguished Member

    Jun 17, 2014

    Yes, that's exactly how it works :)

    The single center tapped winding acts just like a center tapped transformer so when one winding end is clamped at 0v the other end is clamped at 2*Vcc. So with a 12v power supply the max across any transistor will be about 24v or close to that. That is also why we cant use diodes going to the positive power supply rail +Vcc.

    In these lower power devices there usually isnt a problem. In higher power units sometimes the spike has to be snubbed with a resistor/capacitor/diode type snubber. That is because a very short spike can occur which has enough energy to do damage. In power converters it is more common to use snubbers. Of course the rise time has a lot to do with this too, so slow rise times will show less spike energy than fast ones.

    Since there is a slight possibility of a short spike that occurs before the winding can transfer the energy to the other winding (given a very fast transistor turn off), it's always a good idea to check each new design with a decent scope that can pick up fast, short transient voltage spikes. If a snubber is attached, it's good to make sure it does it's job properly too.

    You should be able to get better simulation results if you use a 'core' specified by the mutual inductance constant "K" in the spice simulators.
  12. hrs

    Thread Starter Member

    Jun 13, 2014
    Great, thanks! I'll give the simulation with mutual inductance a try. And scope the real circuit.