controlling multiple stepper motors

Hi Friends,

I’m doing some ground work and planning for an art installation that will include around 40 synchronised stepper motors. I need to be able to centrally control all the steppers from a single control. looking at stepper control I could use one Arduino to control 2 steppers so potentially 20 Arduinos. However I’m unsure how to synchronise all the steppers and how to have one controller (PC, R-Pi, Ardunio) that directs the movements of all the steppers.

Does anyone have any idea how I might achieve this please?

Thanks
MashO

No you can use one Arduino to control as many stepping motors as you like. What speed do you want these to go at in terms of steps per second.

Go back to the beginning Why stepper motors? Why not servos.

To get really good answers start at the beginning!

Mark

Servo's will need modification as I need to do continual rotation. I guess I could do servos but I need to be able to accurately know where the motors are at any time. I figure steppers with hall-effect devices for a zero reference.

Grumpy_Mike: How can I control 40 steppers at the same time? I think I'm missing something. I'm intrigued.

With a large number of motors you will be faced with the problem of making connections to an Arduino. Assuming you use stepper drivers that take step and direction signals each motor will require two Arduino pins. Other drivers would almost certainly need more pins per motor.

For 40 motors that will probably mean two Megas.

The other constraint is the speed at which steps must be produced. There is a limit to how many steps per second can be produced by an Arduino operating at 16 MHz - epsecially if it needs time to do other stuff as well. This could mean the need for more Arduinos.

If you have more than one Arduino it will be difficult to get motors to step at closely coordinated times - but maybe errors of a few tens of millisecs would not matter.

I can conceive of having a "standard" Arduino that can control X motors and which can receive instructions from a PC or an RPi over Bluetooth or WiFi. Then you could have as many "standard Arduino's" as you need.

...R
Stepper Motor Basics

Hi,
Do you need individual control to all 40 , or are they all 40 doing the same thing in unison?

Are you trying to do this?

Tom..... :slight_smile:

Not that precisely but something similar. The motors will be doing separate things that the central controller will need to coordinate.

So Robin2: What I want to be able to say to the stepper is "go to 43degrees", "go to 23degrees" So what I really need is a controller on the stepper that doesn't need me to to send PWM instructions but rather can be told what position the rotor needs to be in. Timing is not an issue everything is relatively slow one full rotation will never be faster than 10 seconds. I was thinking of using an I2C address for each Arduino, cycling through them and directing where they should be.

Cost is not an issue. If I need to purchase an Arduino per stepper that's fine but I'm more concerned with the work involved in the production and maintenance issues. It needs to not fail and I know the more components I have the more likely to have a failure.

Is there a Stepper driver that I can send position instructions to?

Hi,
Try the CNC parts suppliers, that YouTube has a followup showing assembly of the artwork, each motor unit looks like a complete unit and as you suggest, they may just tell it position instructions.

Tom... :slight_smile:

Hi,
I have had a bit of a thought, (it happens at times :D).
Each of the drive units will have to be time synced so that you do not notice the delay between addressing the first to last unit.
They would be loaded with a performance file each and then the main controller acts as a musical conductor, just suppling to all units at once the start, running and stop timing.

So they would need to be each arduino type controllers.

Just a thought (it happens at times ;D), shoot me down if I'm wrong.

Tom.... :slight_smile: :slight_smile: :slight_smile:

Just do not think of using more than one Arduino it will cause you more trouble than it is worth.
Use port expanders to get the extra pins. At ten seconds per rotation you have the time.

MashOMatic:
So Robin2: What I want to be able to say to the stepper is "go to 43degrees", "go to 23degrees" So what I really need is a controller on the stepper that doesn't need me to to send PWM instructions but rather can be told what position the rotor needs to be in. Timing is not an issue everything is relatively slow one full rotation will never be faster than 10 seconds. I was thinking of using an I2C address for each Arduino, cycling through them and directing where they should be.
...SNIP....
Is there a Stepper driver that I can send position instructions to?

Did you read my earlier link to Stepper Motor Basics ?

Steppers do not use PWM.
Yes, you can program an Arduino to receive instructions and move a stepper to a position.

Most steppers have 200 steps per revolution. So 10 seconds for 200 steps would be 20 steps per second. For 40 motors that would be about 800 steps per second which would be well within the capacity of a single Arduino.

Note that at 200 steps per revolution you can only move in 1.8 deg steps. You can use microstepping if you need smaller steps but that increases the number of steps per second for the same speed.

I am in two minds about @Grumpy_Mike's statement "Use port expanders to get the extra pins". A lot depends on your expertise. If you only needed a few extra pins I would probably agree with him.

But, given what you are trying to do my instinct is to use multiple Arduinos all of which have identical code and wiring and which receive instructions from your PC or RPi.

I think you need to do a bit of experimenting before you commit to the full cost of the project. Get an Uno and a couple of stepper motors and stepper motor drivers and get that to work as near as possible like the final project.

...R

Sorry must have missed your link to the stepper motor's before, looking now.

Absolutely with the experimentation. I have some steppers on order ATM should get them soon. I do understand the technical issues and it comes down to a practical implementation that is possible, within budget and reliable. I'm not actually the artist trying to express the piece rather the technical assistant trying to find a way to implement it.

So it looks like it is possible and desirable to have a single Ardunio control all motors, not entirely convinced how to achieve this. I would be more than happy for someone to point me in the direction of how this can be achieved.

Thanks for all your help.
MashO

So looking at the stepper motor link it looks like what I need is the A4988 chip to control the motors. I would still need to work out synchronisation but moving would be more simple. Thanks for that. a good starting point.

Get one of these for each motor:-

So it looks like it is possible and desirable to have a single Ardunio control all motors, not entirely convinced how to achieve this.

You need to adopt the apparent multitasking technique, typified in the "blink without delay" sketch in the IDE.
See my
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html
Or Robin2's several things at once

For extended examples of what to do.

MashOMatic:
So it looks like it is possible and desirable to have a single Ardunio control all motors, not entirely convinced how to achieve this.

There are two separate issues here. Whatever solution you choose a single Arduino will need to control a number of motors so from the start of your learning process a single Arduino and a couple of motors (and drivers) will allow you to explore that aspect.

Then there is the question of how many motors a single Arduino should control.

I have the impression from your earlier description that the real control will be carried out on your PC or RaspberryPi and you just want the Arduinos to do the minimum necessary to give effect to instructions they receive.

In that situation I would personally opt for several Arduinos and not have the attachment and programming complexity of port expanders.

But, I reckon the final decision on that should wait until you ahve experimented and learned more about the control process. For example it would not be a great waste of money to get a second Arduino and see how the control system could work with two of them operating in parallel. But start with one.

One thing that has not been mentioned is the specific type of stepper motor you plan to use. You should choose the motor before you choose the driver because the driver must be able to provide the current (amps) required by the motor.

...R

In that situation I would personally opt for several Arduinos and not have the attachment and programming complexity of port expanders.

There is no programming complexity with port expandars, I can't understand your concern.

Once you have the program structure to control more than one stepping motor with an Arduino this is easily expanded. The communication problems with several Arduinos is a far greater problem.
However the biggest problem I think will be the power supply and decoupling for all these motors.

I may have missed it but I haven't seen anything to indicate that you have any prior experience with stepper motors. Also , I haven't seen anything in your post even remotely suggesting what motor controllers you plan to use or what the motor current is per motor. Is this what you were thinking of doing ?

Grumpy_Mike:
There is no programming complexity with port expandars, I can't understand your concern.

My understanding of them is that you need to connect them (which is a little task in itself) and then you need to change the code so that it addresses the appropriate external pin before it sends a command.

But I may be wrong and maybe the code (for an Uno) is as simple as digitalWrite(57, HIGH).

Do you have a specific port expander in mind so I could read up about it?

I am trying to distinguish between what is easy for you (and me) and what is easy for a beginner.

...R