Go Down

Topic: Stepper motor too weak (Read 1 time) previous topic - next topic

dodoka

Oct 30, 2018, 11:01 pm Last Edit: Oct 30, 2018, 11:01 pm by dodoka
Hi guys,

I want to make a simple drummer-robot. Just one stepper motor (SL42STH40-1684A, Nema 17, Current per phase: 1.68A,Holding torque: 3.6 Kg·cm (0.4 N·m),Moment of inertia: 54 g/cm^2) and a 15cm long fiberglass arm with a small wieght at the end.

I only want a steady beat of 25-60 bpm. Thats not even fast...

My problem is, that the motor is way too weak to turn if the arm is attatched... Without it, it works but after adding weight it´s not working, stuttering, loosing steps etc.


I was using this guide :https://howtomechatronics.com/tutorials/arduino/how-to-control-stepper-motor-with-a4988-driver-and-arduino/

What can I do? I tried:

-increasing the current --> Less stuttering, but still loosing steps and still too slow.
-microstepping --> same as with full step, at least not really better
-increasing/decreasing motor voltage: not better
-decreasing/increasing the delayMicrosconds() in the code (not really better, slower turning when increasing, faster when decreasing but more stuttering)


I think the motor should be strong enough... Maybe a slower starting acceleration? Kind of ramping the acceleration up? How can I do this? I have a 3D Printer which I think needs way more torque and speed and it´s the same motor and same driver....

Thanks in advance! ;)

ChrisTenone

The problem is either in the code or the circuit.
What, I need to say something else too?

dodoka

#2
Oct 31, 2018, 07:45 am Last Edit: Oct 31, 2018, 07:58 am by dodoka
It has to be the code :D
Vref is 0,7V which equals to 1,75A which should be enough.

And the rest of the circuit should be fine.

Cheers

PaulS

Quote
Nema 17
So, we know what the mounting holes look like. But, what color is it?

Quote
and a 15cm long fiberglass arm with a small wieght at the end.
A dwarf star is small. Is that what you used for the "wieght"?

Quote
I only want a steady beat of 25-60 bpm. Thats not even fast...
The number of beats per minute is a function of the number of steps that the motor needs to take. THAT is the number that is important. THAT is the number you failed to tell is.

Quote
I think the motor should be strong enough.
Well, talk to it then. Obviously, it disagrees with you. Or, it is just being lazy. Tell it to shape up!

Quote
I have a 3D Printer which I think needs way more torque and speed and it´s the same motor and same driver....
Facts are FAR more important than what you think.

Quote
Vref is 0,7V which equals to 1,75A which should be enough.
What Vref? As measured how? Using what power supply?

There are so many details missing from your post that it is impossible to determine what the problem is.
The art of getting good answers lies in asking good questions.

dodoka

I wrote the Motor size, so that you guys have a general idea about the size of the motor opposed to the 15cm arm, sorry for providing additional information! I didn't weigh the "ball" at the end of the rod, it's about as heavy as a M5x14, and I can change it by screwing in different sized screws. Look at the picture.

The number of steps is variable. Depends on the bpm AND how big of an dirve-angle I have to use to gain enough speed to be loud enough. So yeah no concrete numbers here.

-"Facts are FAR more important than what you think."
Please tell me where I can find the facts. That's why I need help...

-"What Vref"
Since I posted a link using a A4988 driver you could guess which Vref I'd mean.

Thank you for not really helping me at all. It seems like you just ignored the last paragraph of my post ;)



vinceherman

#5
Oct 31, 2018, 04:25 pm Last Edit: Oct 31, 2018, 04:26 pm by vinceherman
Hi dodoka, welcome to the forum.

It appears that you are offended by the response to your request for help.  Don't be.  It is fairly typical for the experienced members of this forum to point out how the information you provided in your request for help does not match up with the information that is actually required to solve the issue.

This is not done out of spite.  It is done because new forum members like yourself simply do not know how to describe the details accurately.  The intent is to educate you so that you can give us what is needed to help you.

Now, let me throw in my 2 cents worth on the issue.  Post the code. (don't forget to use code tags)  This will let us see what you are trying to do.

I am curious, have you considered using acceleration?  For high power or fast applications, this lets the motor get things moving with less tendency to skip steps.

dodoka

Hi Vinceherman,

I'm not really offended, I'm just adjusting to the tone :P And I don't see where I could give more Information. And he didn't ask for specific information, he just pointed out, that I give unnecessary. He could have told me to give this and that parameters etc. And I would have gladly supplied them. ;)

Anyways
I don't have the code anymore, because I adjusted it and deleted it after it didn't work. (I don't know why... ^^) But it was the same as in the posted link. I only changed the pins (tried different ones).

"I am curious, have you considered using acceleration?  For high power or fast applications, this lets the motor get things moving with less tendency to skip steps."

I asked this at the end of my post. How can I do this?

Cheers


vinceherman

I asked this at the end of my post. How can I do this?
HAHAHAHAH  I guess I skiped the last paragraph too!  :-D

There is a library for this.  AccelStepper
I have not used it myself but I have read enough posts where it was the fix that I wanted to point it out.
Yes, AccelStepper.  I just googled it. 

Northof49

Not all A4998 drivers have the same resistor values, and that of course affects the reference voltage at a given current.  I bought cheap ones on ebay, and they were not the same specs as the more famous manufacturer.  I had to use a magnifying glass to read the number on the surface mount resistors.

If you can find the specs for your stepper motor, it should give you torque specifications, that will allow you know if what you are trying to do is possible.  You can buy steppers with gear boxes that multiply the torque, if more torque is needed, but of course that will slow them down proportionally.

dodoka

HAHAHAHAH  I guess I skiped the last paragraph too!  :-D

No worries :D

There is a library for this.  AccelStepper
I have not used it myself but I have read enough posts where it was the fix that I wanted to point it out.
Yes, AccelStepper.  I just googled it. 
Thank you! I already did a bit of research and also found AccelStepper as a possible solution. Didn't have time to test it though. But I'll look into it tomorrow.

@Northof49:
Yeah I searched for the right Vref value on the Reprap wiki. They said, that the current sensing resistor is 0,05Ohm on the original ones and about 0,1Ohm on Chinese ones. Since the drivers are from a Chinese 3D printer, I guess it could be a 0,1Ohm resistor. I have to check ;) Almost forgot!

Johan_Ha

#10
Oct 31, 2018, 10:03 pm Last Edit: Oct 31, 2018, 10:04 pm by Johan_Ha

Just wanted to look at the picture without downloading it to my Downloads folder.
____________________

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.

Northof49

What voltage are you running the motor at?
Are you certain you have the motor wired up correctly?  Check the continuity of the two coils with an ohmmeter and make sure it matches up with how you have it wired.  Some  motors have different layout for the stepper motor coils.

dodoka

@Johan_Ha Sorry^^ It was late and I didnt want to search for an online pic-hoster.


@Northof49 12V

I managed to get the motor running without stuttering and without loosing steps :)

BUUUUT my code doesn´t work now^^

Code: [Select]
#include <AccelStepper.h>
#include <Wire.h>
//#include <LiquidCrystal_I2C.h>

// Definiere den Stepper mit den Pins
AccelStepper stepper(AccelStepper::DRIVER, 9, 8); //PIN 9 Step, PIN 8 DIR
// Definiere den LCD mit den Pins
//LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

//Define
int en = 10;
int down = 0;
int up = 1;
int enter = 2;
int led1 = 3;
int led2 = 4;
bool warten = false;

//----------------------------------------------------------------------------------------------------------------------------

void setup()
{
  //Definiere Pins
  pinMode(en , OUTPUT);
  pinMode(down , INPUT_PULLUP);
  pinMode(up , INPUT_PULLUP);
  pinMode(enter , INPUT_PULLUP);
  pinMode(led1 , OUTPUT);
  pinMode(led2 , OUTPUT);
  //Definiere Stepper
  stepper.setMaxSpeed(1000);
  stepper.setAcceleration(5000);
  // Initialisiere den lcd
  //lcd.init();                       
  //lcd.backlight();
  stepper.move(50);
}

//----------------------------------------------------------------------------------------------------------------------------

void loop()
{
stepper.run();
if (stepper.distanceToGo() == 0){
      if (warten == false){
      stepper.move(50);
      warten = true;
      }
      if (warten == true){
      stepper.move(-50);
      delay(1000);
      warten = false;
      }   
}
}


It just goes in one direction with 1s delay. I want it to make a fast forward->backward motion, then wait for 1s and then fast forward->backward again and so on.

The commented LiquidCrystal_I2C lib and other pin definitions are for the future, where I plan to use a small display and buttons for a menu. For now, I just want it to play the drum with one fixed frequency :)

PaulS

You have the delay in the second if body. It should be AFTER the second if body (which really should just be an else statement).

You COULD print the value returned by distanceToGo(), to see that it actually hits 0.

You COULD print "Stepping positive" and/or "Stepping negative" in the appropriate blocks, to make sure that you don't have a wiring issue.

If you see "Stepping negative" and the distanceToGo() value decreases, but the stepper doesn't move, it is NOT a coding problem.
The art of getting good answers lies in asking good questions.

dodoka

Code: [Select]
#include <AccelStepper.h>
#include <Wire.h>
//#include <LiquidCrystal_I2C.h>

// Definiere den Stepper mit den Pins
AccelStepper stepper(AccelStepper::DRIVER, 9, 8); //PIN 9 Step, PIN 8 DIR
// Definiere den LCD mit den Pins
//LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

//Define
int en = 10;
int down = 0;
int up = 1;
int enter = 2;
int led1 = 3;
int led2 = 4;
bool warten = false;

//----------------------------------------------------------------------------------------------------------------------------

void setup()
{
  //Definiere Pins
  pinMode(en , OUTPUT);
  pinMode(down , INPUT_PULLUP);
  pinMode(up , INPUT_PULLUP);
  pinMode(enter , INPUT_PULLUP);
  pinMode(led1 , OUTPUT);
  pinMode(led2 , OUTPUT);
  //Definiere Stepper
  stepper.setMaxSpeed(1000);
  stepper.setAcceleration(5000);
  // Initialisiere den lcd
  //lcd.init();                       
  //lcd.backlight();
  stepper.move(50);
  Serial.begin(9600);
}

//----------------------------------------------------------------------------------------------------------------------------

void loop()
{
stepper.run();
if (stepper.distanceToGo() == 0){
      if (warten == false){
      stepper.move(-50);
      warten = true;
      Serial.print("Plus");
      Serial.print(stepper.distanceToGo());
      }
      else{
      stepper.move(50);
      Serial.print("Minus");
      Serial.print(stepper.distanceToGo());
      warten = false;
      }
      } 
     
}


Like this?

Now the stepper moves forward and backward (yay!), buts doesn´t pause. I don´t know where to put the delay :/

I tried different places (inside the if/else afterwards) it stopped after the forward AND backward motion :(

Thanks for the tip with printing the values. I only programmed with Bascom Basic, where I didn´t use a serial output. Arduino is much easier in that regard :D

I get "Plus-50Minus50Plus-50Minus50Plus-50Minus50Plus-50Minus50Plus-50Minus50Plus-50Minus50Plus-50" on the monitor. "Plus-50" and "Minus50" alternating as expected.

Go Up