Speed Stepper Motor

Hello Everyone!

I have a robot with 4 wheels controlled by 4 stepper motor.

Stepper motors are this, with EasyDriver 4.4 and i'm using Accelstepper library to run the robot.

I'm using setSpeed() and runSpeed() for moving wheels, and i've setted a maxSpeed() of 5000, but the robot seems to can't overcome friction.

If i set a maxSpeed() more of 5000 it seems that nothing change.

How can i go my steppers as fast as possible to make the robot run?

PS. This is the code to run with bluetooth HC-06

#include <AccelStepper.h>
#include <SoftwareSerial.h>

int rx = 3;
int tx = 2;

SoftwareSerial bluetooth(rx, tx);

AccelStepper stepperAnteriore1(AccelStepper::FULL2WIRE, 4, 5);
AccelStepper stepperAnteriore2(AccelStepper::FULL2WIRE, 11, 12);
AccelStepper stepperPosteriore1(AccelStepper::FULL2WIRE, 9, 10);
AccelStepper stepperPosteriore2(AccelStepper::FULL2WIRE, 6, 7);


int spdA1 = 0;
int spdA2 = 0;
int spdP1 = 0;
int spdP2 = 0;
int signA = 1; 
int signP = - 1;

void setup()
{  
  Serial.begin(9600);
  bluetooth.begin(9600);
  stepperAnteriore1.setMaxSpeed(5000);
  stepperAnteriore2.setMaxSpeed(5000);
  stepperPosteriore1.setMaxSpeed(5000);
  stepperPosteriore2.setMaxSpeed(5000);
  stepperAnteriore1.setSpeed(0);
  stepperAnteriore2.setSpeed(0);
  stepperPosteriore1.setSpeed(0);
  stepperPosteriore2.setSpeed(0);  
}

void loop()
{    
  char c;
  while(bluetooth.available()) {
    c = bluetooth.read();
    if (c == 'f') {  // Go
      signA = 1;
      signP = -1;
      
    }
    if (c == 'r') {  //Reverse
      
      signA = -1;
      signP = 1;
      
    }
    if (c == 's' || y == 1) {  // Stop
      signA = 0;
      signP = 0;
      
    }
    if (c == '1') {  //Go slower / Faster
      if (spdA1 >=5000) { spdA1 = 3000;} else { spdA1 += 1000; }
      if (spdA2 >=5000) { spdA2 = 3000;} else { spdA2 += 1000; }
      if (spdP1 >=5000) { spdP1 = 3000;} else { spdP1 += 1000; }
      if (spdP2 >=5000) { spdP2 = 3000;} else { spdP2 += 1000; }
    
    }

    if (c == '4') {  // Forward
      signA = 1;
      signP = -1;
      
      spdA1 = 1000;
      spdA2 = 1000;
      spdP1 = 1000;
      spdP2 = 1000;
    }
    
    if (c == '2') {  // turn left
      spdA1 = 3000;
      spdA2 = 5000;
      spdP1 = 5000;
      spdP2 = 3000;
    }
    if (c == '3') {  // turn right
      spdA1 = 5000;
      spdA2 = 3000;
      spdP1 = 3000;
      spdP2 = 5000;
    }

    stepperAnteriore1.setSpeed(signA * spdA1);
    stepperAnteriore2.setSpeed(signA * spdA2);
    stepperPosteriore1.setSpeed(signP * spdP1);
    stepperPosteriore2.setSpeed(signP * spdP2);
  }
  stepperAnteriore1.runSpeed();
  stepperAnteriore2.runSpeed();
  stepperPosteriore1.runSpeed();
  stepperPosteriore2.runSpeed();

That motor seems to require 1.7amps. An Easydriver can only provide a max of 750mA. You need a Pololu DRV8825 at least.

Also "FULL2WIRE" is wrong for an Easydriver or 8825. You should use "DRIVER"

What power supply are you using for the motors (volts and amps)? Higher voltages help with higher step speeds.

...R
Stepper Motor Basics

Thanks for your reply.

I'm using a Lafayette Battery SW 1272 that provides 12V and 7.2 AH.

So, i need to change driver and the FULL2WIRE section at least?

That battery may be OK for testing - but you need to post a link to its datasheet. I presume it is rechargeable.

Stepper motors are very inefficient. Don't expect the battery to keep them going very long. Each motor will probably draw over 3 amps (2*1.7) continuously - even when stationary..

Simple DC motors are much more suitable for battery powered projects because thay only use power while they are moving, But they don't have position control - if that is important.

...R

Unfortunately i can't use DC motors, because the robot is alrady assembled with stepper motors and i can't ask to change it (i'm at work).

The datasheet of my battery is this, and yes, it is rechargeable.

I see that those stepper are often in vibration without work properly, at this point i only want that steppers do their work as properly as possible.

That looks like a lead-acid battery - but the data sheet does not mention that.

It should work fine but, as I said, it won't drive the motors for long. Make sure you do not leave it in a discharged state if you want it to last. Recharge fully immediately after use.

...R

AccelStepper is limited to 4000 steps/second, if you read the comments.

Steppers are extremely power hungry, almost never the right choice for a wheel as
the battery life will be orders of magnitude less.

What is the actual problem? What does work right now?

You say that you want it to run fast, so we have an expectation that it does run, but not fast enough for your requirement.

Then you say that it won't overcome friction, which suggests that maybe it doesn't run. Maybe you aren't using the acceleration properly; a stepper motor can't instantly accelerate to maximum speed.

Then you say the motors are vibrating, which at least indicates some power is reaching the motors but now I'm starting to think that it's wired incorrectly.

Question: Does it run if you set a very slow speed?

If i use DRIVER when i declare my steppers, they run only 3 of 4 motors.
if i use FULL2WIRE is good, all motors run but with a lower speed.

The mistake is that it won't overcome friction, because the speed is too low i think, and so the robot don't move.

I really don't know how to solve this problem. Any ideas?

If you are using the DRV8825 you must use DRIVER, that is the only mode that
drives step/dir interfaces. Sounds like one of your DRV8825's is miswired or there's a
bad connection, so that short step pulses are being lost somehow, which is why FULL2WIRE
is managing to get something happening (no short pulses).

You are trying to drive 1.7A motors with a 0.75A driver, which is probably why you get less torque
that in needed. Steppers have more torque at low speed, this is nothing to do with the speed
being too low, more likely you are failing to ramp up slowly enough.

You may also have more mechanical load than the motors can drive, to analyze that you need
to look at the mechanical arrangement. Traction wheels would normally be driven via a DC
gearmotor where the gearing boosts the torque by a large factor.

I'm using an Easy Driver 4.4.

I know that he provide only 750mA, but anyway the steppers starts run and the wheels spin.

But when i place the robot on the floor, hes unable to run.

I repeat that if i use DRIVER, not all motors run. sometimes 2, sometimes 3.

Maybe the robot is too heavy? or at this point there aren't definetly no way to run robot with this stepper motors?

Then I repeat you have some wiring issue if DRIVER isn't working, this is well tried technology
running in every 3D printer out there. You want help, you have to listen...
Your circuit may be flaky in some way we can't guess until we see full details of how you've
connected everything.

And I repeat for 1.7A motor you shouldn't be using a 0.75A driver if its not developing enough
torque - this isn't rocket science.

And again I repeat steppers are not the right choice for traction, you have all sorts of resonance
issues that can bite you as well as less torque with no gearing...

So here's a plan: First review your wiring to ensure you have common star-grounding for all the
components, completely separate power for motor drivers and Arduino, good cable layout (twisted
pair is a really good idea for all high current cables BTW).

Get some DRV8825 modules's, set them to 1.5A or so (1.7 is maybe going to push them too hot),
and see if you get enough torque then (no guarantee, we have no idea what torque is actually
needed - that's mechanics and really that's where you should have started, determining or measuring
the maximum torque requirement....)

Also try various microstepping ratios from 1/4 to 1/16th. Full steps are the worst for resonance issues
and should be avoided.

Make sure your supply has enough current capability and that high current connections are sound
(not breadboarded if possible, breadboards are not designed for high current).

You can also investigate if a gear stage can be added to the motors you have - even 3:1 ratio
might gain you much more solid behaviour when loaded on the floor.

Thank you for your help.

I've tried to say at work that those driver are not good for steppers, than they provided me a RAMPS 1.4 for Arduino Mega.

Is that good for power the steppers? if yes, how can i use it? i'll never see it before

ELKri:
a RAMPS 1.4 for Arduino Mega.

Is that good for power the steppers? if yes, how can i use it? i'll never see it before

That would be much better, although if it has A4988 stepper drivers they will be struggling with 1.7 amps and will probably need heat sinks.

As far as how to use it is concerned read all you can from Google to get the background information. It is not reasonable to expect us to spend time on stuff that is readily available on the internet.

...R

Here a little sketch for RAMPS 1.4 to Arduino Mega Pins
(RAMPS 1.4 and Mega 2650 Arduino Pin numbers)

DC motors, because the robot is alrady assembled with stepper motors and i can't ask to change it.You are trying to drive 1.7A motors with a 0.75A driver, which is probably why you get less torque
that in needed. Steppers have more torque at low speed, this is nothing to do with the speed
being too low, more likely you are failing to ramp up slowly enough.

I am confused by Reply #15. I thought the person with the problem is @ELKri. How does @aakritiroy know whether the robot is already assembled?

Also I don't understand the use of the words "DC motors" on line one?

...R

Hello.

I've bought some DRV8825 Driver now.

Did i have to change my code for running steppers with this Driver?
Or my previous code is still ok?

IIRC your original code was wrong for the Easydriver because it was using FULL2WIRE when it should have been using DRIVER.

The "DRIVER" option is also the one to use with a DRV8825.

...R

Thank you, I'll try this!

Last question, sorry but I'm kinda noob about electronics: How can i measure the current released by DVR8825?
I don't want to go over 1.5A for not get damage on my steppers.

I have a tester but i'm not sure how to use it in this case.