Go Down

Topic: How to avoid jerks between steps when starting and stopping (Read 302 times) previous topic - next topic


Oct 20, 2018, 03:58 pm Last Edit: Oct 20, 2018, 04:00 pm by movingforever Reason: edited title for better clarity on question

I am a newbie and have made a hanging rotation gadget with Nema17, an Arduino uno and an easy driver 4988 for photographing jewelry products such as a necklace with pendant. I have never written code before, however just wrote one after reading and experimenting.

The issue -

1. The rotation needs to be very slow, so the hanging necklace does not swing too much between wait states

The motor needs to stop every 10 degrees moving clockwise (more or less depending the number of photographs needed each 360 degree turn)

The motor does it with the current code below, but I have an issue with jerks at start and stop between each step.

I will appreciate some help as I don't seem to be getting anywhere.

Thanks in advance!


here's the code -

Code: [Select]
// defines pins numbers
const int stepPin = 3;
const int dirPin = 4;
void setup() {
  // Sets the two pins as Outputs
void loop() {
  digitalWrite(dirPin,LOW); // Enables the motor to move in a particular direction
  // Makes pulses for making one full cycle rotation
  for(int x = 0; x < 6; x++)
  delay(5000); // five second delay


Have you tried micostepping the motor?  Steps can be much smaller, that might reduce the swinging.


Thanks. it is the motion between steps. Starts with a jerk that makes the product swing too much and photo becomes blurry


The AccelStepper library can use acceleration.  So the motion from start to speed and speed to stop is much smoother.  Not so much jerking.


From the Original Post ...
Code: [Select]

That should be digitalWrite()

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


You almost certainly want acceleration/ramping with a NEMA17 motor, you always do with larger
steppers, I'd advise learning the AccelStepper library, its pretty flexible and does the tedious stuff
for you.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up