Trouble with Motor Driver

I’m trying to drive a stepper motor with the adafruit stepper shield:

Here’s the stepper I’m using:

I’m powering it with a 12v battery, separate from the arduino’s power. My problem is, when I give it power it just jitters. I assumed this was a problem with the order the motor coils trigger so I switched the wires around in every configuration possible to no avail.

The code I used is the sample code straight from the adafruit library. Should just make the shaft spin. Here’s my code:

/*
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won’t work with v1.x motor shields! Only for the v2’s with built in PWM
control

For use with the Adafruit Motor Shield v2
----> http://www.adafruit.com/products/1438
*/

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include “utility/Adafruit_PWMServoDriver.h”

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Stepper test!”);

AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz

myMotor->setSpeed(1); // 10 rpm
}

void loop() {
Serial.println(“Single coil steps”);
myMotor->step(100, FORWARD, SINGLE);
//myMotor->step(100, BACKWARD, SINGLE);
/*
Serial.println(“Double coil steps”);
myMotor->step(100, FORWARD, DOUBLE);
myMotor->step(100, BACKWARD, DOUBLE);

Serial.println(“Interleave coil steps”);
myMotor->step(100, FORWARD, INTERLEAVE);
myMotor->step(100, BACKWARD, INTERLEAVE);

Serial.println(“Microstep steps”);
myMotor->step(50, FORWARD, MICROSTEP);
myMotor->step(50, BACKWARD, MICROSTEP);
*/
}

I attached a picture for wiring.
Anyone see what’s wrong with this picture?

That's a 6-wire motor so it will need 24V to work in bipolar configuration (centre-taps not connected). From 12V your best bet is use an ULN2803 and wire as unipolar.

I have a 4-wire stepper with very similar specs and it runs on 12v but runs faster on higher voltages.

It's not clear from the datasheet whether the 38 ohm resistance is for the full coil or half of the coil.

You would be better off driving the motor as a bipolar motor with a proper stepper motor driver board such as the Pololu A4988 (which is what I have). That shield is really designed for controlling DC motors and doesn't (afaik) have the ability to limit the current (to protect the motor) when you use a high voltage power supply.

...R

MarkT:
That’s a 6-wire motor so it will need 24V to work in bipolar configuration (centre-taps
not connected).

If the center taps are in parallel then it shouldn’t matter that both connected to the same power source, they’ll each get 12v. It’s a unipolar motor, so I’m pretty sure they are.

Robin2:
You would be better off driving the motor as a bipolar motor with a proper stepper motor driver board such as the Pololu A4988 (which is what I have). That shield is really designed for controlling DC motors and doesn’t (afaik) have the ability to limit the current (to protect the motor) when you use a high voltage power supply.

They advertise that it can control 2 12v steppers, so I’m not convinced this won’t work. I see what you’re saying about the lack of current limiting.

Gosh. After a few hours of futzing with the wire configurations I determined that the wire colors on the motor did not match those on the data sheet. Multimeter to the rescue! The resistance of each coil is the same, ~40ohms. So across both it measured ~80, which told me which wires were the cores.

CPME: They advertise that it can control 2 12v steppers, so I'm not convinced this won't work. I see what you're saying about the lack of current limiting.

I'm sure it will work. I just said that a proper stepper driver would be better - and much easier to work with.

...R

That motor driver is all H-bridges, so it can’t easily drive in unipolar fashion, which would be a
12V supply. In bipolar configuration a 6-wire-stepper only allows the coils to be in series, so
24V would be the nominal supply to use (in other words its an 80 ohm motor for bipolar use,
40 for unipolar).

Having said that you get the benefit of using all the windings in bipolar mode, so it ought to
work at 12V bipolar, but not at full rated torque.

Hi, did you say you had posted a circuit diagram, I can’t find it.

Tom… :slight_smile: