Non "hobby" stepper motor control

I need to control two of these from an Arduino:
http://cnsoyo.en.gongchang.com/product/3994748

All the tutorials I can find for Arduino stepper motor control refer to control of hobby motors, such as in RC cars. These aren't hobby motors, so I'm not sure if I need to do something different. Can someone please point me in the right direction as to what hardware I would need to interface to these motors? I don't think I'll need much handholding with the software but am not sure how to interface hardware-wise.

Thanks!

  • Dave

I think you are mixing up stepper motors and "hobby servos". Stepper motors are not normally used in R/C cars.

As far as I can see those motors do not require large currents so you could drive them with a Pololu A4988 stepper motor driver or similar. The Pololu web page has a lot of useful info.

There is some simple code for driving stepper motors here.

...R

Thanks! Yes, you're right, I got my motors mixed up. I ordered some 84988s. If you don't mind, I will respond to this thread if I have any issues getting them to work.

dptdpt:
If you don't mind, I will respond to this thread if I have any issues getting them to work.

Please do.

...R

Ok, I do have another question. I think I need more outputs for my Yun. I will control this using the PWM outputs, of which there are 7 - correct? Since this is a 4 lead stepper, and I have to control 2 steppers, I'm one output short. Actually, I also have to control 3 other motors (not steppers), from the same Yun. So what do I need to get to add more analog outputs to be able to control all these motors?

dptdpt:
Ok, I do have another question. I think I need more outputs for my Yun. I will control this using the PWM outputs

You don't need any PWM outputs to control a stepper motor driver. The Arduino just needs to provide step and direction signals from any I/O pins.

The Pololu A4988 web page shows how to wire the Arduino and the motors to the driver board.

...R

PS the driver board automatically deals with all the PWM stuff for driving the stepper motor.

dptdpt,
You can also save some pins by using one pin to enable all the stepper drivers. I have done this with 3 steppers on a home made CNC machine. I used GRBL sketch on the Arduino, check it out here

Ok, it turns out that the steppers I need to control (see link above) are 6 lead unipolar motors, not 4 lead bipolars. The Pololu A4988 is designed to control 4 lead bipolars. Pololu says to just treat the 6 lead unipolar motors as 4 lead bipolars and to not connect the center taps in each coil. Is this ok? I don't understand enough about the differences between bipolar and unipolar motors to know if this could be a problem.

dptdpt:
Pololu says to just treat the 6 lead unipolar motors as 4 lead bipolars and to not connect the center taps in each coil. Is this ok? I don't understand enough about the differences between bipolar and unipolar motors to know if this could be a problem.

Did you try the advice? and what happened? The Arduino is a great system for learning-by-doing.

6-wire steppers are just 4-wire steppers with additional contacts at the centre of each coil. Hence you can ignore the center connections and just treat them as 4-wire motors.

Wikipedia has good stuff on steppers.

...R

Ok, I have my poulu A4988 hooked up to a stepper motor, as per the instructions. I'm now trying to control it. I'm not sure I'm doing it right, but nothing is happening.

So from an Arduino sketch, if I have pin 13 connected to the "step" input on the A4988, should a DigitalWrite(13, HIGH) drive the motor one step? That's how I thought it worked. As for my setup:

  • I did tie RST to Sleep, as per Polulu's instructions.
  • I am doing nothing with "Enable". I expect that's the problem. Should I send a pulse to that to enable it? Tie it to VCC? ...?

Here are the Poulu instructions for the board:
Pololu - A4988 Stepper Motor Driver Carrier.

Update:
I found some sample code online, and I now see that I need to set the "Enable" pin on the Polulu to high to enable the board. Correct me if I'm wrong, but I don't think that's mentioned in the documentation. Maybe they thought calling the pin "Enable" was enough of a clue. :wink:

But, ... still no worky. I did notice one mistake. I had thought the stepper I was controlling was a 24 volt stepper. I don't know where I got that from, I think I got mixed up with some other motors in my robot that definitely are 24 volt motors. Anyway, I have this all wired up for 24 volts and that's what I'm sending the stepper. Could that be the problem? Would that cause it to not move at all when I try to step it? I wouldn't think so... It's not hot or anything...

I can change my board to be sending it 12 volts, but I suspect that's not the problem.

Here's what it says for the spec sheet for the stepper motor:
Rated voltage: 12 V
Current/Phase: 0.16 A
Resistance/Phase: 75ohms
Inductance/Phase: 50 mH
Holding Torque: 1100 g-cm

leads: 6

Any suggestions or advice would be much appreciated!

  • Dave

Stick to the code I linked to in Reply #1 until you get it to work. It works with the Pololu wiring diagram.
No time for more, now

...R

Ok, thanks. I'll try your code, but it's not my code. There is something wrong with how I have it wired. I did make a little progress last night. The first thing I did was to put in a little 2 resister voltage divider, to divide my 24 volt input down to 12 volts. As I said earlier, I had thought that this was a 24 volt stepper and was sending it that. Once I had 12 volts going to it, the stepper started to hum/whine. So this seemed like a little progress, vs it just sitting there silently!

After that, though, things got weird. First of all, I realized that my 12 volts became 6 volts, once I connected it to the Pololu controller (!) at the VMOT connection. So the Pololu is acting as a voltage divider. Then, once I apply a load by trying to move the motor, the voltage drops to zero. So there's a short somewhere?

Clearly, there is something wrong with my wiring, but if this Mistake sounds familiar to anyone, please let me know.

24 volts would be better than 12 volts. All you need to do is adjust the stepper driver so it only permits the maximum current required by the motor. The Pololu page explains how to do that.

DON'T use a voltage divider.

What sort of power supply are you using?

Post a photo of a drawing showing exactly how you have everything connected. Note that a photo of your project is not suitable.

...R

Ok! I've made a lot of progress. There were several issues. One was that I thought that you had to set the enable bit on the board to high to enable it, but no - it wants to be set to ground. Another issue is that the 12 volt stepper motors I ordered are actually 5 volt motors. They didn't send me the motors I ordered.

So now I have a program that I can use to step these 5 volt motors one step every time I press a switch on my Arduino breadboard, and pressing another switch changes the direction to move the motor. I can move the 5 volt motors one step at a time in either direction.

But when I connect the same setup to the "real" motors that I want to control in the robot, it's another story. With the first couple of step commands I send it, it will move, then the next step it will move back in the other direction. The effect is that the successive step commands just make it "twitch".

Any thoughts?

All I know is that I have the correct two pairs of wires for each phase of the motor - as verified by checking the resistance with a multimeter. I don't know which should be 1A/1B and 2A/2B, as referenced in the pinouts in the Pololu card. Does it matter?

Or does it matter what the delay is when sending a step command to the card?

Or could it be the current limit setting in the Pololu card?

Never mind! I got it working (!) I just went through every possible combination of the ordering of the 4 wires and eventually stumbled upon an order that worked. Nothing like trial and error when you don't understand a system! Now onto the control of the DC motors. Thanks for all the help!