I'm using an external 12v power source. I'm connecting the yellow and red wires to M3 and brown and black to M4.
Using AccelStepper.h results in jumpy movements, the motor spins forward but turns back every now and then.
Using just AFMotor.h is a bit better - StepperTest (copied below) actually works, but it will only go forward, not backwards. Besides, the motor, the h-bridge chip on the shield and my power supply get really hot fast. I can't touch the chip for more than a second or so.
I tested in a unipolar stepper and it works like a charm, both AccelStepper and AFMotor. Maybe there's some configuration I'm missing here? I tried different wiring combinations but it only got worse.
Thanks for any insight!
Code: Select all
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!
#include <AFMotor.h>
// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor(48, 2);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
motor.setSpeed(10); // 10 rpm
}
void loop() {
Serial.println("Single coil steps");
motor.step(100, FORWARD, SINGLE);
motor.step(100, BACKWARD, SINGLE);
Serial.println("Double coil steps");
motor.step(100, FORWARD, DOUBLE);
motor.step(100, BACKWARD, DOUBLE);
Serial.println("Interleave coil steps");
motor.step(100, FORWARD, INTERLEAVE);
motor.step(100, BACKWARD, INTERLEAVE);
Serial.println("Micrsostep steps");
motor.step(100, FORWARD, MICROSTEP);
motor.step(100, BACKWARD, MICROSTEP);
}