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