MHz Stepper controller - tons of issues!!!

Discussion in 'The Projects Forum' started by szakharo, Jan 28, 2008.

  1. szakharo

    Thread Starter New Member

    Jan 28, 2008
    I am trying to design a microstepping drive for my home-made CNC mill.
    The design parameters:
    1. Adjustable maximum curent 0.5-8A
    2. Supply voltage 24-80V
    3. Maximum step frequency 0.5-1 Mhz
    4. 200-51200 steps per revolution (1.8deg motor)

    So far I am using an 80V rated h-bridge driver to control 100V 25A power mosfets. This driver will go up to 1 MHz switching frequency according to specs. Current is sensed using a shunt resistor, and once it reaches a set point it shuts down mosfets into fast or slow decay (microcontroller selectable). The overall delay from the moment overcurrent occurs till mosfets are shut down is 200ns. So if I wait for another 800ns before I turn them on it should give me a 1 Mhz chopping

    The issues I am having:

    I did a lot of research on existing drives and found many manufacturers advertise a step rate of 2-10MHz and PWM rate of ....20kHz.
    I am hitting a brick wall with my head but can not understand how come you can go to the next step (i.e. adjust current) in .5 uS if your PWM cycle takes 40uS?

    That absolutely doesn’t make any sense to me. I would suppose pwm chopping frequency should be at least a few times higher than a maximum step rate. or do I miss something? I also understand that if I increase my chopping frequency to lets say 500kHz the heating will increase dramatically.

    As I mentioned above the max supply voltage is 80V. This is a limit for my h-bridge driver circuit. Can anybody advice a 12V voltage regulator which would take input up to 80 volts? So far I could find 60V max and its a switching reg.
    Also I am putting 81V transient suppression diode on a power line. but datasheet says it will break down till 90-110V. Does it mean my circuits will be fried by the time it kicks on and does any difference?

    I am not a EE major, so please, be gentle on me;)
    And thanks tons for all your replies!
  2. SgtWookie


    Jul 17, 2007
    Well, any semiconductor device takes time to turn ON and OFF, and those times are not necessarily the same.

    The faster your chopper drive is clocked, the more time the MOSFET drivers will spend in transition, and that's where they'll generate heat. You'll need to consult their datasheets to determine the on and off switching times.

    Doesn't seem very intuitive that the stepping rate could be higher than the switching times. I don't know how they can claim that - unless they're counting microsteps in along with that.
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    I question being able to use stepper motors with PWM. Steppers need a variable frequency to run. A fixed frequency will result in a constant speed. They generally don't run above 8000 steps/sec.

    Perhaps you are using servo motors, which do respond to PWM.

    If you need 12 volts, it might be easier to get a wall transformer for that. What kind of current do you need for the 12 volts?
  4. szakharo

    Thread Starter New Member

    Jan 28, 2008
    Here are a couple cents to make everything more clear:

    I drive a stepper motor using a sine/cosine approximation. My sinewave is composed of many flat regions. In order to maintain approximately flat current during each microstep I use a current chopping.
    I noticed that some people refer to it as PWM as well.

    There are 2 possible approaches to it:

    1. fixed chopping frequency. Assuming a 20 kHz, every 50us it will reset a latch, and turn on mosfets, once a current reaches the limit mosfets will turn off and current will start decaying till the end of 50us cycle.

    2. fixed off time. If sensed current is lower than a set point, mosfets will turn on and stay on before current reaches the limit, after that they will turn off for a predetermined period of time

    So even if you use a microstep you still have to maintain a current on each step and chopping period has to be less than a length of a step pulse.
    I found out that some drives will switch to a full step mode after rpm exceeds 150. So at high rpms they will count like 256 steps and only after that will trigger a single step. So 2Mhz/256 = 7kHz step rate Is that how they advertise those frequencies?
    But that doesnt make much sense to me since once you went to a full step ,you lost any positioning accuracy benefits of a microstep and in fact you cant even track it back and tell there the motor is at. It could be useful with encoder though.
    Can anyone clarify, please?

    Btw, 12V requires 0.5-1A since I hook up 5V regulator to it as well.
  5. SgtWookie


    Jul 17, 2007
    For your power supply, you should strongly consider converting an ATX form-factor computer power supply. You can pick them up anywhere for next to nothing, and the conversion isn't hard at all. You will then have an efficient switching power supply capable of LOTS of power. Google is your friend here. :)

    There is nothing wrong with using chopper drivers with stepper motors. You can sometimes double or triple their rated voltage, as long as you don't exceed their current rating. This improves the acceleration/braking characteristics of the motor, along with allowing higher speeds than would be possible without the chopper drive.

    As far as the drives switching to full-step mode after 150 RPM, that would be quite logical. There would be no benefit that I can think of to use microstepping at such a speed; you would indeed exceed the capabilities of the MOSFET drivers to switch on/off in time if you would attempt to do so.

    If you're driving your stepper motors ANYWHERE near their limits, you must use positive feedback (ie: rotational encoder, limit switches, etc) to ensure that the steps have actually been accomplished; otherwise you're "flying blind" without instruments.
  6. szakharo

    Thread Starter New Member

    Jan 28, 2008
    Thanks for the replies!
    I need a12V power supply to power a charge pump, I also step those 12V down with 7805 for my 5V logic.
    The thing is the board will have a 24-80V power input. So the 12V supply should accept anywhere from 24 to 80V and produce a steady 12V, 500mA.
    I dont wanna have a separate 12V connector on the board since it would require extra wires etc, so conversion has to be done internally.
    It has to be simple, tiny and cheap!!!
    Any suggestions are appreciated!
  7. SgtWookie


    Jul 17, 2007
    You can buy DC-DC converter modules for not a lot of money. They basically have a switching power supply inside of them. You'll need to do some research; I don't know if any are available for stepping down from that high of a voltage. Perhaps buck converters.

    [eta] Just found something of interest to you ;)

    International Rectifier ( ) has an applications note you should download; AN-978 in their technical library.
    Direct link:

    An excerpted portion of a page with a schematic of an HV buck converter is attached. You could supply the IC itself with 15Vdc from your HV supply using a 10K resistor in series with a 15v 1-Watt Zener diode.
  8. szakharo

    Thread Starter New Member

    Jan 28, 2008
    Thanks for the power supply help!
    I searched google in a different way and found a chip which does all of it internally and provides 350ma. That should be enough for a charge pump and a CPU.
    However I am thinking of implementing that circuit from Application Note for the main power supply ~110 to 80V 20A

    Does anyone knows how fast can I drive Mosfets without running into serious heat issues?
    I would like to have my chopping frequency as high as possible in order to keep a high precision at low currents during microstepping. Mosfets' on+rise time=60ns, off+fall=70ns
    even if I pulse them at 1Mhz it leaves 870 ns in a pure on or off position

    P.S. Sorry for the bad spelling and grammar, seems like I am always in a hurry while typing;)
  9. SgtWookie


    Jul 17, 2007
    Well, you really ought to use at least an isolation transformer. Bad practice to run things directly off the mains, as you have no isolation. You can cut the size of your transformer by feeding it with a HF oscillator or chopper.

    If you're thinking of running MOSFETS that fast, you're going to run into heating problems. I'd keep them under 70KHz, and still have heat sinks on them.

    You could run some in parallel to help dissipate the heat. Nice thing about MOSFETS is they have a positive temp coefficient; that when they heat up, they conduct less, so other MOSFETs in parallel "take up the slack", so to speak, allowing the hot MOSFET time to cool down. Of course, you have to take the extra capacitance into account, but that's a price one must pay.
  10. szakharo

    Thread Starter New Member

    Jan 28, 2008
    As far as I figured out, everyone uses a 20khz switching frequency. The mhz step signal is handled by dividing it over the number of microsteps after input frequency reaches the certain limit.

    So the logic is as follows:
    1. every 50us reset the latch (lets call it a clock cycle)
    2. Now latch will allow mosfet to turn on if the coil current is less than a preset limit.
    3. Once current reaches the limit and overshoots a little bit due to delays (200 ns or so) latch will be set and mosfets will turn off.
    4. current will continue to decay till the next clock pulse resets the latch again.

    So 2 possible situatios:

    I. current will be still higher than a limit by the time a clock pulse comes, so mosfets will not energise and current will continue to decay for another 50uS. It will effectively reduce a switching frequency, so it can easily drop into an audible range… result tons of annoying noice.

    II. lets assume a very high voltage and a very low inductance motor. Current limiter is set to 100ma, it overshoots and decays to almost zero in a microsecond or so. So by the time my clock pulse comes it is already too late and current went all the way to zero! So I can never reach a high precision at low current levels!

    Solution: use a comparator with hysteresis, and reset the latch every time current drops 5% below a preset limit. It will solve a precision problem but will drive a switching frequency crazy in the case of a small current setting and a low induction motor!
    Note, that both methods will possibly go into an audible range.

    I studied tons of document about how stepmotor controller chips work etc etc and I am stil lcompletly lost here. Does anyone has any experience in designing stepper controllers? How to deal this all those issues?
    Any help is appreciated!