Go Down

Topic: NEMA 17 and A4988 driver - motor steps back for no reason (Read 3229 times) previous topic - next topic

Coding Badly


yafimski

@gspir

Not sure actually, I just know it should be a deal stronger than the simple single NEMA17. I think I'll get a geared NEMA and try that and see what happens :)

Thanks

yafimski

I am buying the motor at
http://www.omc-stepperonline.com/gear-ratio-271-planetary-gearbox-with-nema-17-stepper-motor-17hs130404spg27-p-249.html


Which is a "Gear Ratio 27:1 Planetary Gearbox With Nema 17 Stepper Motor 17HS13-0404S-PG27" motor.


I would like to ask, is my A4988 driver setup still relevant or do I need another driver?



Thanks.

Robin2

I would like to ask, is my A4988 driver setup still relevant or do I need another driver?
That motor only requires 0.4 amps so the A4988 should be fine.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

yafimski

Thank you!
I will update on any progress to say if the geared motor improved my experiments.

yafimski

Dear all,

After a lot of time, and probably the issue needs refreshing:

I switched my NEMA17 motor for a NEMA17 Geared motor, to have one with more power.

We struggled for a while with making it run, but after testing the coil resistance to 30ohms and the voltage of the driver set to 0.4 via the screw on the A4988 driver itself, we ran the following code:

Code: [Select]
#include <Stepper.h>

    // Defines pins numbers
    const int stepPin = 3;
    const int dirPin = 4;
   
    const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
    // for your motor
    Stepper myStepper(stepsPerRevolution, 2,3);
    int stepCount = 0;  // number of steps the motor has taken
   
    void setup() {
      // Sets the two pins as Outputs
      pinMode(stepPin,OUTPUT);
      pinMode(dirPin,OUTPUT);
      digitalWrite(dirPin,HIGH); //Enables the motor to move in a particular direction
    }
    void loop() {
          myStepper.setSpeed(20);
          myStepper.step( (5*200)/360 ); //this should move it around 2.7 steps at a time

    }




we tried changing the number in myStepper.setSpeed(20); to 10 and 2 but in all cases the motor moves really slow...

do you know why this is happening? how can we make the motor go faster?


Thank you!

Robin2

we tried changing the number in myStepper.setSpeed(20); to 10 and 2 but in all cases the motor moves really slow...
What do you mean by "really slow" - how many RPM?

And what part are you talking about - the output shaft will run much slower than the motor due to the reduction gearing.

The standard Stepper library is not intended for stepper drivers that take step and direction signals. Use the AccelStepper library with the DRIVER option. Or use my Simple Stepper Code for testing.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

yafimski

Thanks Robin2,

I will try the AccelStepper and the simple stepper code and report what happened.

About the motor, really slow means, to the best of my estimates, something like 1 RPM or less.. so basically not really practical speed for turning any kind of mechanisms that we want to test...

The geared motor we are using should be stronger, so the part I am talking about it the shaft of that geared motor. You're right about it running slower, I hope the codes I will test will show improvement, but perhaps also the number we used in the myStepper.setSpeed(20) was really low and should be much higher.


Thank you :)

yafimski

@Robin2 and the rest of the people that helped me out.

Thank you very very much!

With a geared motor and the following code, we are able to do some tests that we wanted with a constant speed.


Code: [Select]
byte directionPin = 4;
byte stepPin = 3;
int millisbetweenSteps = 100;


void setup() {

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
 
  digitalWrite(stepPin, HIGH);
  digitalWrite(stepPin, LOW);

}

void loop() {

  digitalWrite(stepPin, HIGH);
  digitalWrite(stepPin, LOW);

}



Thank you again! I'll be sure to write here again if any further problems arise but for now it's all good.

Go Up