Stepper Motor MicroStepping! What to keep in mind when doing it?

//Stepper Motor MicroStepping! What to keep in mind when doing it?

Want to use MicroStepping?

Here’s what to keep in mind…


All my content is free.

If you feel that my videos are helping and you would like to contribute, you can toss some coins in the Tip Jar via PayPal.

Select amount then click the “Donate” button.

Brainy-Bits Tip Jar Amount

In the last tutorial I’ve looked at an alternative to the EasyDriver…  The L298N.

Although the L298 works, it’s not the best option for driving stepper motors with an Arduino.

One big advantage of the Easy Driver is that it supports multiple Micro Stepping options.

I’ve done many tutorial in the past using the EasyDriver but never really used the micro stepping options.

So in this tutorial I will look at how to switch the type of micro stepping used on the fly and what to keep in mind when switching between options.


Today we are using the Easy Driver but they are many more available of course.

Another one you might want to use is the Big Easy Driver which support more current to drive bigger stepper motors.

Arduino Easy Driver

So let’s have a look at the regular Easy Driver first:

  • Based on the A3867 micro stepping driver
  • Supports up to Eight steps (Full, 1/2, 1/4, 1/8)
  • Adjustable current (150mA – 750mA per phase)
  • Power supply from 6 to 30V
  • Onboard 5V output (but only around 50mA)
  • Comes with pins unsoldered
  • Meant to be used on PCB or a Breadboard

Arduino Big EasyDriver

Now let’s have a look at the Big Easy Driver:

  • Based on the A4988 micro stepping driver
  • Supports up to Sixteenth steps (Full, 1/2, 1/4, 1/8, 1/16)
  • Adjustable current (0mA – 2000mA per phase)
  • Power supply from 8 to 35V
  • Onboard 5V output (but only around 50mA)
  • Comes with pins unsoldered
  • Can be used on PCB or Breadboard
  • But can also use Screw Terminals for easy connections

So as you can see they are quite similar, but the Big Easy Driver:

  • Provides more Power (up to 2A instead of only 750mA per phase)
  • Can support 1/16 steps
  • Support the use of Screw Terminal blocks for easier connections (like the L298N)

Most stepper motors are based on 1.8 degrees steps.

This translate to 200 FULL steps per revolution (1 rotation = 360 degrees  |  360 / 1.8 = 200)

Now when using FULL steps, the rotation of the stepper motor can be quite choppy, especially at lower speeds.

The Easy Driver support of course FULL steps per default, but like we saw above also:

  • Half steps
  • 1/4 steps
  • and 1/8 steps

For example if you set the micro stepping to 1/4 steps, then you would get 800 steps per revolution, making the rotation of the stepper motor much smoother.

So you might say: “Why not use micro stepping all the time then?”

Good question of course, but here’s a couple of reasons:

Micro Stepping is great but there are some trade-offs…

And most of those have to do with speed… Of both the stepper driver and the micro controller you are using.

You see when you use micro stepping, the stepper driver has to operate at a much faster speed to turn on and turn off power to the stepper motor coils compared to Full stepping.

Also the micro controller (in this case the Arduino UNO) has a speed limit at which it can send the commands to the stepper driver.

In fact, the AccelStepper library has a limit of 4000 steps per second maximum when using the Arduino UNO.

But you’ll never get even close to that in real life, since your Arduino will be doing something else (reading sensors, displaying on lcd, etc…) at the same time that’s it’s driving the stepper motor.

All this affect the maximum speed at which the stepper motor can rotate.

For example using Full steps you might be able to reach close to 4 rotation a second at max speed, well if using 1/4 steps that maximum speed might be reduced to only 1 rotation a second.

This has nothing to do with the Stepper Motor itself, it’s a combination of the stepper driver and the micro controller maximum speed at which it can turn on and off the motor coils.

One other compromise might be about the maximum torque that can be achieve.

Although this is debatable, using Full steps normally will result in higher torque compared to micro stepping.

So in conclusion, if you’re project requires maximum speed, maybe using Full steps is the way to go.

On the other hand if you need more precision, then using micro stepping is a better choice.

Keep in mind that using a faster micro controller and better stepper driver will affect these choices.


Here’s the connection that are used in this tutorial:

I’m using a 24V 5A power supply to power the Easy Driver and powering the Arduino using the USB input with a 5V USB power supply.

Arduino Pins A4 and A5 are connected to pins SDA and SCL on Old screen.

Arduino Pin A0 is connected to the Analog OUT pin of the Analog Slider

Arduino Pin 7 is connected to the Tact Switch

Arduino Pin 5 and 6 are connected to the Easy Driver pin MS1 and MS2

Arduino Pin 12 and 13 are connected to the Easy Driver pin STEP and DIR


Like in the last tutorial I’m again using an Analog Slider to move and control the steep of the stepper motor.

Arduino Analog Slider

Moving the slider slowly to the left will start moving the stepper to the left at a slow speed and the speed will increase the more I moved the Analog Slider.

Moving the slider to the right will do the same but in the opposite direction.

Sliding near the middle will stop the Stepper Motor.

I’m also using a small switch to toggle between the stepping options (Full, 1/2, 1/4, 1/8).

And a small Oled display to show those stepping options.

As always check out the tutorial video for more information.

/* Easy Driver with Analog Slider and Oled Micro Stepping
Created by Yvan /

This code is in the public domain...

You can: copy it, use it, modify it, share it or just plain ignore it!

#include <U8glib.h>   // Library for OlED display

U8GLIB_SSD1306_128X32 Oled_Screen(U8G_I2C_OPT_FAST);  // Init of the OLED using I2C

#include "AccelStepper.h"
// Library created by Mike McCauley at

// EasyDriver connections
#define dir_pin 13  // Pin 13 connected to Direction pin
#define step_pin 12 // Pin 12 connected to Step pin
#define MS1 5       // Pin 8 connected to MS1 pin
#define MS2 6       // Pin 9 connected to MS2 pin

// AccelStepper Setup
AccelStepper stepper(1, step_pin, dir_pin);  
// 1 = Easy Driver interface

/* Configure type of Steps on Easy Driver:
// MS1 MS2 
// LOW LOW   = Full Step //
// HIGH LOW  = Half Step //
// LOW HIGH  = A quarter of Step //
// HIGH HIGH = An eighth of Step //

#define Slider_Pin A0    // Arduino A0 Pin connected to the analog out of the Slider
#define change_switch 7    // Tact switch used to select stepping type

int change_switch_state=0;  // used to debounce the switch

int current_stepping=0;  // Used to store the current stepping type (0-5)

int Slider_Value;        // Used to save the current Analog Slider Value
int Stepper_Speed;       // Used to set the travel speed of the stepper motor
int Stepper_Direction;   // Used to choose the direction of travel

void setup() {


  Stepper_Direction=stepper.currentPosition();  // Set the starting position of the stepper which is equal to zero at startup

  pinMode(change_switch, INPUT_PULLUP);
  pinMode(MS1, OUTPUT);
  pinMode(MS2, OUTPUT);
  pinMode(dir_pin, OUTPUT);
  pinMode(step_pin, OUTPUT);

  // set stepping type to FULL Steps
  digitalWrite(MS1, LOW);
  digitalWrite(MS2, LOW);

  // Rotate screen 180 degrees on OLED, uncomment if required

  // Select font to use
  Oled_Screen.setContrast(100);  // Set oled contrast at startup

// Put stuff on OLED at startup    
    do {
        Oled_Screen.drawStr( 0, 24, "Stepping = FULL");
    while( Oled_Screen.nextPage() );  

void loop() {

  // Change Switch - Debounce using a delay() command
    if (digitalRead(change_switch) == LOW && change_switch_state == 0) {
      delay(100);  // The higher the Delay the less chance of bouncing      
      switch (current_stepping) {
        case 1:
          digitalWrite(MS1, HIGH);
          digitalWrite(MS2, LOW);
          do {
            Oled_Screen.drawStr( 0, 24, "Stepping = HALF");
          while( Oled_Screen.nextPage() ); 

        case 2:
          digitalWrite(MS1, LOW);
          digitalWrite(MS2, HIGH);
          do {
            Oled_Screen.drawStr( 0, 24, "Stepping = 1/4");
          while( Oled_Screen.nextPage() ); 

        case 3:
          digitalWrite(MS1, HIGH);
          digitalWrite(MS2, HIGH);
          do {
            Oled_Screen.drawStr( 0, 24, "Stepping = 1/8");
          while( Oled_Screen.nextPage() ); 

        case 4:
          digitalWrite(MS1, LOW);
          digitalWrite(MS2, LOW);
          do {
            Oled_Screen.drawStr( 0, 24, "Stepping = FULL");
          while( Oled_Screen.nextPage() ); 

    } else {
      if (change_switch_state == 1 && digitalRead(change_switch) == HIGH) {

  Slider_Value=analogRead(Slider_Pin);  // Read the value of the analog slider
  if (Slider_Value > 575) {  // If slider is moved to the Right
    Stepper_Speed=map(Slider_Value,575,1023,1,700);  // Map the Right value of the slider to a Speed value for the stepper
    Stepper_Direction--;  // Decrease the position to reach by one which will be used to move the stepper later
  } else if (Slider_Value < 350) {  // If slider is moved to the Left
      Stepper_Speed=map(Slider_Value,350,0,1,700);  // // Map the Left value of the slider to a Speed value for the stepper
      Stepper_Direction++;   // Increase the position to reach by one which will be used to move the stepper later
  } else {
      Stepper_Speed=0;  // If slider is around the middle then don't move the stepper by setting the speed to zero
// Move the stepper to new position

// Do this until the stepper as reached the new destination
  while (stepper.distanceToGo() != 0) {  // if stepper hasn't reached new position
    stepper.runSpeedToPosition();  // move the stepper until new position reached


Just keep in mind the speed limit of the Arduino UNO  when using micro-stepping.

In future tutorials I will start using more powerful Micro Controllers to see what a higher end setup might be able to achieve.

Of course this will be using more expensive parts, but it might be an interesting option for some projects.

Thanks for stopping by and hope to see you again soon!  Cheers!


Copy and Paste the above code/sketch in your Arduino IDE software.

Link to the libraries used in this tutorial:

AccelStepper Library by Mike Mcauley:

U8glib Library for OlED display

By | 2019-12-21T17:37:12-05:00 December 21st, 2019|Tutorials|


  1. Charles July 26, 2020 at 6:34 am - Reply

    By far and away the most educational site for anyone learning to code and make full use of the Arduino. I confess I have been guilty of ‘frankenstein’ coding thanks to multiple snippets of code taken from your projects.

    If I had one wish it would be that you replace the use of Easydrivers / AD4988 stepper motor drivers and give us an insight into how to make use of the Trinimac drivers out there e.g. the TMC2208 / TMC2209 etc – a much superior driver, especially for things like your camera slider project.

    Keep those tutorials coming

    • brainy-bits July 26, 2020 at 12:30 pm - Reply

      Thank you Charles for your comment. Funny enough I’m working right now on doing a tutorial using the TMC22xx drivers. Like you said these are far superior to the aging EasyDriver and the TMC22xx will be replacing the EasyDriver in my future projects. Stay tuned for those tutorials coming soon…

      • Charles August 7, 2020 at 9:20 am - Reply

        I”m into extreme macro photogrphy and spent a long, long time – starting from scratch knowledge, learning to set-up and code with the Arduino. My project was intended to calculate the minute step sizes needed to capture images at the numerous planes of focus to enable ‘stacked images’ leading to a final sharp image over of a much greater depth of field.

        I got things to work stand-alone after a huge learning curve, my major disappointment is with the noise resulting from the Easydriver, the inefficiencies (heat) and question marks over the repeatablity / accuracy of the micro-stepping.

        I’d dearly like to get someone of your skill level to look over my code – if only at the stepper control functionality – and help with the transition to a Trinimac driver. If you are at all interested I’d be happy to send you the source code and what docuentation I’ve compiled so far.

        It works o.k. – but there are undoubtedly refinements, I’m too close to see now! I’m also thinking that a pc and serial control might be another method to try – I had to use the Arduino Due to get enough mathematical precision for some of the calculations.

        Please let me know if you’d be interested.

        Best Regards


  2. Orjan Falk April 5, 2020 at 6:27 am - Reply

    Thanks! Yesterday evening I was looking for how set different steps on Easy Driver.
    I found this post and now the sketch is up and running!
    You made my day! I also learned how to get OLED-display working! (it has been a problem for me)

Leave A Comment