Timing differences when microstepping NEMA 17

I’ve been testing different microstep setting with a nema 17, and I’ve come across a problem that doesn’t make sense to me so if someone could shed some light on it that’d be great:

Board: Arduino Uno
Driver : TMC2208 (problem persists with a tb6600 on the same motor also )
PSU: 24v 5A

So my loop code is essentially

digitalWrite(Step_pin, HIGH);
delayMicroseconds(500);
digitalWrite(Step_pin, HIGH);
delayMicroseconds(500);

Which when run at 1/2 microstep spins the motor as expected, my problem arises when I change to a different microstep setting, these SAME timing delays cause the motor to freak out and make loads of noise.
The rotation returns to normal once I change the timings to

It is my understanding that changing the microstep setting just decreases the angle turned on each pulse, so I would say using the same timings the motor would pulse at the same rate but rotate slower. But this is not the case. Is there something fundamentally wrong with my understanding or does this point to me wiring something wrong / a faulty motor maybe. This video here, explains what I think should happen perfectly, where in my case when then microstep setting changes all hell breaks loose :

Demo starts at 6:00

Thanks for reading, sorry for any incompetence I am still a beginner. Please ask any questions you need answering

Make certain that the current limit is set appropriately on the motor driver, or microstepping will not work properly.

Even when properly functioning, microstepping does not produce accurate increments and is not intended for single, isolated steps. It is intended for smooth running and to minimize vibrations.

Thank you for the reply,
How do you mean set correctly,
does micro stepping require more current?
Could you possible describe how I determine the correct current limit for the motor/ driver

Bashmore:
So my loop code is essentially

digitalWrite(Step_pin, HIGH);
delayMicroseconds(500);
digitalWrite(Step_pin, HIGH);
delayMicroseconds(500);

Please post a complete working program - the problem is often in the other part.

Also please post a link to the datasheet for your stepper motor.

Most stepper drivers are content with a short step pulse of about 10 microsecs

...R
Stepper Motor Basics
Simple Stepper Code

#define EN_PIN 7 // Enable
#define DIR_PIN 5 // Direction
#define STEP_PIN 4 // Step

#define MS1 2 //
#define MS2 3 //
int Time = 500;
void setup() {
// put your setup code here, to run once:
pinMode(EN_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(MS2, OUTPUT);

digitalWrite(MS1, HIGH); //HIGH this comination is 1/2 step
digitalWrite(MS2, HIGH); //LOW
digitalWrite(EN_PIN, LOW);
}

void loop() {
// put your main code here, to run repeatedly:
for (uint16_t i = 200; i>0; i--) {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(Time);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(Time);
}
delay(2000);
}

ah that might be the problem ill change the delay in the middle to be 10

this code here results in a nice clean rotation, when the motor is in 1/16 step mode, but the second i change to 1/2 mode the motor freaks our and makes a high pitch noise (only difference in code is MS2 is LOW)

#define EN_PIN 7 // Enable
#define DIR_PIN 5 // Direction
#define STEP_PIN 4 // Step

#define MS1 2 //
#define MS2 3 //
int Time = 100;
void setup() {
// put your setup code here, to run once:
pinMode(EN_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(MS2, OUTPUT);

digitalWrite(MS1, HIGH); //HIGH this comination is 1/16 step
digitalWrite(MS2, HIGH); //HIGH
digitalWrite(EN_PIN, LOW);
}

void loop() {
// put your main code here, to run repeatedly:
for (uint16_t i = 3200; i>0; i--) {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(Time);
}
delay(2000);
}

Bashmore:
this code here results in a nice clean rotation, when the motor is in 1/16 step mode, but the second i change to 1/2 mode the motor freaks our and makes a high pitch noise (only difference in code is MS2 is LOW)

That change will cause the motor to try to operate 8 times faster and it may well not be able to do that without being accelerated up to speed.

When posting code please use the code button </>

so your code 
looks like this

It makes it much easier to help you.

See How to get the best out of the Forum

...R

ahhhh, that seems so obvious now youve said, sorry for wasting your time, i think ill just use the acellstepper library to simplify it all
thanks for the help

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.