Arduino Uno, clock speed, pulse rate and stepper motors

Hey folks. I'm running an Arduino Uno controller with an adafruit motor shield attached, used to control a 200 step, 2 phase stepper motor. The motor runs on 12v, 0.3amps, and it is drawing this power as it should be. We've had no problem running other stepper motors on the shield, but we're using the stepper motor described above to turn a powerscrew, and we need a very high speed from this motor, 900rpm (or 15Hz). The motor is rated at a 1200rpm max speed, but the fastest we can get the motor running consistently is only 300rpm. We're using the AF motor library to control the motor. I'm trying to figure out why the motor isn't running as fast as it should be.

The clockrate of the Uno is 16MHz, which initially told me that the controller shouldn't be the problem. But is the clockrate the actual rate at which pulses are sent by the controller to the motor, or is the signal converted to some kind of sampling rate, and there are losses there? For instance, if the controller can only send 1 pulse per millisecond to the motor, then the Arduino can only produce 1000 pulses per second, where each pulse will create one step of the motor. This would result in a speed of 5 Hz (1000/200 steps), if 1 msec is the default setting. Then 5Hz = 300rpm, which is roughly what we are getting now. Is this how the controller works, with 1 pulse equating to 1 step of the motor? If so, how can I increase the frequency? Any help or input would be greatly appreciated!

I don't think the library is limited to one pulse / step per millisecond; this thread

http://www.forums.adafruit.com/viewtopic.php?f=31&t=14113

indicates it can pulse at 100K / sec. I've just barely started working with stepper motors myself but my guess is you'll need to crank up the voltage to get faster speeds. The comments here

say that for fastest speed you need to disable microstepping and run the controller at the highest voltage it can handle (30 volts in the case of the Easy Driver in the above link).

FWIW in testing I was able to get 1200 rpm out of a motor using the AccelStepper library and a 24v power supply, but only unloaded -- I had to decrease it to about 700 rpm to get usable torque.

Good luck!

The faster you run a stepper, the less torque you will have. If you are not making full steps you will have lower speed. If you can't get teh speed with the motor you have, you may need a bigger motor - Bigger Motor = More Torque = More current.

You could find a Unipolar Motor you might be able to use wave stepping, but that won't work with bipolar motor.

magagna:
EasyDriver - Stepper Motor Driver - ROB-12779 - SparkFun Electronics

say that for fastest speed you need to disable microstepping and run the controller at the highest voltage it can handle (30 volts in the case of the Easy Driver in the above link).

How do I disable microstepping, is there a command for that in the Arduino code? Also, this motor will be running constantly and I'm worried about burning it out with the added voltage. Also, won't the current draw increase if i crank the voltage? The h bridge driving the motor can only hold up to 1 amp. Heat is also a concern, any tips on how to dissipate heat off of an h bridge?

Some other thoughts: what is the virtue of using the AccelStepper library over the AF_motor library, is it the extra control it provides where you can set the motor acceleration? I've used both libraries, and the only benefit I saw was that it allows you to run two stepper motors at once (if you have a stepper motor attached to each of the two ports on the AF motor shield).

Also, does anyone know exactly how the Uno's ATmega328 chip sends pulse commands to the stepper ports, does it use the AD converter? I'm not exactly sure how that all works.

Thanks very much for your help/input?

what is the virtue of using the AccelStepper library over the AF_motor library

Unfortunately I haven't used the AdaFruit motor library so I'm not able to tell you the benefits of it vs. the AccelStepper library; I mention it as a reference that yes speeds higher than 300 rpm / 60,000 steps/min / 1,000 pulses/sec are definitely possible with a standard 16Mhz Arduino.

Also, does anyone know exactly how the Uno's ATmega328 chip sends pulse commands to the stepper ports, does it use the AD converter? I'm not exactly sure how that all works.

I may be wrong because as I've said I haven't used the AdaFruit shield, but Googling around I found this page:

http://www.robotshop.com/content/PDF/adafruit-motor-shield-arduino-user-guide.pdf

which says that the shield connects to a motor controller chip in a standard manner. So two Arduino pins are used per motor. One is the direction pin -- when it's LOW the motor will spin counter-clockwise & when it's HIGH the motor will spin clockwise. The other is the step pin -- it's normally LOW; you pulse it HIGH for a brief blip then back to LOW, and the motor takes one step. Repeat as necessary.

How do I disable microstepping, is there a command for that in the Arduino code

In the case of the motor controllers I've used (the Easy Driver and the Big Easy Driver) you have to do this in hardware by pulling some control pins to ground. It looks like you do this with the AdaFruit library by the 3rd parameter in the step() function.

Also, this motor will be running constantly and I'm worried about burning it out with the added voltage. Also, won't the current draw increase if i crank the voltage?

Nope; the controller chip should take care of this. To use the electricity = water analogy, increasing the voltage increases the water pressure in the pipes so the bucket (the motor coil) can fill up faster. When the the chip senses the coil has enough juice it cuts off the flow. This is why motor controllers are sometimes called "choppers".

EDIT! - It looks like I was wrong about the AdaFruit shield. It's just using a plain old H-Bridge controller so you can't simply shove more voltage through it. See this page

http://www.adafruit.com/forums/viewtopic.php?f=31&t=16797&start=0

for more details. Sorry about the confusion. In short -- you may not be able to do what you want to do with the controller you're using.

Heat is also a concern, any tips on how to dissipate heat off of an h bridge?

The standard method seems to be heat sinks and/or fans. FWIW I'm pushing 2A through my controllers and without heat sinks they were approaching 160 F / 70 C but with heat sinks and normal room air flow they now don't go higher than 125 F / 50 C.

Thank you so much for your input, this is a huge help! In regards to using the h-bridge controlled adafruit motor shield, would it be possible to piggyback two h-bridge chips, solder them together, and place that in the socket to double the power capacity, allowing me to overcharge the motor with a higher voltage? Or is the main issue the varying current through the h-bridge, which the h-bridge can't regulate?

Hmm...I'm not sure. My guess would be no that's not a good idea but I'm speculating. I tried Googling this but "1 motor 2 power supplies" only turns up references to either separate power for the control board and motor or backup power supplies...

Maybe if you used diodes so the current from one H bridge couldn't flow into the second...you might want to post this in the motors section of the forum, maybe someone there would know.

@Gatecrasher48: Did you get the speed you looking for. If so please share it. Im having the same problem. Thank you.