Selection of elements

Hi, I am looking for a stepper motor and a driver for it, very precise. I need to operate the motor so that I can make one step by an angle of 1 degree without error (and even 0.5 degrees). I already have several motors and drivers (DRV8825 and TB67S249FTG) (stepper motor: .html)

It does not work very well, the motor does not return to its place after moving forward and then backward (there is a plate element on it).

Do you have a set that shows remarkable accuracy, or do you have any tips on what to look for when it comes to sensitivity?

I also wrote some code that works fine, but I’d also like to get some recommended code from you, CLK break times (from the driver) written in C.

Thank you very much for all your help!

Bartosz Kossowski

It looks like the stepper motor you linked to rotates 0.9-degree per step (400 steps per revolution), so you should be able to get that level of accuracy using either of the drivers you mentioned, even in full-step mode. If you are stepping the driver the same number of times in each direction, it should end up in the same place it started. If it doesn’t, then it might be missing steps, which could be a sign that your motor cannot handle the load you are putting on it, you are trying to step the motor faster than it can handle, or your current limit isn’t set appropriately.

Could you post more details about your setup, including information about your power supply, which driver you are currently using, and what the VREF voltage is set to? Also, could you post pictures of your setup that show all of your connections?

You can find some simple Arduino-compatible example code in our “Setting the Current Limit on Pololu Stepper Motor Carriers” blog post about setting the current limit on our stepper motor driver carriers.


Hey, thanks for your answer, I’m most pleased with some code example from you guys.

Unfortunately, I can’t show the photos, because the whole system is already assembled and the secret of this project covers me.
The system works, but according to the documentation, the times should be very short (between high and low at the CLK input of the controller)
At the moment my code looks like this

    for (int i = 0; i < stepsPerRevolution; i ++) {
      digitalWrite(stepPin, HIGH);
      digitalWrite(stepPin, LOW);

And the code you proposed uses such ‘times’

  for(int i = 0; i < 50; i++)
    // Trigger the motor to take one step.
    digitalWrite(STEP_PIN, HIGH);
    digitalWrite(STEP_PIN, LOW);

All VREFs are adjusted according to the documentation. The connection is also made correctly (I designed and constructed the PCB for all electronics) only the motor coils are wired.

I have the impression that something is wrong in the program, these CLK activation times. It’s just that when I set more time between logical states, the motor does not work well. I will test it on what I have in the company (I will be in the company from the new week)


might be missing steps

How can I lose steps?
Can the driver with the motor work unstable due to the wrong program?
The control code is uploaded to the Atmega328/8A with a 16MHz oscillator.

your motor cannot handle the load you are putting on it

The load is not large, barely 50 grams

you are trying to step the motor faster than it can handle

I don’t even know how to achieve it, shortening the control time of logical values on CLK only causes the rotor to spin with a hum

your current limit isn’t set appropriately

The current is well selected, according to the formula in the documentation

Bartosz Kossowski

Unfortunately, without more information like the details of your setup I asked for in my previous post or a video of the problem, it is difficult to give any helpful advice since it isn’t clear what is causing the problem.

Each time the step pin is pulsed, the driver will try to advance the motor to the next step. So, the shorter the time between pulses (i.e. the higher frequency of the step input) the faster the stepper motor will rotate. At some point, if you step too quickly, the motor cannot keep up and it will “miss” a step (even with no load on the motor).

If you slow the step rate down by increasing the delay times in your code, does it still end up at a different position than you expect? If it is more accurate when stepping slower, I might have some additional suggestions. As you mentioned, when you slow it down, it might run “rough” (or seem to vibrate a lot) because the motor’s discrete steps are more noticeable. You can generally smooth this out by using microstepping if needed.