Monster Motor shield stepper motor Help

I am currently not understanding how thing work and i need some help.

what i am trying to do is the make my bipolar stepper motor work but i just cant get it to work correctly , i'm using a monster motor shield that is on top of the arduino :

This is what i have so far:

The code for the arduino i am using is this here, i'm also thinking it might be a code problem :

the thing i want to do is just to get the motor moving in any direction but when i run this code the motor vibrates and wont move.

#include <Stepper.h>

const int stepsPerRevolution = 100; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on the motor shield
Stepper myStepper(stepsPerRevolution, 4,7,8,9);

// give the motor control pins names:
const int pwmA = 7;
const int pwmB = 8;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 8;
const int dirB = 9;

int x = 0;
void setup() {
Serial.begin(9600);
// set the PWM and brake pins so that the direction pins // can be used to control the motor:
pinMode(pwmA, OUTPUT);
pinMode(pwmB, OUTPUT);
pinMode(brakeA, OUTPUT);
pinMode(brakeB, OUTPUT);
digitalWrite(pwmA, HIGH);
digitalWrite(pwmB, HIGH);
digitalWrite(brakeA, LOW);
digitalWrite(brakeB, LOW);

// initialize the serial port:
Serial.begin(9600);
// set the motor speed (for multiple steps only):
myStepper.setSpeed(200);
}

void loop() {

myStepper.step(48);
myStepper.step(-48);

delay(40);

}

What is the motor?

What is the motor shield?

How are you powering the motor shield?

Note that wires from the motor should be twisted or bundled together, not spread out
making large loops, otherwise you'll have a lot of em noise flying around everything.

Please draw a schematic of all your connections and take a photo of it with your cell phone and post it.
Identify your motor power supply and take a photo of that.
Where did you get the code you are using ?

this is the link to the motor http://radionics.rs-online.com/web/p/stepper-motors/5350502/

and this is the link to the monster moto shieldhttps://www.sparkfun.com/products/10182

for the power supply i am using 12V 1Amp. ok thanks they are bundled up now.

this is the scematic :

i got the code from this forum post: Arduino Motor Shield R3 Help - Motors, Mechanics, Power and CNC - Arduino Forum

I am thinking that it might be something with the pin numbers in the code ,i'm new to the programming in arduino and dont fully understand it yet but i'm trying my best.

Which Reply# did you get the code from at the other post ?
There are several code examples posted and none of them match yours exactly . Did you change the code you got from the other post ? If not , which Reply# did you get the code from ?
This is your code:

 #include <Stepper.h>
  const int stepsPerRevolution = 100;  // change this to fit the number of steps per revolution
                          // for your motor
  // initialize the stepper library on the motor shield
 Stepper myStepper(stepsPerRevolution, 4,7,8,9);     
  // give the motor control pins names:
 const int pwmA = 7;
 const int pwmB = 8;
 const int brakeA = 9;
 const int brakeB = 8;
 const int dirA = 8;
 const int dirB = 9;
  int x = 0;
void setup() {
 Serial.begin(9600);
 // set the PWM and brake pins so that the direction pins  // can be used to control the motor:
pinMode(pwmA, OUTPUT);
 pinMode(pwmB, OUTPUT);
 pinMode(brakeA, OUTPUT);
 pinMode(brakeB, OUTPUT);
 digitalWrite(pwmA, HIGH);
 digitalWrite(pwmB, HIGH);
 digitalWrite(brakeA, LOW);
 digitalWrite(brakeB, LOW);

 // initialize the serial port:
 Serial.begin(9600);
 // set the motor speed (for multiple steps only):
 myStepper.setSpeed(200);
 }
 void loop() {
   myStepper.step(48);
  myStepper.step(-48);
  delay(40);
 }

This is a code example from the other post:

 #include <Stepper.h>
  const int stepsPerRevolution = 48;  // change this to fit the number of steps per revolution
                          // for your motor
  // initialize the stepper library on the motor shield
 Stepper myStepper(stepsPerRevolution, 12,13);     
  // give the motor control pins names:
 const int pwmA = 3;
 const int pwmB = 11;
 const int brakeA = 9;
 const int brakeB = 8;
 const int dirA = 12;
 const int dirB = 13;
 
 int x = 0;
void setup() {
 Serial.begin(9600);
 // set the PWM and brake pins so that the direction pins  // can be used to control the motor:
pinMode(pwmA, OUTPUT);
 pinMode(pwmB, OUTPUT);
 pinMode(brakeA, OUTPUT);
 pinMode(brakeB, OUTPUT);
 digitalWrite(pwmA, HIGH);
 digitalWrite(pwmB, HIGH);
 digitalWrite(brakeA, LOW);
 digitalWrite(brakeB, LOW);
 
 // initialize the serial port:
 Serial.begin(9600);
 // set the motor speed (for multiple steps only):
 myStepper.setSpeed(2);
 }
 
 void loop() {
   myStepper.step(48);
  myStepper.step(-48);
  delay(2000);
 }

Do you see the differences ?
YOURS

 Stepper myStepper(stepsPerRevolution, 4,7,8,9);     
  // give the motor control pins names:
 const int pwmA = 7;
 const int pwmB = 8;
 const int brakeA = 9;
 const int brakeB = 8;
 const int dirA = 8;
 const int dirB = 9;

CODE FROM OTHER POST

 // initialize the stepper library on the motor shield
 Stepper myStepper(stepsPerRevolution, 12,13);     
  // give the motor control pins names:
 const int pwmA = 3;
 const int pwmB = 11;
 const int brakeA = 9;
 const int brakeB = 8;
 const int dirA = 12;
 const int dirB = 13;

MOTOR SPECS

Specifications
Current Rating 2.8 A (YOUR POWER SUPPLY: 1 Amp)
Frame Size 56.4 x 56.4mm
Holding Torque 1.26Nm
Number Of Wires 4
Resistance Per Phase 0.9?
Shaft Diameter 6.35mm
Shaft Length 19mm
Step Angle 0.9°
Stepper Motor Type Hybrid, Permanent Magnet
Voltage Rating 2.5 V

What's wrong with this picture ?

Hey thanks for the reply yes i have been messing around with the values trying to figure out if it was a problem with them , i have been doing some looking around and found some code that is made for my shield this is the code:

/*  MonsterMoto Shield Example Sketch
  date: 5/24/11
  code by: Jim Lindblom
  hardware by: Nate Bernstein
  SparkFun Electronics
 
 License: CC-SA 3.0, feel free to use this code however you'd like.
 Please improve upon it! Let me know how you've made it better.
 
 This is really simple example code to get you some basic
 functionality with the MonsterMoto Shield. The MonsterMote uses
 two VNH2SP30 high-current full-bridge motor drivers.
 
 Use the motorGo(uint8_t motor, uint8_t direct, uint8_t pwm) 
 function to get motors going in either CW, CCW, BRAKEVCC, or 
 BRAKEGND. Use motorOff(int motor) to turn a specific motor off.
 
 The motor variable in each function should be either a 0 or a 1.
 pwm in the motorGo function should be a value between 0 and 255.
 */
#define BRAKEVCC 0
#define CW   1
#define CCW  2
#define BRAKEGND 3
#define CS_THRESHOLD 100

/*  VNH2SP30 pin definitions
 xxx[0] controls '1' outputs
 xxx[1] controls '2' outputs */
int inApin[2] = {7, 4};  // INA: Clockwise input
int inBpin[2] = {8, 9}; // INB: Counter-clockwise input
int pwmpin[2] = {5, 6}; // PWM input
int cspin[2] = {2, 3}; // CS: Current sense ANALOG input
int enpin[2] = {0, 1}; // EN: Status of switches output (Analog pin)

int statpin = 13;

void setup()
{
  Serial.begin(9600);
  
  pinMode(statpin, OUTPUT);

  // Initialize digital pins as outputs
  for (int i=0; i<2; i++)
  {
    pinMode(inApin[i], OUTPUT);
    pinMode(inBpin[i], OUTPUT);
    pinMode(pwmpin[i], OUTPUT);
  }
  // Initialize braked
  for (int i=0; i<2; i++)
  {
    digitalWrite(inApin[i], LOW);
    digitalWrite(inBpin[i], LOW);
  }
  // motorGo(0, CW, 1023);
  // motorGo(1, CCW, 1023);
}

void loop()
{
  motorGo(0, CW, 1023);
  motorGo(1, CCW, 1023);
  delay(500);

  motorGo(0, CCW, 1023);
  motorGo(1, CW, 1023);
  delay(500);
  
  if ((analogRead(cspin[0]) < CS_THRESHOLD) && (analogRead(cspin[1]) < CS_THRESHOLD))
    digitalWrite(statpin, HIGH);
}

void motorOff(int motor)
{
  // Initialize braked
  for (int i=0; i<2; i++)
  {
    digitalWrite(inApin[i], LOW);
    digitalWrite(inBpin[i], LOW);
  }
  analogWrite(pwmpin[motor], 0);
}

/* motorGo() will set a motor going in a specific direction
 the motor will continue going in that direction, at that speed
 until told to do otherwise.
 
 motor: this should be either 0 or 1, will selet which of the two
 motors to be controlled
 
 direct: Should be between 0 and 3, with the following result
 0: Brake to VCC
 1: Clockwise
 2: CounterClockwise
 3: Brake to GND
 
 pwm: should be a value between ? and 1023, higher the number, the faster
 it'll go
 */
void motorGo(uint8_t motor, uint8_t direct, uint8_t pwm)
{
  if (motor <= 1)
  {
    if (direct <=4)
    {
      // Set inA[motor]
      if (direct <=1)
        digitalWrite(inApin[motor], HIGH);
      else
        digitalWrite(inApin[motor], LOW);

      // Set inB[motor]
      if ((direct==0)||(direct==2))
        digitalWrite(inBpin[motor], HIGH);
      else
        digitalWrite(inBpin[motor], LOW);

      analogWrite(pwmpin[motor], pwm);
    }
  }
}

the motor is making a vibration but not moving in any direction .

Please redo your last post :

click the MODIFY button in the upper right of the post window.
Highlight all you code.
click the "#" CODE TAGS button on the toolbar above just to the left of the QUOTE button.
click SAVE (at the bottom).
When you post code on the forum, please make a habit of using the code tags "#" button.

What is the voltage on the motor power supply pins while you are trying to run the motor ?

MonsterMoto_Shield_Example.ino (2.98 KB)

Answer this question:

What's wrong with this picture ?

Specifications
Current Rating 2.8 A (YOUR POWER SUPPLY: 1 Amp)
Frame Size 56.4 x 56.4mm
Holding Torque 1.26Nm
Number Of Wires 4
Resistance Per Phase 0.9?
Shaft Diameter 6.35mm
Shaft Length 19mm
Step Angle 0.9°
Stepper Motor Type Hybrid, Permanent Magnet
Voltage Rating 2.5 V

( DOES THIS SPEC MEAN ANYTHING TO YOU ? )

for the power supply i am using 12V 1Amp.

Pop quiz:
1 How many phases does it take to drive a stepper motor when it is turning ?
2 How many phases does it take to drive a stepper motor when it is stopped ?
3 If the resistance per phase is 0.9 ohms and the power supply is 12V, how much current will the motor draw when you turn on
the power ? (keeping in mind the answers to #1 & #2)

I am currently not understanding how thing work and i need some help.

Ya think ?

PS-We need to talk

what power supply would be applicable to my project?

thanks.

Did you look at the datasheet for your motor before you connected it and powered it up ?

Answer the question. What's wrong with this picture ?

yes briefly, the current we are supplying is too low?

Voltage Rating 2.5 V
( DOES THIS SPEC MEAN ANYTHING TO YOU ? )

the voltage the supply was too high. would this damage the motor?

Did it get hot ?
If your lucky , the motor driver had more sense than you did and shut down.

No it didnt get hot. hopefully. Ok is the power supply i need 2.5V and 2.8 amps?

The perfect PS would be an adjustable 0 - 5V /3A power supply but you're not going to find a 2.5 V power supply so I don't know what you can do other than look for an adjustable one or make your own.
The 12V supply is not going to work for you because you would have to use a huge high wattage resistor to drop the voltage.
9V/3A= 3 ohms . 3A x 9V = 27Watts . (3 ohm/50W) would actually work.
The other problem is the 12V supply is only 1A so that would never work.
You need 2.5 to 3V at 3A.
If you have no experience with electronics you shouldn't build it yourself. You need look on the net for an adjustable power supply
rated for 3A . It's ok if the voltage range is higher than you need if it is adjustable.

ok thanks very much. is the code that I have the right code for the monster moto shield?

Did you install the library?

Ignore raschemmel, their answers are just plain wrong in this case.

The 2.8A is max current your motor can take, and 2.5V is the voltage across the windings while doing so. Your stepper controller does current regulation through PWM, so as long as you configure it with a current limit of no more than 1A (or up to 2.8A if your supply can do that; that will protect the motor from overheating), your supply will not be overloaded. The supply voltage needs to be much higher than the 2.5V in order to overcome the stepper's inductance while PWMing; 12V is good.

You will probably want to read the controller datasheet.

The fact that it wobbles indicates you are very close. Check that the current limit is indeed low enough (try about 0.3A) because if you overload your PSU it will probably be shutting down. It seems that you must manually set the current with the PWM setting yourself which is kind of bad because you need to apply more PWM power when the motor is at higher speed to achieve the same current (torque) while overcoming back-EMF. Anyway, try setting the PWM duty cycle to about 10% (26?), which should get you maybe 300mA per winding while stationary. You won't get much torque but that's OK.

Your wobble is probably because your step sequence is wrong, you have it going forward two then back two, etc. I think the way you have it wired is that "motor 0" is winding A, "motor 1" is winding B. Your main loop does this sequence:
+A/-B
-A/+B
etc

when what you need is:
+A/+B
+A/-B
-A/-B
-A/+B
etc. Note that only one winding changes for each step, and the direction that you proceed through this sequence defines the direction the motor goes. And change your loop delay to 10ms per step, it should start spinning slowly.