Arduino Forum

Using Arduino => Motors, Mechanics, Power and CNC => Topic started by: ivandewolf1 on Feb 17, 2020, 02:09 am

Title: drv8825 not rotating, just vibrating
Post by: ivandewolf1 on Feb 17, 2020, 02:09 am

I was following this tutorial:
https://www.makerguides.com/drv8825-stepper-motor-driver-arduino-tutorial/
(https://twitter.com/ivandewolf/status/1229207347139993600/photo/1)

I altered the source code to make it step very slowly (note that I am using "delay()" not "delayMilliseconds()")
Code: [Select]

#define dirPin 2
#define stepPin 3
#define stepsPerRevolution 200

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
}

void loop() {

  digitalWrite(dirPin, HIGH);
  for (int i = 0; i < stepsPerRevolution; i++) {
    digitalWrite(stepPin, HIGH);
    delay(20);
    digitalWrite(stepPin, LOW);
    delay(20);
  }
  delay(1000);

  digitalWrite(dirPin, LOW);
  for (int i = 0; i < stepsPerRevolution; i++) {
    digitalWrite(stepPin, HIGH);
    delay(20);
    digitalWrite(stepPin, LOW);
    delay(20);
  }
  delay(1000);
 }



I have this motor:
https://datasheetspdf.com/datasheet/17HS4401S.html


I am using a 12v 2amp switching "wall wart" power supply
(https://pbs.twimg.com/media/EQ8FcSIVAAA-vTF?format=jpg&name=large)

the drv8825 looks identical to the Pololu, but does not have their logo.

I followed the advice in the tutorial and cautiously set the potentiometer so that my voltage meter read a vref of .5 volts, and tried an abcd and a bacd wiring; neither rotated.

I tried fiddling with the potentiometer, that did not make it rotate.

I read many people having similar issues , the main advice that I saw was to switch around which of the 4 stepper wires go to which of the 4 pins on the driver. Therefore, I tried all 7 possible combinations:
abcd
bacd
cbad
dbca
acbd
adcb
abdc

none resulted in a rotating motor. I tried swapping my drv8825 for another one (I bought a pack of 5) and got the same result. I tried switching my stepper motor for another from the box, and again, same result.

so, I have adjusted-
* the connections to the motor
* the settings on the potentiometer
* the number of steps per second (now very very slow)
* swapping parts

I have not tried other power supplies. perhaps this is the issue? is 12v 1a wrong? is a switching supply a bad idea?

is there perhaps something else wrong, that I have not tried?
is it possible the circuit in the tutorial needs modification?
anybody have any advice on what I might try?

Title: Re: drv8825 not rotating, just vibrating
Post by: ivandewolf1 on Feb 17, 2020, 02:26 am
(https://pbs.twimg.com/media/EQ8Fjg_UYAEfcUS?format=jpg&name=4096x4096)
Title: Re: drv8825 not rotating, just vibrating
Post by: groundFungus on Feb 17, 2020, 02:38 am
On the top power rail is the red + rail really ground and the blue - rail Vcc?  The bottom rail (motor power) is red + blue -.   Reset and sleep should go to + and the ground pin to -.
Title: Re: drv8825 not rotating, just vibrating
Post by: ivandewolf1 on Feb 17, 2020, 02:46 am
the top rail is reversed; I followed the circuit diagram in the makerguides tutorial pretty closely, and he had them swapped there. so, on the top rail, the one marked + is actually attached to ground on my arduino, and the one marked - is attached to vcc.
Title: Re: drv8825 not rotating, just vibrating
Post by: groundFungus on Feb 17, 2020, 02:57 am
That just seems to be a recipe for disaster, but it's your circuit.

I have wired up a DRV8825 stepper driver to my Uno and a stepper.  I loaded your code to the Uno and get the motion from the motor that i would expect from reading the code.

At any time during your troubleshooting did you disconnect the motor from the driver with the driver powered up?  That will instantly kill the driver.
Title: Re: drv8825 not rotating, just vibrating
Post by: groundFungus on Feb 17, 2020, 03:02 am
I think that I see a problem.  The motor connector needs to move one space to the right (towards the electrolytic cap).  As it is the black motor wire is plugged into the fault output.  See the drawing on the Pololu page (https://www.pololu.com/product/2133).
Title: Re: drv8825 not rotating, just vibrating
Post by: ivandewolf1 on Feb 17, 2020, 03:12 am
yikes! yes, I did disconnect while powered up, um... oops....

So, to test if this was the issue, I just opened up a brand new DRV8825 and dropped it in, same result. it just vibrates....
I powered it all off, and swapped one pair of connections, and still, it just vibrates...
Title: Re: drv8825 not rotating, just vibrating
Post by: groundFungus on Feb 17, 2020, 03:14 am
A couple of tutorials to help your understanding of steppers and drivers.

Stepper basics. (https://forum.arduino.cc/index.php?topic=284828.0)
Simple stepper test code. (https://forum.arduino.cc/index.php?topic=277692.0)
Title: Re: drv8825 not rotating, just vibrating
Post by: groundFungus on Feb 17, 2020, 03:16 am
Did you read reply#5?  Move the 4 motor coil wires over 1 breadboard column to the right.  Look carefully at the Pololu diagram on the page that I linked and compare that to your wiring.
Title: Re: drv8825 not rotating, just vibrating
Post by: ivandewolf1 on Feb 17, 2020, 03:17 am
DING DING DING DING DING!!! We have a winner! GroundFungus, good eye! I had the motor attached to the wrong pins! pebkac, I was an inattentive nitwit, thank you so much! woohoo!

SOLVED!
Title: Re: drv8825 not rotating, just vibrating
Post by: groundFungus on Feb 17, 2020, 03:23 am
Yay!