Go Down

Topic: Unable to move stepper Motor (Aurdino Mega + CNC Shield + DRV8825) (Read 5110 times) previous topic - next topic

dasoe

JackBlack: Thank you so much!
I struggled a long time with 103-547-52500 and DRV8825 (not on a shield -wired to my Arduino lossely). In the end it was as simple as changing the pins from Arduino to DRV8825! Thanks!
So on Arduino UNO I get it to work correctly with the following test code:

Code: [Select]
// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing

byte directionPin = 2;
byte stepPin = 3;
int numberOfSteps = 200;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 250; // milliseconds - or try 1000 for slower steps


void setup() {

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
 
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
 
 
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
    digitalWrite(stepPin, LOW);
   
    delay(millisbetweenSteps);
   
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
 
  delay(3000);
 

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    // delayMicroseconds(pulseWidthMicros); // probably not needed
    digitalWrite(stepPin, LOW);
   
    delay(millisbetweenSteps);
   
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

void loop() {
}


and wiring as AWS_Support did:
Red(A2) - Blue
Black(A1) - Orange

White(B2) - Red
Yellow(B1) - Yellow

Go Up