Getting a stepper motor to spin smoothly at low rpm's

Hi there,

I am currently trying to make myself a drawing machine (a pintograph to be precise) and am running in to a few issues.
I need the stepper motors (I will eventually have 4 running) to operate smoothly at speeds between about 1-10rpm. I am using these stepper motors https://core-electronics.com.au/stepper-motor-200-steps-rev-12v-350ma.html and driving them with A4988 drivers.
At the moment I can get them to rotate but once I get down to the speeds I require they are very jerky and vibrate a lot.
I am running with an Arduino nano and powering the motor with a 12v 1.5A power supply.
I have used both the stepper library and Accelstepper library without success.
Does anyone have any pointers on how to get some smooth action with these motors or other suggestions, am I better of using DC motors to achieve my objective.
A link to what I am trying to achieve if anyone is confused https://robertbalke.de/about/

Cheers

Reece

Hi Reese,

Are you able to post the code you are using to drive the stepper motor

Clinton,

Here is one sketch I have been using. This one allows a pot to be used which does control the speed but even changing the values I cannot get the speeds to runs smoothly at low rpm’s

/ Stepper motor run code with a4988 driver
// by Superb

const int stepPin = 3;
const int dirPin = 2;
int customDelay,customDelayMapped; // Defines variables

void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);

digitalWrite(dirPin,HIGH); //change the rotation direction HIGH for clockwise and LOW for anticlockwise
}
void loop() {

customDelayMapped = speedUp(); // Gets custom delay values from the custom speedUp function
// Makes pules with custom delay, depending on the Potentiometer, from which the speed of the motor depends
digitalWrite(stepPin, HIGH);
delayMicroseconds(customDelayMapped);
digitalWrite(stepPin, LOW);
delayMicroseconds(customDelayMapped);
}
// Function for reading the Potentiometer
int speedUp() {
int customDelay = analogRead(A0); // Reads the potentiometer
int newCustom = map(customDelay, 0, 1023, 300, 4000); // Convrests the read values of the potentiometer from 0 to 1023 into desireded delay values (300 to 4000)
return newCustom;
}

I have tried many other sketches, some better than the others but still I cannot get a smooth rotation.
I have tried the M1, M2, M3 pins as well to change the stepper resolution but then things get worse.
I am sure it is something simple I am missing, I just need to find it.

Cheers for the help.

And thesis another one I have used.
/Drawing Machine1
by Andrés González
July 19 2015
/

#include <AccelStepper.h>

AccelStepper TurntableAxis(1, 2, 3); // pin 2 = step, pin 3 = direction
AccelStepper FirstDrive(1, 4, 5); // pin 4 = step, pin 5 = direction
AccelStepper SecondDrive(1, 6, 7); // pin 6 = step, pin 7 = direction

void setup() {
TurntableAxis.setMaxSpeed(1000); //this is fixed
FirstDrive.setMaxSpeed(1000); //this is fixed
SecondDrive.setMaxSpeed(1000); //this is fixed
TurntableAxis.setSpeed(5); //change this
FirstDrive.setSpeed(-100); //change this
SecondDrive.setSpeed(300); //change this

}
void loop() {

TurntableAxis.runSpeed();
FirstDrive.runSpeed();
SecondDrive.runSpeed();

}

The A4988 motor driver only drives 1 stepper motor, so the sketch above isn’t relevant. Please show your wiring/connections.

I would recommend reading the documentation provided in the A4988 product description, and associated links.

A good tutorial on this is here:

Cheers Robin,

I do have 2 A4988 driving a motor each. I have the wiring set up as in that link asI have been using the tutorial you have linked to. I might start over again with just one motor and see how I go again.

Thanks

Make sure you have adjusted the current limit as detailed in the tutorial.

Yep have followed the current limiting part as well so I am not sure what I am doing wrong? Have set the Vref to around 540mV which should give me a 1A limit which I think should be enough for my setup?

I will start from the beginning again when I get time and see how I go.

Do I have to code the micro stepping into the sketch or can I just apply a high to the pins to get it working?

Cheers

Jumpers to VCC/Gnd are fine. The tutorial has a table of what jumpers to connect to achieve the required micro-stepping.

My experience is the stepper steps on the rising edge and needs to stay high for a period. You’re using the same custom delay for both speed and “high” time. Try setting a fixed delay after the rise and see how you go (most likely the smaller time values are what is working for you). In my project, I used the mode pins to set the speed and fixed on/off times for the step pulses. Along with correctly set current, that seemed to resolve any chatter problems.

So an update, I realised the jumper wires I am using were giving me inconsistent connections and therefore causing things to run erratically!!! All the jumper pins had a varnish like coating on them and did not seem to make contact properly with the breadboard so I have lightly sanded all the pins and what do you know… everything seems to be working fine now :laughing::laughing:.

The motors still vibrate a fair bit but hopefully when i mount them properly everything will work out and I will have a functioning pintograph to play around with.

Cheers for all the help.

Reece

1 Like