Introduction

Stepper motors are an ideal choice for accurately moving and positioning mechanical devices. Using techniques like microstepping the position of the motor shaft can be controlled with a great deal of precision.

Stepper motors are available in a wide range of sizes. On the small end of the scale are the steppers used within DVD and Blu Ray drives to position the laser head. On the other end of the scale are huge steppers that can control the position of industrial-sized 3D printers and CNC machines.

Using the larger stepper motors with an Arduino is not very different from using smaller ones. The main difference is in the selection of a driver module.

Stepper Motors & Drivers

We have covered stepper motors in detail in an earlier article and video, so if you need a refresher please see the previous material.

Big Stepper Motors With Arduino

In the previous article, we learned that stepper motors are available in two common wiring configurations, Unipolar and Bipolar. Most large stepper motors are bipolar, meaning that they have 4-wires, two per coil assembly.

Bipolar stepper motors can be driven using dedicated modules or with H-Bridges. In the previous article, we used both an A4988 stepper module and an L298N H-Bridge to drive bipolar stepper motors with an Arduino to drive a common NEMA 17 size motor.

To use a larger stepper motor we will need a bigger driver or H-Bridge, one that is capable of handling the current our motor will require.

Motor Specifications

Let’s take a look at the specifications of the stepper motor we are going to be using today. This is a NEMA 23 Bipolar Stepper Motor from Stepperonline.

This motor has the following specifications:

  • Step Angle: 1.8 deg
  • Holding Torque: 3.0Nm(425oz.in)
  • Rated Current/phase: 4.2A
  • Voltage: 3.78V
  • Phase Resistance: 0.9ohms
  • Inductance: 3.8mH ± 20%(1KHz)
  • Frame Size: 57 x 57mm
  • Body Length: 113mm
  • Weight: 1.8kg

As you can see from the size and weight, this is a BIG motor!

Large Stepper Motor

Most of the specifications are pretty self-explanatory. But one of them might seem a bit strange.

The voltage is rated at 3.78 volts. Which, to many people, may seem a bit on the small side!

The voltage rating is NOT the maximum voltage that the stepper motor can handle, nor is it the operating voltage that  the manufacturer recommends you use in your design. The voltage rating is actually just a mathematical calculation:

CURRENT (4.2 Amps) x RESISTANCE (0.9 Ohms) = VOLTAGE (3.78 Volts)

If you were to apply a static DC voltage to the stepper motor coils then you would apply 3.78 volts to get the 4.2 amps of holding current.

In real life, you don’t do that. You send pulses to the motor, pulses that are affected by the motor’s inductance as the pulses increase in frequency. To overcome this effect you apply a higher voltage to achieve the same 4.2 amp current.

When reading the stepper motor specifications the current is the key parameter you need to pay attention to, not the voltage.  You can easily drive this motor with a 36-volt power supply, as long as your motor driver limits the current.

Once you know the current requirements you can select the power supply and a motor driver. Keep in mind that as you will be microstepping the motor you’ll need to double the current requirements, as you will often have two coils engaged simultaneously.

Microstep Drivers

While it is possible to make use of a large H-Bridge to drive our big stepper motor it is more common to use a dedicated driver module, known as a Microstep Driver.

Microstep drivers are available in a range of voltage and current ratings.  They accept logic signals to pulse the motor and control its direction.

Many common microstep drivers are sealed modules with terminals and heat sinks.  They all look relatively the same, and they are hooked up and used in a similar fashion. The difference between them is the voltage and current ratings.

Microstep Drive

You should choose the microstep driver based upon your motor current requirements.  The microstep driver you select will have a range of operating voltages, this will determine the voltage requirements for your power supply.

Note that this common style of microstep drivers is setup using a bank of DIP Switches, located on the side of the unit next to the wiring terminals.  The case of the microstep driver has all of the details you’ll need to set the DIP switches correctly.

There are two main groups of switches:

  • The Current Group. These switches set the maximum current delivered to the stepper motor coils. It is important that you do not exceed your motor ratings.
  • The Microstep Group. These switches determine how many input pulses are required to rotate the motor one turn. Not all stepper motors can be microstepped at extreme settings.

Before you get started with the experiments it would be a good idea to set the current switches to suit your stepper motor.

Microstep Driver DIP Switches

Some microstep driver modules, like the MA860H module I used in the experiments here, can accept both AC and DC voltage for a power supply.  The voltage requirements and ranges for your microstep driver will be printed on its case.

When you are installing a microstep driver on a permanent location make sure to allow for heat dissipation. These driver modules have large heatsinks, mine has a fan on it as well.  You’ll also want to allow for heat dissipation for the stepper motor as well, as they can run very hot when operated under a heavy load.

Arduino Demo

A microcontroller like an Arduino is an ideal way of controlling a stepper motor using a microstep module.  

The microstep module requirements are actually pretty simple. It uses three control signals, all of them are inputs:

  • PUL – This is the Pulse that steps the motor.
  • DIR – This is a logic signal to set the motor Direction.
  • ENA – This is an Enable signal,

In most installations you can ignore the ENA (Enable) connections and let them float, this will result in the module always being enabled. You can use the ENA connection if you want to implement an emergency stop or shutdown system.

Arduino and Stepper Motor Hookup

The hookup of the Arduino to the microstep driver module is illustrated here:

Arduino Stepper Hookup

Note that we are driving the negative inputs of the modules, instead of the positive ones. The positive inputs are all connected to the Arduino 5-volt output.

This might seem strange, it is due to the inputs on the modules actually being balanced inputs that accept 5 to 24 volts (at least that was the spec on my module).  

Balanced inputs are used to allow for long unshielded twisted-pair wires in an industrial environment with a lot of electrical noise. As long as we keep the connections short we can use our Arduino in an unbalanced wiring configuration.

You’ll also notice I add a potentiometer and a push button switch. The potentiometer will control the stepper motor speed while the push button will reverse its direction.

I’m showing a 24-volt power supply in the diagram as it is what I used for my motor tests. You should use a supply that is suitable for your microstep driver, as mentioned before it can also be an AC transformer instead of a DC power supply if your module accepts AC power.

Arduino Sketch

Here is the sketch we will be using to control our stepper motor:

It is a pretty simple sketch and requires no libraries.

We start by defining the pins we will be using for the switch, the connections to the microstep driver and to the potentiometer connected to the analog A0 input.

Next a couple of variables to represent pulse width and direction,

After that, there is a function, which also happens to be an interrupt handler that is triggered whenever the push button is pressed. It’s a simple function that just toggles the value of the setdir variable, which is a boolean representing the motor direction.  The result is that pressing the button reverses the motor.

In the setup, we define our connections to the microstep driver as outputs and then set up our interrupt handler.

In the loop, we read the value of the potentiometer and use it to set the pulse delay value pd variable.  The longer the delay, the slower our motor will spin.

We use the setdir variable to set the value of the DIR output, to set motor direction.

Then we create a pulse manually, by holding the PUL output high for the period defined by the pd variable.  We then hold it low for the same period.

After that the loop repeats.

Testing the Stepper and Microstep Driver

Setup your stepper motor and driver in a safe fashion, as large stepper motors can cause a lot of damage if left unsecured.  I held my motor in my bench vise during testing.

Stepper Motor in Vise

Before powering everything up double-check the position of the DIP switches, make sure that you have the current settings correct.

Set the pulses per rotation to a value of at least 800 to start with, and turn the potentiometer fully counterclockwise so the control is outputting its slowest speed.

Power up the Arduino and then the microstep driver.  Observe the indicators on the microstep driver, generally the green one is power and the red one indicates a fault condition.

The motor should be turning now, if not power everything off and recheck your wiring. Use a multimeter to measure the motor coil resistance if there is any doubt regarding the wiring. Also, make sure that the motor polarity is correct or the coils will be out of phase.

If all is working you should be able to control the motor speed with the potentiometer, and the direction using the push button switch.  As the switch is not debounced you may get erratic operation. Debouncing could be done either in hardware or using code.

Keep in mind that the switch can also serve as a limit switch, you could have two in parallel and use them at each end of the desired travel to reverse the motor direction.

You could achieve better performance using an electronic switch, such as an optical or hall-effect switch.

Demo with AccelStepper

The AccelStepper library is a popular library for using stepper motors with the Arduino. In the previous article about stepper motors I used the AccelStepper in a few examples.

You can also use AccelStepper with the microstep drivers.  Let’s do that now, we will keep the wiring of our demo as it is and just use different code.

Getting AccelStepper

If you have already gone through the demos in the previous article about stepper motors then you likely have the AccelStepper library installed in your Arduino IDE already.  If you haven’t then you’ll need to install it first.

The easiest way of adding the AccelStepper library to your Arduino IDE is to use the built-in Library Manager.

  • Click on the Sketch menu item on the top menu.
  • Click on Include Library. A sub-menu will open
  • Click on Manage Libraries. This will open the Library Manager in its own window.
  • In the Filter box type “AccelStepper”.
  • The AccelStepper library will be listed. Click on the Install button to add this library to your IDE.

AccelStepper Demo Sketches

Once the AccelStepper library is installed in your Arduino IDE you’ll have access to a number of demonstration sketches. You can use these to try out your microstep driver.

You can open the test sketches as follows:

  • Click on the File menu item on the top menu.
  • Click on Examples. A sub-menu will open.
  • Navigate down to the section labeled Examples From Custom Libraries.
  • Select AccelStepper.
  • A sub-menu will open with a number of AccelStepper example sketches.

A good demonstration sketch is the Bounce sketch from the AccelStepper example sketches.

You will need to modify one line in the sketch (and all of the demo sketches) to setup the stepper object correctly.

Modify the AccelStepper line as follows to use it with the hardware that we already wired up:

AccelStepper stepper(1,7,6);

This line sets up AccelStepper in “mode 1”, which is the correct mode for using microstep driver modules.  The “7” and “6” refer to the Arduino pins used for the direction (DIR) and pulse (PUL) connections.

After modifying the Bounce (or another example) sketch send it up to the Arduino and test it out. Try modifying the microstep settings to see the results.

You may use the above technique to modify other sketches based upon the AccelStepper library.

Conclusion

As you can see using large stepper motors with an Arduino is pretty simple, thanks to the microstep driver module.

When you are experimenting with large stepper motors make sure you put safety first!  A motor with this much power can do a lot of damage if it gets out of control, and you could injure yourself if you are not careful.

Stepper Motor Test Setup

Always be sure of your electrical connections before applying power. If you are planning to run the motor for any appreciable period of time make sure that the microstep driver and the motor have adequate ventilation.

By observing some common sense safety procedures you can design some powerful and impressive projects using a large stepper motor, an Arduino and a microstep driver module.

Now step to it!

 

Resources

Stepper Test Sketch – The sketch I wrote to test the stepper motor with the potentiometer and push button switch.

 

 

 

Using BIG Stepper Motors with Arduino
Summary
Using BIG Stepper Motors with Arduino
Article Name
Using BIG Stepper Motors with Arduino
Description
In this article, you'll learn how to read stepper motor specifications and how to select a microstep driver. We'll then hook it all up to an Arduino and control the stepper motor speed and direction.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:

If you have a question...

Comments about this article are encouraged and appreciated. However, due to the large volume of comments that I receive, it may not be possible for me to answer you directly here on the website.

You are much more likely to get answers to technical questions by making a post on the DroneBot Workshop Forum. Your post will be seen not only by myself, but by a large group of tech enthusiasts who can quickly answer your question. You may also add code samples, images and videos to your forum posts.

Having said that, please feel free to leave constructive comments here. Your input is always welcome. Please note that all comments may be held for moderation.

25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
lars
1 year ago

What driver would be a good option if you wanted to drive more high current stepper motors?

saeed
1 year ago

Hello sir
how are you
I am very very impressed with the projects you are working on and follow up on your YouTube page and I learned a lot from you
I want to ask if you are programming (Step Driver- BL/TB6560-v2.0) similar to (Using BIG Stepper Motors) that you are doing .

Michael Mckinney
1 year ago

I have a crazy idea and need some help with my project, I don’t have any skills in programming or working with the Ardruino , but I’m sure I could learn from your videos, my BIG question is, can I use sensors to get the Stepper motor to turn, I want to be able to hold a wireless sensor attached to my head for example, build a motorized turntable that I can stand on and when I turn my head it would turn the stepper motor and rotate the turntable in that direction. 1 is this possible to do with… Read more »

George
11 months ago

Myo arm band

Akshay
1 year ago

Thank you so much for your expertise. I have one question, we are developing 5 dof robotic arm using stepper motor but the problem is, we are trying to rotate all motors at the same time but it won’t run. Can you please share some suggestion for this query.
thank you.

salah
1 year ago
Reply to  Akshay

your exiplanation good I wonder if posible to add sellection swithch to change the direction wright or left

Leonardo Villamonte
3 months ago
Reply to  Akshay

You need to set your motors to work based on a timer interrupt routine and make sure you dont have delays anywhere in your code if you want to share me your code and diagrams i could maybe help. Good luck

Nick
11 months ago

Hello and thank you for all the videos. They have been very helpful. I have the very same stepper motor as in your “big steppers” video. My driver is the DM556T and using the Arduino Atmega 2650, wired the same as your video except i am manually changing the variable “pd” with the code instead of with a potentiometer. Also with the exception of the potentiometer missing from the code, my code is the same as the video. Variable “pd” set with larger numbers are slower than smaller numbers. When pd is set to 100k (100000) it is slower than… Read more »

Klaus Nielsen
10 months ago

I found the youtube video and “got you” that way.
Very good “deep going” article. Even though I have done one project with a stepper motor this article has brought me at lot more understand of stepper motors that I didn’t have before.
Thanks.
Klaus

Toni
9 months ago

Thank you very much for this intro and your video on it! I used it to control my first big stepper motor, and it works!

John
9 months ago

Hi, How would I control the direction and speed of the motor from a distance. I want to use RS485 to control the Arduino from a distance of about 300m.

Thanks
John

Harry Vaughan Sr.
7 months ago

Need Help Can’t get stepper motor with arduino and div265n to rotate 150 times stop delay and reverse 150 times.Can only get it to rotate 10 times at 1/8 micro stepping.

Matthew B Pulliam
7 months ago

Hi, I’m trying to wrap my head around how to match steppers and drivers…

You state that current is key in the motor specs and chose a motor with a Rated Current/phase: 4.2A.
You then state, “Keep in mind that as you will be microstepping the motor you’ll need to double the current requirements”

so this would be 8.5A

Then you have picked a Microstep Motor Driver 2.4-7.2A

So it would seem that this isn’t providing enough current? Please clarify why this is driver is a compatible choice?

Thanks,
Matt

BarryS
3 months ago

The stepper driver has constant-current outputs. That means, it will limit the current to your dip-switch settings… even though using ohm’s law with the motor resistance and power supply voltage, the current would be much, much higher. The driver limits the current to your setting. A coil, like that in the stepper motor, has a lot of inductance. When you apply a voltage to it, the current doesn’t immediately go got the ohm’s law-calculated value. It takes time for the magnetic field to build up, and as it does, the current increases. So, if you want that field to build… Read more »

Ronaldo Franco Martins
6 months ago

Muito Obrigado, Parabens
Ronaldo
São Paulo – Brasil

Jacob
6 months ago

How can you control the motor using the arrow keys of the computer and is it also possible to enter a range of numbers and hit the enter key and the motor would go to those numbers??

Luis
5 months ago

Hello. I have a setup with 2 stepper drivers, both are far from my arduino UNO.
Instead of connecting the 5V from the Arduino to a Breadboard and then both drivers to the breadboard, can I connect PUL+ and DIR+ to a different 5V Power Supply? Or it has to be connected to the Arduino?

If PUL+ and DIR+ are compatible with 5V or 24V, can I use any power supply within that range?

BarryS
3 months ago
Reply to  Luis

The outputs of your arduino are only 5V maximum. To connect it to a higher voltage power supply, you would need to add a driver transistor between the arduino output and the input of the stepper driver. Without that dirver transistor, you will fry your arduino’s output and maybe the whole board. The buffer would be a small signal transistor, like a 2N3904, with the emitter grounded, the base connected through a 2-10k resistor to the arduino output pin, and the collector connected to the PUL- pin on the stepper driver. Your additional power supply’s “-” would connect to the… Read more »

Ralph Hulslander
4 months ago

I am having problems, I posted on the Forum there was no response.

Marty
4 months ago

3 months ago

hello sir,
My name is Mohamad Santos From Indonesia
I want to consult with you about making automatic doorstop coding with RFID and ultrasonic sensors. can you help me? thank you

Manaf Zivingy
1 month ago

How much is the value of the resistor connected to the push button? and why didn’t connect the GND of Arduino to the GND of 24 volt power supply?

C IJpelaar
1 month ago

I did this, however the button does nothing.

29 days ago

can you provide sketch for max speed test for nema 34 and 23 114 mm

Gary M. Oosta
28 days ago

Many thanks — again. Your explanation of how to use the T6600 with a NEMA motor is clear and work! DroneBot Workshop is my go to site.

25
0
Would love your thoughts, please comment.x
()
x