DRV8825 motor beeping but not moving

Hello,
I m trying to build a balancing robot, the script is working but the stepper motor which is controlled by the DRV8825 is not moving but is making strange noises.

Script: https://github.com/MrGrimod/balancing-robot/blob/master/script.ino
Video: - YouTube

Post a link to the datasheet for your stepper motors.

Tell us what motor power supply you are using (volts and amps).

Have you properly set the current limit on the driver to match your motor?

Do the motors work with a simple test program?

...R
Stepper Motor Basics
Simple Stepper Code

Motors: https://www.amazon.de/Nema-14-BYGHW-stepper-motor/dp/B06XHPTY28/ref=sr_1_1?ie=UTF8&qid=1496763505&sr=8-1&keywords=35+BYGHW+Stepper+Motor

Powersupply: 3S Lipo

My test script is "working" the sound is changing relativ to the current posiotion of the robot.

MrGrimod:
My test script is "working" the sound is changing relativ to the current posiotion of the robot.

It is not working if the motors are not rotating properly.

Try the simple example in my earlier Reply and get that working first. That way you will know you have all the connections etc correct.

You have not said how you have adjusted the current limit on the driver board. If it is too low the motors won't work. If it is too high they will be damaged.

Those motors seem to require 1.2A per phase so about 3 to 4 amps for both motors. Your battery won't last long. And it is very bad for LiPos to discharge them too deeply. Stepper motors are very inefficient and not really suited to battery power.

...R

Stepper motor for a balancing robot is not ideal, mainly because steppers are simply a poor match for
any traction application - low efficiency, low speed, noisy and generate lots of vibration.

Anyway to sort your problem the first thing to do is use a simple piece of code to test your steppers
and stepper drivers, forget all the balancing stuff, just get the motors working and their top speed
and acceleration characterized first.

Ok, I tested the code snipped below but the motor is still buzzes and beeps and is getting warm independet from the poti position of the DRV8825 .

#include <Wire.h>    

byte directionPin = 9;
byte stepPin = 2 ;
int numberOfSteps = 5000;
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));
    Serial.println(n);
  }
  
  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() { 
}

This is the 3rd time of asking you how you have adjusted the current limit on the DRV8825?

Are you sure you have the motor coils connected the right way? Have you checked their resistance with your multimeter to be sure you have identified the two pairs of wires correctly.

...R

    // delayMicroseconds(pulseWidthMicros); // probably not needed

No, this line is necessary. Remove the // at the start of the line.

Stepper motors are supposed to get hot. That's what they do.

@Robin2 Ok, sry for my stupidity.
I increased the poti half way.
I connected everything as shown in this PDF: http://www.brokking.net/images/yabr/yabr-schematic_robot.pdf .
I am going to check out your tips when I am at home @Robin2, @MorganS!

Thx for replies.

@MorganS It worked but only once... :o and only when I pressed the screwdriver on the poti :confused: ?.

MrGrimod:
I increased the poti half way.

Giving it a random twiddle is not much use. There is a formal procedure for setting the current limit. Follow it.

...R

MorganS:

// delayMicroseconds(pulseWidthMicros); // probably not needed

No, this line is necessary. Remove the // at the start of the line.

How do you know?

I put in those comments :slight_smile:
For most drivers digitalWrite() is slow enough to produce a sufficiently long pulse.

Of course, making the line active will not do any harm.

...R

And where do I get this formal from? :slight_smile:

MrGrimod:
And where do I get this formal from? :slight_smile:

I had assumed you would have obtained it from whoever supplied your driver. The Pololu DRV8825 web page has good instructions. Be aware, however, that your board (assuming it is not from Pololu) may have different values for the current sense resistors.

…R