Linear Bipolar Stepper Controller … early thoughts

In my continued hunt for the holy grain of CNC Controller cards my thoughts have moved away from current chopping IC’s and towards linear control.

This has driven a number of interesting experiments and distractions all over the place, but it’s getting to the point where I’m close to building the first one, so making it worthy of a blog and hopefully some feedback.

Big Caveat:  I am not an electronics expert, all opinions expressed here are gathered from the net, my experiments, and more usually mental extrapolation with very questionably foundations. So please feel free to point out the errors of my way.

First a little comment about PWM/Current Chopping vs. Linear controllers.

Stepper motors seem to be devices that usually like a very small voltage, the Nema17 ones I’m playing with seem to like 2.8V, and for speed control the typical approach is to use PWM and vary the duty cycle. Marry these two things together and you can get away with much higher (easier to control) voltages and use PWM and current limiting to ensure the total power is appropriate for the motor.

There are loads of devices out there that do this, I’ve researched (and prototyped) the TB6560 which is used in many lower cost CNC controller boards (including a chinese one that I’ve battled with), I’ve also used the Pololu A4983 boards which are based on the Allegro A4983 chip. Actually these devices to a pretty good job, they also allow micro-stepping to provide more steps that the motor physically accomodates (it does this by diffentially powering the different windings to hold the motor in a sub-step position.)

So far, all is good. I’m using a 16 stepping A4983 at the moment (see my Home Grown driver board) and it does a nice job.

However … the PWM approach uses a high frequency to turn the supply on and off and this can be heard in the motors as a whine or squeal depending on how good the driver is and how much current you are supplying. This chopping also leads to more heat generation in the motor (there a good Wiki article on why, but it’s really beyond my capabilities). Also, some of the existing driver IC’s have quite limiting requirements … the signal pulse width requirement on the TB6560 is something that I’m sure more people are running out of spec, especially on Mach3 which doesn’t do long pulses!

All that said, I was fairly content with the drivers until I discovered the Linistepper, this showed that there were relatively simply ways to use a linear driver. The Linistepper didn’t handle bipolar motors, but the principles look applicable.

Basically the linear approach is all about driving the motor at the correct voltage and then varying the voltage (and hence current) to acheive the desired positioning. It’s linear because the voltage is constantly applied, there’s no chopping, no PWM … so there should be no whining, the motor should be cooler (although you’ll get the heat in the driver) and you have infinite ability to vary the microstepping by controlling the voltage.

So … thoughts forming … rather than using a fairly limited resistor stack to select current levels, we could use a microcontroller (I love microcontrollers) … then we could either use a PWM source with a low-pass filter to create a control voltage or a DAC.

For actual motor control, a traditional H-Bridge, but with Darlingtons, one pair will be used as simple switches (could probably use FET’s here, may be cooler, need to experiment) and the other pair will be used to control the current (and hence voltage) … using the TIP122/127 combination, we have a gain of 1000 … therefore for a 2A capable system we only need to drive the base 2mA, should be doable.

So, all conceptually looking good … the Atmel ATTiny261A has a high speed timer that we could use at the PWM source, with two compare registers and a bit of switching logic and an op-amp or two we could drive everything we need. But … I know nothing about filters, so Spice (circuit emulation) allows a bit of experimentation.

So after playing with both passive and active filters for a while, I get a bit concerned about the responsiveness … you are basically filtering out the high frequency PWM signal and should be left with a DC voltage proportional to the duty cycle. To get the best smoothing you need a bigger RC network, but this slows down the overall ramp up/down speed. You get better performance if you speed up the PWM, but this then limits your granularity.

Grrr … there’s always compromises! Anyway, bottom line is that PWM looks viable, and I’ll probably do some experimenting with it, however I am concerned about speed and smoothness … both are probably fine, but if you’re going to do it, lets to it well!

So, DAC’s are the other option … because of the way you need to drive the motors you need four DAC’s (or some switching) to control the two phases of the motor. So I started looking at how to interface DAC’s to the Atmel … again a bit tough, parallel uses loads of pins, anything serial has speed implications, not to mention an overall cost impact.

How about microcontrollers with DAC’s built in? Bizarely there aren’t many of these, some of the newest Atmel devices (the XMega’s) have two DAC’s in, but they seem quite limited and noise prone … and these devices are very fine pitch 100 pin SMT packages and will be a nightmare to prototype.

So here comes the next distraction … PSoC (Programmable System on Chip), from Cypres … Microcontrollers with loads of features and an element of customisability.

A number of the the PSoC1 devices have the capability to run 4 x 9Bit DAC’s at pretty high speed and they have enough analogue control to inject an offset (to get near to the 1.4v base threshold on the TIP’s) and enough power to drive them with no extra components (other than a resistor to control base current.)

As an aside, the PSoC3 and 5 devices are really really nice, you can build a load of stuff actually in the programmable logic area, and I think the next project will be building a much more capable device with those, with virtually no software. More on that later.

So, current status…

I have a breadboard H-Bridge with TIP122/127 transistors capable of driving a single phase of the stepper.

I have a PSoC1 device programmed up to create the Sine Wave’s for the two control lines and two signal lines for the single phase … adding the second phase is very trivial.

I have a schematic and board designed.

So, some testing on the breadboard, and then hopefully onto first prototype board. I put a single axis controller (capable of anything down to 128 microsteps, depends on your ability to drive it), capable of 2A per winding, driving a max of 3.6v … around £10. So a fully functional 3-Axis board (obviously including my customary spindle PWM controller) at around £40.

I’d love some feedback on this.

RT.

7 comments on “Linear Bipolar Stepper Controller … early thoughts

  1. Pingback: CNCzone.com-The Largest Machinist Community on the net!

  2. These drivers look really nice, I love the way they fit into an attachment that goes right on the stepper.

    Unfortunately though, these are still PWM chopper drivers, which although probably fine, is not the goal of this little experiment.

    I’m making progress on the linear driver, onto the second version of the board, another blog will follow.

    RT.

  3. Not sure if you are still interested in the filtered PWM but I have VHDL code for a delta sigma DAC for an FPGA, I posted it at: http://talsmasfpgas.blogspot.com, the post is called FPGA “DAC” Trick. I implemented it on a project I was doing to create arbitrary waveforms, a sort of signal generator. Check it out, see what you think…. CT

    • You can calculate the cut-off fnrcueeqy (fc) of the filter (the fnrcueeqy at which the power halves or the voltage is reduced to about 70%) fromfc =1/(2PI*R*C) (where PI is 3.14)The higher fnrcueeqy will be rolled off at 6dB/octave Every time you double the fnrcueeqy, the power will be attenuated by a factor of four or the voltage attenuated by a factor of two.If you pick a value of C , and you transpose the formula , you can work out RR = 1/(2PI*C*fc)To get better attenuation of noise & harmonics you can go for a Sallen-Key low pass filter, which uses two caps , two resistors & an OP AMPand an attenuation of 12 dB/octaveLee

  4. Interesting! I have heard that the tracking telescope guys will often use linear stepper drivers to reduce jitter noise on their scopes. Also any REALLY low electrical noise applications require them. The German company Phytron sells one:
    ftp://ftp.phytron.de/manuals/power_stages/sincos-gb.pdf

    Most of these designs use a linear power amp, like the OPA54x, MSK541 series which will require you to use a dual supply… or perhaps you could single supply the power op amp and use an external power switch to reverse the current thru the motor coils.

    Here is a posted design for a single driver (you would need two for a bipolar stepper:
    http://jammnelectronics.com/h-bridge-circuit/#more-58

    The other thought would be to use PWM but then filter the output before the motor, so you end up with a linear signal driving the motor. See:
    http://electronicdesign.com/article/analog-and-mixed-signal/improve-emc-in-class-d-amplifier-applications12004

    I am interested in this. If you would like to discuss this off line, feel free to email me.

Comments are closed.