Pages: [1]   Go Down
Author Topic: Controlling 4 steppers + 2 servos with an Arduino MEGA  (Read 1783 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello there,

You will excuse my french origins for my bad english, anyway I'm here because before getting into my project I would like to know if that is possible to connect and control 4 steppers and 2 servos with only one Arduino MEGA.
Also, I saw I could use directly L293D H bridges to afford power supply to my steppers. But could I connect them all to my Arduino ? Obviously, there are many outputs on this Arduino, nevertheless I could not find out if I could use all of them, or only the PWM outputs.

Thanks for answers.
Kenny
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8858
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Each servo uses 1 data pin.

Each stepper driver uses 2 (Step/Direction), 3 (Step/Direction/Enable) or 4 (Windings 1/2/3/4) pins.

Four steppers will take as few as 8 and as many as 16 pins.

16 stepper pins plus 2 sevo pins is 18 pins.  You could even use an Arduino UNO.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Really ?
I mean, when you look at the Arduino, you see pins, but do they all correspond to an eventuality to control servos ? Beacuse on each website I could have a look at they all used the PWM outputs. So is there any link between these and what I have to use ?
Or can I also use digital and communication pins ?
Thanks
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8858
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hobby servos use a kind of PWM but not the same kind you would use to control the speed of a motor or brightness of an LED.  Radio Control receivers receive a series of pulses, each pulse from about 1 to 2 milliseconds (1000 to 2000 microseconds) long.  Each pulse is sorted out to a different servo channel.  There are usually 2 to 7 channels and after those 2 to 7 pulses there is a delay before they repeat so the series repeats about every 20 milliseconds.  Each servo only sees one of the pulses so it expects to see a 1 to 2 millisecond pulse evert 20 milliseconds or so.  The servo library takes care of the timing and can control 14 servos on an Arduino UNO, using any available digital output pin (or analog input pin used as a digital output pin).

PWM for speed/brightness control is a signal that uses duty cycle to control average power.  The analogWrite() function can control  the six PWM outputs of the Arduino UNO to set the power level from 0 (off) to 255 (full).  This corresponds to how many 255ths of the time period the signal stays HIGH.  The repeat rate is hundreds to thousands per second and as long as it's considerably faster than 30/second it doesn't usually matter what the actual frequency is.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh dear I meant instead of servos : steppers in my last message. So what is changed ?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8858
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is no reason to use PWM outputs for servos.  The servo driver chips take care of stepping current and holding current so there is not need to adjust power levels.  Have you chosen your stepper driver hardware yet?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I'm expecting to use 4 L293D H-bridges for each stepper.
For the servos I will directly connect them to the arduino.
For the PWM and servos yes, you're right.
Anyway.
Is it better to use directly motor shields or the H bridges, knowing we must use quite enough electronics on our project (that is for a school graduation actually) ?
Does the stepper ever fails ? I mean, my project is a Rubik's Cube machine solver, (everything has been laid down so we know where we're going), but imagine the steppers will directly rotate the cube faces. Then as sometimes there is a little drag to rotate, will the stepper "miss a step" ? (the drag is not much, and we can lubricate it anyway, I do not worry about it at all but that is just about what quality we must choose to ship the steppers)
Thanks again for you answer, that's very kind.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8858
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

> Is it better to use directly motor shields or the H bridges,

Most motor shields can only support two steppers so you are probably going to have to use external stepper drivers.

> Does the stepper ever fails?

Each stepper motor has a limit to how much torque they can produce.  You must make sure that the torque your motor produces is more than enough to overcome any friction in the cube.  Generally the larger the stepper motor, the higher the voltage, and the higher the drive current, the higher the torque.  Current will be limited by your driver and by how much power the motor can dissipate.

Quad stepper driver, $65, 1 Amp:
https://www.sparkfun.com/products/10507

Single stepper driver, $13, 2 Amp:
http://www.pololu.com/catalog/product/1182


Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And do you find the idea of using 4 L293D bridges instead of a whole driver acceptable ?
The cube does not need many torque. And if we ever have issues with friction or anything, the designing allows changes that could solve the problem. Moreover we could oil it a lot and that would be all right.
Thanks.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8858
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And do you find the idea of using 4 L293D bridges instead of a whole driver acceptable ?

That should work but will require four pins per stepper.  With the MEGA you should have plenty of pins to spare.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well so I'm gonna do this :
- Buy 4 steppers + 2 servos
- Buy the arduino MEGA
- Buy 4 H bridges (L293D)
- Use an external power supply for the steppers and the arduino that could support the whole current
- Enjoy

Is it correct so ?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8858
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds correct to me.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright then thanks a lot for your help. smiley-grin
Logged

Pages: [1]   Go Up
Jump to: