Go Down

Topic: Assigning 3 Stepper Motors to the Arduino Uno (Read 1 time) previous topic - next topic

ajr93

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. 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.

mirith

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. 

ajr93

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);


jroorda

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. 

ajr93

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

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).  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. 

PeterH


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.
I only provide help via the forum - please do not contact me for private consultancy.

jroorda

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.

sbright33

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.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Rien4241

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.

PeterH


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.
I only provide help via the forum - please do not contact me for private consultancy.

groundfungus

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

Rien4241

Thank a lot for mentioning the "AccelStepper" library.

groundfungus


Go Up