# Stepper motor troubleshooting with Pololu DRV8825 Driver

I salvaged a bipolar stepper motor (QH4-4242), and a power supply from an old printer that I'd like to tinker with before scaling up to larger motors. With the limited knowledge about the stepper (such as current rating), but knowing that the power adapter has a 24V/.55A and 5V/.2A supply, I'd assume the stepper must have a rating equal to or less than .55A. I've found coil wire pairs by measuring resistance (found to be ~8.5ohms).

Using a Pololu board built around the DRV8825, I've followed the instructions on their website connecting the correct pins A1,A2,B1,B2, to the corresponding coil pairs. I've supplied the motor with the 24V/.55A output and tuned the current limiting trim pot while measuring the Amps in a single phase while the Step pin was high such that the current was .29A (since the phases only get 70% of the current at full stepping). And I've set the sleep and reset to high as instructed.

Using a FEZ Panda II as the microcontroller, I wrote a simple code that turns high the step pin and sleep pin for 1 s, then low for 1 s. The stepper motor makes a high pitch noise (as I've read is fairly normal for a chopper driver) and the shaft becomes difficult to turn, however it does not rotate. While the pins are low, if I slightly move the shaft from the 'cogged' location, when the pins are back to high the shaft rotates slightly as if to snap back into place. However it will not rotate nor step on its own.

I would very much appreciate any input or suggestions for debugging this issue.

## Update:

Sorry for the confusion responders, I thought one thing and wrote another last night. My high and low for stepping is 1000ms or 1 second.

Pseudo code would look like:

while(true)
{
step(true)
sleep(1000)
step(false)
sleep(1000)
}


## Update 2:

Per Richman's suggestion, I've added back to back LED's to monitor the switching of the polarity when a Step pulse is sent this appears to [pun] shed some light [/pun] on the problem. And indeed found the issue. The polarity was not switching when the Step signal was being sent. This was because in addition to sending a pulse to the Step pin, I was also toggling the sleep pin which enables/disables the power to the motor. I read this was done to minimize any high pitched noise, but I think I misunderstood and that enabling/disabling is done after ALL of the steps are carried out. That's sorted out now. Sorry to the responders for the confusion with the timing, I'd give you all the right answer since I explained it wrong if I could.

One unknown consequence is that the stepper steps on its own when the Step pin is left at low. I am curious if this is because of noise in the signal which is perhaps causing the Step pin to toggle high/low even though my logic isn't telling it to? Or perhaps there is a grounding/shielding issue because if I touch the motor casing, wiring, or even just put my hand near it, it begins to step faster and faster eventually becoming erratic.

Any thoughts on this new conundrum?

-
With 1000 ms you mean 1 second, right? – clabacchio Dec 5 '12 at 16:05

I think you're driving the stepper motor too fast.

With a 1000uSec high and a 1000uSec low, you're producing a 500 Hz square wave. As such, you're trying to step 500 time a second.

Try slowing things down to maybe 50 steps/second (make your low duration 20 mS, or 20,000 uSec).

-
See edit (1 s instead of 1 ms). – clabacchio Dec 5 '12 at 16:06
with that edit, what's making the high pitched sound? :-) I'm sure he meant 1 ms... – Brian Drummond Dec 5 '12 at 16:23

Stepper Motors need to ramp to max speed and down for optimal performance. Start slow and increase durations by a factor of 10x and then experiment with a ramp profile__/--- \ _ for speed control.

If you don't have enough scope channels, use LEDs to monitor phase voltage and use two LED's back-to-back with a 1K resistor for ~ 20mA Use Green Blue or any different color for ease of reading and slow your program to 1 second per step. Ensure each phase is being driven properly. No need to increase the sleep time I think that is more dependant on the load factor.

Generally there are two design interfaces. Direction and Pulse count Like Floppies and old ST506 HDD's and Pulse Fwd/Rev. At the motor interface there are full-steps, half steps and micro-steps. Dead-time is a critical factor in large motors eg 1~10us as the latency and shoot-thru effects from loading can easily fry drivers from both drive-high-low being on with an inductive load. All CMOS works without dead-time but then they don't recommend you drive motors with them.

-
See edit (1 s instead of 1 ms). – clabacchio Dec 5 '12 at 16:07
gotcha.. I guess the phase voltages are incorrectly driven... in 1 second ought to be able to confirm voltages on each and current to ensure no burnt winding. 8 Watts per winding will get hot. – Tony Stewart Dec 5 '12 at 16:40

A bit too fast. Try it 5 times slower. If it still doesn't run, look into how you are sequencing the steps; are they in the correct sequence and correct polarity?

If there's any doubt about this, sequence a few steps by hand with two wires from the power supply, and check that the driver is generating the same sequence.

-
See edit (1 s instead of 1 ms). – clabacchio Dec 5 '12 at 16:07