Hello,
This is my first post but I’m a total noob when it comes to robots. I have a question about a Motor Shield. I am using robotshop.com/adafruit-motor-shield-kit-arduino.html?utm_source=google&utm_medium=base&utm_campaign=jos
from Robotshop, along with this stepper motor from Pololu pololu.com/catalog/product/1208
My question is this what is the correct way to hook up the wires?
I have tried multiple combinations and the only reaction I get out of the motor is that it moves back and forth with no real movement. It just kinda shakes really fast. I am using this code
I am using the Arduino MEGA and a 7.2 volt Ni-MH battery
// 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); < – I have changed this from 48 to 200 and tried the other side of the motor shield by changing 2 to 1.
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);
}
I have changed multiple parameters in the code including changing the number of steps from 48 to 200 in the code.
The current wire combination I have is
(orientation of the board horizontal to my view I can read MEGA left to right and M4, Gnd and M3 are vertical. Sorry no camera)
So from my view I see it like so.
M4 = Green
M4 = Blue
Gnd = null
M3 = black
M4 = Red.
As I said I have tried multiple combinations and changes to the code. I have read the tutorial and I have tried “The center taps should both be connected together to the GND terminal on the motor shield output block. then coil 1 should connect to one motor port (say M1 or M3) and coil 2 should connect to the other motor port (M2 or M4).” In every which way I can think of.
Is my problem a Hardware, Code, or power problem. I have some lipos lying around but they are quite large and I don’t want to risk seeing the magic smoke again. The smallest lipo I have is 3 cell 11.1V 2650 mAh.
My goal is to have the motors move a device forward and backwards. Essential I’m using it for wheels. If I could get some help getting this code to work I can figure out how to input the sensor data I want.
Thank you