Unwanted micro stepping using the DRV8825

I have a DRV8825 hooked up to a Wantai Stepper Motor 42BYGHM809 (wantmotor.com/ProductsView.a … =75&sid=80) controlled by an Arduino Uno. The motor’s step angle is specified at .9 degrees thus requiring 400 steps for one full revolution. I would like to run the motor in full step mode: the problem is that I need to send 1600 pulses to turn the motor 1/4 revolution. The mode pins on the DRV8825 are not connected to anything and indeed they are pulled low when the circuit is running (I checked with a multimeter). Ideas?

Code:

int StepPin = 7;
int Dir = 8;
int StepDelay = 2000;

void setup() {
  pinMode(StepPin, OUTPUT);
  pinMode(Dir, OUTPUT);
  digitalWrite(Dir, HIGH);
}

void loop() {
  for (int i = 0; i < 1600; i++) {
    digitalWrite(StepPin, HIGH);
    delayMicroseconds(StepDelay);
    digitalWrite(StepPin, LOW);
    delayMicroseconds(StepDelay);
  }
  delay(500);
}




Also, the current limit has been set at slightly over 1A

The first thing to try is to increase the between-step delay substantially. You are probably trying to run the motor too fast (the code as posted results in about 250 steps/sec) and the motor is simply skipping steps.

PS: use the “Code” tabs to make your code easier to read

Thanks Jim but that doesn’t seem to be the problem. Using longer delay times (such as 50 milliseconds, 100 milliseconds or even one second), I am still seeing this slow performance. When I used a delay of 50 milliseconds and set the for loop to 400 (which should be one revolution), the motor would step 25 times (which is that same ratio as I noted before), and it seems the time it takes for each step is also a function of that ratio (and not the delay time specified in the code).

Have you wired up the DRV8825 exactly as described by the “minimal wiring diagram” as shown on this page pololu.com/catalog/product/2133 ? If not, it would help if you provided more details, especially concerning the motor power supply (the motor specs are 2.8V, 1.7 amp/phase). I don’t think anyone can tell much from the photos you’ve posted.

Hello.

Thank you for posting your code and pictures of your setup, though bigger pictures would be much more helpful. As Jim says, more details would also be helpful.

Can you try manually changing the microstepping mode to see how that affects the behavior? For example, what does the driver do if you put it in half-step mode?

- Ben

  • I have wired the DRV8825 exactly as specified on Pololu’s site (see pic of the other side of the circuit board). Logic power supply is 5v, motor power supply is 24v.
    - I put the driver into microstepping mode (1/2 step) and the distance traveled was 1/2 as far at 1/2 the step rate.

Are you sure you have the motor coils leads paired correctly? (It is difficult for me to see the colors in your picture.) Do you have larger versions of those pictures you could upload? I think the next logical step would be to go through all of the microstepping options and see what the effect of each is.

- Ben

The motor is hooked up according to the following (motor wire = driver pin):
blue = B2
red = B1
black = A1
green = A2

I’m happy to try the different microstepping functions.

I tried all of the microstepping functions, sending 800 pulses with a step delay of 5000 microseconds:

Full: motor outputs 47-48 steps and turns 1/8 of one rotation
1/2: 24 steps, turns about 1/16 of a full rotation, each step occurs at 1/2 the rate of a step in full step mode
1/4: same as 1/2 step mode
1/8: same as 1/2 step mode
1/16: about 34 or 37 steps, step rate same as full step mode, movement is erratic
1/32: same as 1/2 step mode, movement is erratic

I just tried the motor with Sparkfun’s Easy Driver and it worked as expected.

I apologize for my delayed reply. I am not sure what is going on, but at this point it might be easiest just to try with a new driver. If you email us with your order information and reference this forum thread, we should be able to help you out with a replacement.

- Ben