Controlling a robot with multiple motors and movements

I am working building a life-size robot and having each part move independently using motors and drives. Each arm will move up and down, the head will rotate, the waist will twist, and it will bend over at the waist. Stepper motors will be used for each movement but a linear actuator will be used for the bending motion. So this will be a total of 5 motors: 4 steppers and 1 linear actuator.

The plan is to have a motion sensor or a button (preferably a motion sensor) to trigger a sequence of motions that is different each time it is triggered and then go back to “home”. I am currently working with the AccelStepper library to try to control each motor independently and with limit switches as a homing device. I have been researching and trying a lot of different things but I am having trouble trying to put everything together. So I am just asking for a little guidance on this project. I may have missed some information but I will gladly give out any that’s needed. Thank you for any advice!

First thing... power. What power supply are you using? Under load.. a server may pull up to or even over 1 AMP!

How are you driving these?

Perhaps using a dedicated servo driver/board would help things..

Something like:

Here is some more details on it: (examples with libraries..etc)

It's an i2c-controlled PWM driver with a built in clock. That means that, unlike the TLC5940 family, you do not need to continuously send it signal tying up your microcontroller, its completely free running!

That being said....

I'n not sure how you have chosen to approach this project (code wise).. but it look like it would need to have non-blocking (no delays).. state machine type of approach (millis()..etc).. to get everything working at intended.

These links may help
Stepper Motor Basics
Simple Stepper Code

If you want motors to move to limit switches the AccelStepper library may not be ideal as it it is primarily intended for movements of finite number of steps with acceleration and deceleration.

It is not difficult to implement acceleration with your own code as illustrated in this link

But you also need to consider how you would decelerate to a stop when a limit switch is triggered without overrunning the switch.

On the other hand, as the parts you are moving will probably be heavy acceleration and deceleration are probably essential and my suggestion is to establish the zero position of all the motors at startup and then keep track of the number of steps to limit movement. The limit switches could be useful for averting disaster by simply cutting off power to the motors.