Go Down

Topic: Nema 14 with planetary gear 5:1 and power supply not getting along? (Read 437 times) previous topic - next topic

ivino

Jan 12, 2018, 11:16 am Last Edit: Jan 12, 2018, 12:30 pm by ivino Reason: I could find out how to correctly insert the image link
Hello

I am working with a high torque stepper motor(this one together with the A4988. I have connected the Arduino, the power supply and the motor to the driver according to https://www.google.dk/search?q=A4988+arduino&client=firefox-b-ab&dcr=0&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjI6uyYqdLYAhXNZVAKHbUSCusQ_AUICigB&biw=1830&bih=753#imgrc=yQy5vDBDGCVZ1M: . I am using the folowing simple code :
Code: [Select]
// defines pins numbers
const int stepPin = 4;
const int dirPin = 5;
 
void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);
void loop() {
  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
  // Makes 200 pulses for making one full cycle rotation
  for(int x = 0; x < 400; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(500);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);
  }
  delay(1000); // One second delay

}


But I find so many issues!

-The power supply gets shortcuted every second
-The motor, at  microcontoller restart, shortly turns many times in both directions, before starting with the full cycle turns every second.
-Sometimes it juts gets locked, and won't turn every second
-The turning direction changes every time I restart the microcontroller

What am I not grasping here?



groundFungus

Did you adjust the motor coil current (pot on the A4988 driver)?  Here is a guide on adjusting the coil current on A4988 drivers. 

What is the voltage and current rating of the power supply?

I don't see anything in the code that would cause your problems, so I must assume hardware.

How about a picture of your setup that, clearly, shows components and wiring?

Robin2

Your code seems to be trying to make the motor move 1000 steps per second. Start with a very much slower movement - say 5 steps per second.

...R
Stepper Motor Basics
Simple Stepper Code
Two or three hours spent thinking and reading documentation solves most programming problems.

groundFungus

Quote
trying to make the motor move 1000 steps per second
Sorry, I don't know why I missed that.  It is the same thing the test tube guy was doing.

MarkT

Start off with a simple test using the AccelStepper library with modest acceleration and speed settings first,
you certainly cannot expect a motor to go from stationary to 1000 steps/sec immediately, it will simply stall/miss-step as motors obey the laws of physics, not impossible demands.

You should add a physical pull-down resistor (1k to 10k range) to pin 4 so that the stepper behaves
during power-up and reset.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

ivino

Thanks for your answers guys. Well, even though I still cannot see how from my code I should tell the motor to move 1000 times per second, I started to troubleshoot by uploading Robin2's basic stepper code from his stepper basics thread (really helpful).

Well it did not work either! I started thinking that my bench power supply would be the problem, so I used a laptop converter at 19V.

It did not work.

But by accident when trying to read the voltage at the current limitor on the A4988, it worked! Simply by shortcutting GND and the current limitor I got the codes working. I do not know what this is due to. But I've ordered a new driver and I'll try again :-)

Thanks again,

/Ivan

groundFungus

Quote
I still cannot see how from my code I should tell the motor to move 1000 times per second
Code: [Select]
for(int x = 0; x < 400; x++) {
    digitalWrite(stepPin,HIGH);  
    delayMicroseconds(500);      
    digitalWrite(stepPin,LOW);
    delayMicroseconds(500);


Each of those delayMicrosecond functions wait for 1/2 millisecond.  Total time for a cycle = 1 millisecond, result is 1000 pulses (steps) per second.

Robin2

Thanks for your answers guys. Well, even though I still cannot see how from my code I should tell the motor to move 1000 times per second, I started to troubleshoot by uploading Robin2's basic stepper code from his stepper basics thread (really helpful).

Thank you for your kind words.

In my examples I have a variable to hold the value of the interval between steps. That is what determines the motor speed.



I don't know what you mean by " shortcutting GND and the current limitor"

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

ivino

Quote
Each of those delayMicrosecond functions wait for 1/2 millisecond.  Total time for a cycle = 1 millisecond, result is 1000 pulses (steps) per second.
I see now Groundfungus :-) Thanks.

And Robin2, by
Quote
" shortcutting GND and the current limitor"
I mean stablishing galvanic connection between the screw on the A4988 board where the current is adjusted and the A4988 GND pin. That really something I have not seen on any tutorial.

/Regards

Robin2

And Robin2, by  I mean stablishing galvanic connection between"
Is that what I would describe as "soldering a wire between"?

If so, it is certainly not something I ever contemplated. Have you studied the schematic for the A4988 board to figure out the effect of such a connection?

If not, then I still don't understand.

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

Go Up