Stepper Motor - Non Whole Number Steps

Hello all,

I'm working on a project that requires filling a bearing with small needle rollers. I'm using a NEMA-17 200step/rev stepper motor to control the main shaft so that a dropper unit, controlled by another stepper motor, can drop a needle into each pocket accurately. However, I've thought about an issue that I didn't think of when I originally started.

Some of these bearings have total pocket numbers that do not divide evenly into 200. For example if one of my bearings has 62 pockets in it, 200/62=3.2258... and this is not an even step number.

My question is does a stepper motor have the capability to accurately step to non whole numbers like this? Or is there something that can be done code wise to help? Would changing to microstep or interleave solve the issue? Thanks in advance for the help.

I'll link the code I have so far. I'm using an Arduino Mega R3 and an Adafruit Motor Shield v2.3:


#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);
Adafruit_StepperMotor *myMotor2 = AFMS.getStepper(200, 1);


void setup() 
{

Serial.begin(9600);           // set up Serial library at 9600 bps
Serial.println("ProtoTest");

AFMS.begin();  // create with the default frequency 1.6KHz
//AFMS.begin(1000);  // OR with a different frequency, say 1KHz
 
myMotor->setSpeed(80);  // 10 rpm  
myMotor2->setSpeed(80); 

}

void loop() 
{

if (digitalRead(21) == LOW)
 {
 
 Serial.println("Proto Test Run Steppers");
 MotorRotate(); 
 myMotor->release();
 myMotor2->release();
 
 }

}

void MotorRotate ()
{

for (int i=0; i<62; i++)
 {

  Serial.println(i); 
  Serial.println("Cage Motor");
  myMotor->step((200/62), FORWARD, SINGLE); 
     delay(10);
  Serial.println("Cam Motor");
  myMotor2->step(100, FORWARD, SINGLE); 
   delay(500);
  
 }

Stepper motor drivers can make a stepper motor move in full steps (which is most accurate) and usually half, quarter and eighth steps - maybe even smaller divisions. When you move away from full steps you lose some torque as the fractional steps are achieved by the coils opposing one another.

Note that the divisions are all powers of 2 so you can't get one-third steps.

Would it be suitable to do several movements with N steps and a few more with N-1 steps to compensate?

...R
Stepper Motor Basics

Microstepping should always be used if available, much less vibration, and smoother movement.
Using microsteps doesn't lose torque(*), the coils do not oppose one another, they are in quadrature.

You still get some torque ripple with microstepping, but vastly less than full steps.

(*)At high speeds there are issues with the impedance of the winding, but that's a symptom
of running faster than your supply voltage is good for.

So just running it as a microstep should allow it to achieve a 3.22 step (for example) with a fair bit of accuracy?

And Robin2,

So what you're saying would be to step the motor in such a way that the steps evenly divide into 200? So there would just be multiple lines of different steps to achieve a non even divisible number?

Eatonian:
So just running it as a microstep should allow it to achieve a 3.22 step (for example) with a fair bit of accuracy?

That is NOT what I said.

So what you're saying would be to step the motor in such a way that the steps evenly divide into 200?

I don't understand. The size of the step is set by the motor manufacturer. Likewise the size of microsteps depend on the size of the full step.

So there would just be multiple lines of different steps to achieve a non even divisible number?

I think you are describing what I suggested. Within a single revolution you cannot get a fractional number of steps. But if your first move has an unavoidable error of 1 step (or 1 microstep) too many a subsequent move could deliberately do one step fewer in order to compensate.

I think you need to work out the lowest common multiple between 3.22 and 200 (or is it the highest common factor?).

...R

The motor driver I'm using has a 1/16 microstep resolution so it should be able to accomplish what I need, I think. I just hadn't thought too much into the functionality of that type of operation.

But yes I can also go the mathematical approach you suggested. I appreciate the help.

The accuracy isn't improved by using microsteps at all, just the number of positions - applying torque
will pull the motor upto 1/2 step before it skips completly - so the more accuracy you need the less
torque you can use and you have to worry about torque ripple (microsteps not all the same size around
the cycle) and motor build quality (stator not perfectly concentric with rotor's teeth, general geometrical
imperfection.)

@Eatonian, you seem to have made a significant change to your Original Post and it is now hard to make sense of the discussion so far.

Please re-instate the Original Post and add the new information in the appropriate chronological positon - i.e. after this Reply.

...R