Go Down

Topic: Stepper Motor With Motor Shield R3 (Read 1 time) previous topic - next topic

maxwee2001

Here is the motor that I am using: http://www.farnell.com/datasheets/13415.pdf
I am going to be using it as unipolar.
I am going to connect the A,A/,B and B/ to the motorshield.

My questions is: What do I do with the COM wires? do I connect them to ground or just leave them not connected to anything.

Thanks for your help.

SolarPanels


I have a similar motor with 8 wires

if you want to hook it up as a uni try connecting 

BLK/WHT and RED/WHT together and to the A+

GRN/WHT and YEL/WHT together and to the B+

maxwee2001

I tried it the way you said but that did not work.
I connected all the COMs to ground and it did work but after a while the motor became really hot...
I don't think that the motor being that hot is normal... any ideas??

Erus

I was able to get this code to work on the R3. Too much interference to get clean motion with this method though. Its basically the knob control stepper, for the R3 board.

#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;

int previous = 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(30);
}


void loop() {
  // get the sensor value
  int val = analogRead(0);

  // move a number of steps equal to the change in the
  // sensor reading
  myStepper.step(val - previous);

  // remember the previous value of the sensor
  previous = val; 
}

Go Up