# Assigning 3 Stepper Motors to the Arduino Uno

**URL:** <https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971>\
**Category:** General Guidance\
**Created:** [June 25, 2013, 1:45pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971 "2013-06-25T13:45:28Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 25, 2013, 1:45pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/1 "2013-06-25T13:45:28Z")

</div>

Hi all, I'm currently doing a project involving running 3 stepper motors using an Arduino Uno. To do this I'm using three easy drivers and a breadboard. [Easy Driver Examples](http://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html) if you look at this link and scroll down to example 4 it is an identical setup to this but I am using an additional easy driver and an additional stepper motor.  
My question is this, which pins should I assign the third stepper/easy driver to? Since the two ground ports are taken by the other two steppers.  
Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 25, 2013, 2:09pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/2 "2013-06-25T14:09:07Z")

</div>

Ground is ground (Generally), so you can easily expand the port out by just connecting to one of the other ground wires. However, I would look into good grounding practices, especially when motors are involved, since they tend to be high current noise sources, and thus irritating.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 25, 2013, 2:14pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/3 "2013-06-25T14:14:43Z")

</div>

Ok, I'll try that, cheers. So say I was to assign it to the ground on the top left of the board in the picture on the previous link. When I defined the steppers at the start what would I write?  
i.e.  
AccelStepper stepper1(1, 9, 8);  
AccelStepper stepper2(1, 7, 6);  
AccelStepper stepper3(?, 5, 4);

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 25, 2013, 3:50pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/4 "2013-06-25T15:50:19Z")

</div>

Any ideas anyone?!

---

<div class="post-metadata">

**Author:** ![jroorda](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@jroorda](https://forum.arduino.cc/u/jroorda)\
**Post date:** [June 25, 2013, 9:43pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/5 "2013-06-25T21:43:54Z")

</div>

I have done a few projects with the easy driver. I have tried to use the AccelStepper library too, but ended up doing my own controller for various reasons.

First, lets double check your connections. You should have the four motor wires from each motor going to the four motor outputs on each EasyDriver. Your stepper voltage supply coming in should go to M+ on all of the drivers, and the ground from this supply should go to one of the ground pins on each EasyDriver.

Now for the control, each EasyDriver needs a step wire, a direction wire, and a ground wire. The ground should tie from the EasyDriver ground to the Arduino ground to make sure they are tied together. The step and direction lines are the only ones which have to go to the digital pins on the Arduino, and they can go to any of them.

Now in the code you should understand what the line you listed is doing. It is a constructor that makes a new AccelStepper instance. The first parameter sets the mode of operation. In your case this is with an external driver and will always be a 1. The second parameter is the step pin number, so just put in the pin number of the digital pin connected to the step input on the associated EasyDriver. Similarly, the third parameter is the direction pin, so assign it to the pin number you used.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 26, 2013, 8:19am UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/6 "2013-06-26T08:19:45Z")

</div>

I see, thanks alot that's cleared things up. Out of interest why did you opt out of the AccelStepper library?

---

<div class="post-metadata">

**Author:** ![jroorda](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@jroorda](https://forum.arduino.cc/u/jroorda)\
**Post date:** [June 26, 2013, 9:08pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/7 "2013-06-26T21:08:44Z")

</div>

In our application (robotic arm) we decided not to use any acceleration in order to get faster response time (acceleration by its very nature slows response). I should say acceleration as opposed to near instantaneous rotational velocity changes. (Yes I know that the latter actually has more acceleration, but lets just go with it.)

The library works fine with instantaneous changes, but it looses some of its value. Because I was teaching a few high school students how to write the program it was simpler to teach them how to toggle a pair of digital pins that teach them the entire concept of classes and constructors. It also gave us more visibility into what was happening.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 26, 2013, 9:55pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/8 "2013-06-26T21:55:51Z")

</div>

> jroorda:  
> In our application (robotic arm) we decided not to use any acceleration in order to get faster response time (acceleration by its very nature slows response).

That doesn't sound right. If you don't accelerate the stepper then your top speed is limited to how fast the stepper can jump to from a standing start. If you control the acceleration then you get the same acceleration performance available from a standing start but you can then continue up to a higher maximum speed. If you don't control the acceleration then you won't achieve the maximum speed potential of the motor.

---

<div class="post-metadata">

**Author:** ![jroorda](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@jroorda](https://forum.arduino.cc/u/jroorda)\
**Post date:** [June 27, 2013, 12:06am UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/9 "2013-06-27T00:06:45Z")

</div>

I knew I should have explained that more. We were using a joystick for proportional control, so you could always back off when the motor started skipping steps.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 27, 2013, 3:14pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/10 "2013-06-27T15:14:22Z")

</div>

I have discovered you only need a few steps with a small mass, at a slower speed, to achieve the top speed on my cheap Ebay motors. This is not the case with a large mass like a full sized DSLR. Either way it can be easily done manually without a library.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 1, 2013, 4:04pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/11 "2013-07-01T16:04:18Z")

</div>

I just found out, that you cannot run more steppers at the same time with the standard Arduino library.  
To make it work, I removed the while loop and all lines with "steps\_left" from the "Stepper::step function in "stepper.cpp" and uses the "step" function only with (1) or (-1) argument.  
For the time being, I use 2x analog joysticks, proportionally changing the "setSpeed" function for testing 4 steppers, 2-wire control.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 1, 2013, 4:28pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/12 "2013-07-01T16:28:12Z")

</div>

> Rien4241:  
> I just found out, that you cannot run more steppers at the same time with the standard Arduino library.

I don't know what causes that restriction, but assuming you're right, it may be that the AccelStepper library doesn't have that restriction.

---

<div class="post-metadata">

**Author:** ![groundFungus](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groundFungus](https://forum.arduino.cc/u/groundFungus)\
**Post date:** [July 1, 2013, 4:33pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/13 "2013-07-01T16:33:40Z")

</div>

PeterH is right. The stepper library that comes with the IDE will support only one motor. Use AccelStepper for multiple motors.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 1, 2013, 5:16pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/14 "2013-07-01T17:16:57Z")

</div>

Thank a lot for mentioning the "AccelStepper" library.

---

<div class="post-metadata">

**Author:** ![groundFungus](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groundFungus](https://forum.arduino.cc/u/groundFungus)\
**Post date:** [July 1, 2013, 5:23pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/15 "2013-07-01T17:23:42Z")

</div>

Sorry.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 4:55pm UTC](https://forum.arduino.cc/t/assigning-3-stepper-motors-to-the-arduino-uno/169971/16 "2021-05-05T16:55:27Z")

</div>


