[phpBB Debug] PHP Warning: in file /mnt/forum-shared/ext/sitesplat/BBCore/event/listener.php on line 70: in_array() expects parameter 2 to be array, boolean given
EasyDriver v3 Stepper Motor Driver problems - SparkFun Electronics

SparkFun Forums 

Where electronics enthusiasts find answers.

General suggestions or questions about the SparkFun Electronics website
By Jack Flanders
I recently purchased Sparkfun parts:
EasyDriver v3 Stepper Motor Driver
Stepper Motor (SKU#: ROB-08420)

I have it connected and running from a pulse generator. Measurements show that it does indeed complete one revolution per 1600 input pulses applied. All is good so far.

But what the motor seems to be doing is only moving significantly one motion per 8 input steps. It appears to "quiver" 7 times then move 1 time for each 8 input pulses. I was expecting to see 8 small equally spaced microsteps but this is not what I'm getting.

The current set pot is set to the max so as not to be a limiting issue. I have run from 6 to 16 volts with no appreciable difference.

If I'm only going to get 200 actual steps, the microstepping isn't doing me any good. Is there something I'm missing?
Thanks for any input!
By EmbeddedMan

Yes, I would say something is definitely wrong. You should be getting 1600 equally spaced steps. Each of the 8 microsteps is (very close to) 1/8 of a full step. At least it should be.

Here is my test setup that I use to check EasyDrivers. I take a 1KHz %50 duty cycle 5V square wave to drive the STEP pin, then tie the DIR signal to ground. I put a 4-wire (bi-polar) 400 s/r motor on the ED, then 12V into the ED from a PC power supply. I watch the motor spin, and feel it with my fingers, and especially listen with my ears. I then slowly (very slowly) turn the current limit pot all the way around (360 degrees). You should find at least part of that rotation where the motor just 'hums' along very smoothly with no jerking, all microsteps nice and smooth. Test in both directions by repeating the experiment with the DIR pin tied high.

If the above experiment does not produce smooth steps at some point, then there would be one of two things wrong, I think.

1) The motor you are driving has a problem - either the wiring is not right, or the motor has too much resistance in its coils (so the driver cannot microstep properly) or the motor is broken somehow. Are you sure you have the coils connected properly?


2) The ED itself is bad. I've never seen a bad driver chip, only soldering issues (the ones I've made myself I've hand soldered, and I've had trouble getting good connections with the driver chip) with the chip or the stupid tiny little current limit pot. (I can call it stupid because I decided on that pot - the next version of the ED design will have a _much_ better pot - bigger and easier to solder.)

Unfortunately I do not have the exact stepper motor that SparkFun sells - although I have no reason to believe it won't work. (All of its specs look good from what I can tell.)

I hope this helps - if you just can't get it to work, don't hesitate to e-mail SparkFun directly. I hear they're really helpful people. :-)

By Jack Flanders
Thanks for the quick reply!

I can see no problem driving it at 1kHz; the steps are way to fast to see any discrepancy. My intended application will be stepping maybe a few steps per second. It's going to be used as an position indicator.

It's wired correct.

My guess is that at very slow speeds, with no moving inertia, the cogging torque is not being overcome. Tomorrow I hope to get a scope on it and check the waveforms. It's likely (I'm guessing again) that nothing is wrong; rather, it just ain't gonna work at the slow rates I need.

After I get a chance to do more checkout, I'll post back here if something turns up.

By EmbeddedMan

Ahh. That's really interesting. It should work exactly as well at 1Hz as it does at 1KHz. The motion should be smooth (although perceptible steps obviously, but all should be equally spaced). I have run my EDs real slow, and they're just a joy to watch. So I know it does work well like how you want to use it.

I think the wavefoms will tell a lot. The best way to look at how it is running is if you have a 4 channel scope and can look at both sides of each of the sense resistors and then subtract one side from the other. You'll have 2 traces that show the current flowing through each coil.

By JasonDorie
Brian - couple questions:

- What would you consider to be 'too much resistance'? Is this going to vary by motor, or is it more of a general thing?

- Where's the contact point on the little pot? Is there a way to tell where between min & max you are by just looking at it?

- What's the max speed I should realistically expect from a small motor (the SparkFun one)? I find if I pulse faster than about 5KHz the motor just sits there and hums. Will adjusting the pot help this? (I'm just trying to figure out what's reasonable). The power supply I'm using at the moment is only 300ma, so that could be limiting it too.

- Is there a 'right' way to attach the outputs to the motor coils? Does changing the wiring just affect direction, or will it work better with a certain combination?

I really like the ED by the way - I plugged in some header pins, stuck it on a breadboard, and had it spinning a servo after a couple minutes of easy coding.
By Jack Flanders
What I learned and how I learned it.

Today, I learned to read the fine manual. :oops:

Observing the current sense waveforms on my scope, they were very different looking from the images in the data sheet for the Allegro part. While watching them, I tweaked the current set pot. Bingo.

At one end, current is exceeded and nothing happens. At the high end, the waveform is very distorted. Somewhere in the middle, it all gets nice.

Now it appears to step evenly at one pulse per second input rates. All is good!

Thanks for pointing me in the right direction! :)
By EmbeddedMan

The "Too much resistance" question has to be calculated for your input motor voltage and motor resistance. When I have some time later today, I'll find my notes when I was first working with the ED and I'll send you what I found. But basically it works like this - in order to work properly (i.e. do 8 smooth microsteps) the driver must be able to 'chop', meaning dump the whole motor voltage across the motor winding (minus the sense resitance and internal driver resistance) and then watch as the current climbs. When the current gets to 700mA (or whatever you have it set to) then it shuts off the voltage to the phase and watches the current fall slightly, then turns it back on, etc. over and over. To make the microsteps it just changes the max current for that step. So where things go bad is if the motor's internal reistance is so high that even with full motor voltage across the phase coil, the voltage across the sense resistor never reaches the 'trip' point (which is how the driver knows the current limit has been set and thus can start chopping). There is a formula in the datasheet for calculating this. If your motor resistance is too high, the motor will limit the current before the driver can, and no chopping can happen (and thus no microsteps).

As far as max speed it really does depend upon motor. Some can go much faster than others. In my experience 5KHz is pretty good for a maximum speed. To raise the maximum speed for a given motor, raise the input motor voltage (don't go above 30V). That will raise the top speed, and will also help get around the 'no chopping because motor resistance is too high' problem too.

The little pot? I hate that thing. :-) There is supposed to be a little flat on one side of the 'knob', but I can never remember where the contact point is relative to the flat, and I can't find the flat very often.

The 'right' way to attach the coils is the way that makes the motor run the smoothest. <grin> Seriously, the only wrong way is to not connect both ends of both coils. Don't connect the middle wire (if it is there on 6-wire motors) and make sure to connect the two center wires for each phase to each other only for 8-wire motors.

I'm really glad you could get yours working so easily. That was the idea behind the ED.

By Jack Flanders
For Jasons question on max speed...

Motor inductance is the parameter that determines this. My Sparkfun motor also maxed out at around 5KHz input step rate. Here's my analysis.

The motor ratings:
Vmax: 15.4V
Imax: 280mA
Rwinding: 55 Ohms
Lwinding: 75mH

Inductance limits rate of rise of current according to:
di/dt = V/L
so max di/dt is about 15/.075 = 200 amps/second.

To simplify a bit, ignore the microstepping and just consider applying 15volts to the motor winding. How long does it take to get to max current of 280mA?

It takes .28/200 = .0014 secs. A 5kHz input divided by 8 gives 625 real motor steps per second which is a step time of .0016 secs. So the motor current waveform is a triangle at 5kHz instead of a rectangular pulse. The average current is only half the peak. At faster step rates, the current is not sufficient to move the rotor and since it doesn't know the words to the song, it sits there an hums. :D

One cheap trick to get a little more mileage is use a higher voltage supply and a series resistor to keep the max current at .28amps keeping in mind all the various max ratings.

If anyone sees a major blunder in my calcs, please feel free to make corrections.
By JasonDorie
Jack: For extra speed I can just gear the thing; I was just trying to figure out what I should expect as I'm new to pretty much all of this. The calcs are good to know though, and the explanation makes total sense. I work with brushless motors for R/C planes / helis a lot and I knew the basic relationships, but didn't really get 'why'.

Would switching to 1/2 steps improve this (higher average amperage at a cost of coarser steps)? Does it work that way, or were you implying the 'triangle at 5KHz' is because of the rise time, not the micro-stepper?

Brian: I followed the advice in your previous post about just feeling the motor for smooth running and found the sweet spot, so I'm good. If I read your description of 'chopping' right, taking Jack's comments into account, I should be able to increase the speed of the motor by boosting the voltage and using the limit pot to keep it below the 280ma, right? If the motor has a rated voltage of 15, how high can you take it before hurting it?

Thanks for taking the time - This is enlightening. :)

By Jack Flanders
Would switching to 1/2 steps improve this (higher average amperage at a cost of coarser steps)? Does it work that way, or were you implying the 'triangle at 5KHz' is because of the rise time, not the micro-stepper?

I believe the rise time which is limited by the inductance is the fundamental problem. Microstepping won't help to increase the speed. Microstepping just gives higher resolution than the motors native step size.

As far as using higher voltage for increased speed goes, I think the limitation of higher voltage is due to the associated rise in current (when working below max speed). Higher current means higher i2r (i-squared*r) power dissipation. Eventually, the temperature rise will do bad things :shock:
So the manufacturer picks what they feel is a good compromise considering some users will be working at elevated ambient temps to start with.

If you want to work with higher voltage to help speed things up a bit, you can go to, say, 30 volts and add a 55 ohm resistor. This along with the 55 ohms of motor resistance will limit motor current to the motor spec of around 280 mA. Note that the resistor would need to dissipate around 4 watts or so...

But when the output turns on, the motor sees 30 volts so you double the di/dt until the current rises and the resistance begins to limit it. The IC has a voltage rating of 30 volts max by the way.

For me, the main attribute of the Sparkfun motor and driver board is that I am able to get a system going to test software and stuff right away. For requirements that exceed the specs of the motor, I can always hit the various surplus outfits. Still trying to learn as I go :lol:

Good luck!
By EmbeddedMan

The voltage limit on the motor can be ignored, at least from my own personal experience. Because the chopper will limit the current, you'll never fry your motor. I'd say go as close to 30V (the driver's limit) as you can for an input voltage - the voltage that actually gets to the motor will never be that high because the chopper will chop. But it will help your rise time and thus max speed.

Watch out for going beyond the 30V by back EMF if there is any possibility that the motor can be back-driven by your mechanicals.

By JasonDorie
This has the ring of a dumb question, but I'm going to ask anyway (I know, there are no dumb questions, just the dumb people who ask them ;) )

Do transformers (wall warts) work the same as batteries? Can I wire two identical 12v 1A transformers in series to get 24v, or in parallel to get 2A, without frying them? Does this work?

By Jack Flanders
Oops. Ignore my comment about adding a resistor, at least when using the Allegro controller chip. As Brian pointed out, it does operate as a current source so higher voltage won't be higher current, just faster rate of rise of current. Doh!

As for combining wall warts, it depends. Old linear style that are transformer isolated completely will likely work in series but for parallel, they should be isolated by diodes. Again, depending on internal circuitry.

But going forward, govt. regulations are in a trend to get the industry to use switchers for better efficiency. Combining these will be on a case by case basis. Some will work, some won't. It's definitely best to just get a higher rated unit than to try combining them. YMMV.
By JasonDorie
Jack - Thanks for that. I have a pair of 12V 1A transformers (and I'm almost positive they're not switchers based on shape & size). I was hoping to try them in series to see what kind of speed improvement I could expect from a higher voltage. If it's significant, I'll spend the money and get a proper one.