5 stepper motors to one Arduino Mega

Hello, if i could get some help id really appreciate it. Im completely new to electronics and coding and have no idea what im doing.

I have 5 4-Phase 5-Wire Stepper Motor with ULN2003 Driver Board. I connected these directly to the arduino mega. Im trying to move them simultaneously but to different angles. Althought atm, i just need to know if the circuit or code are remotely similar to what id need for that to happen.

I wired the power to a breadboard from each driver and then back to the arduino and plugged all the inputs into the mega. All the connections seem to be okay, and when i supply power the drivers light up.

#include <Stepper.h>

// steps value is 360 / degree angle of motor
#define STEPS 200

// create a stepper object on pins 4, 5, 6 and 7
Stepper stepper1(STEPS, 4, 5, 6, 7);
Stepper stepper2(STEPS, 8, 9, 10, 11);
Stepper stepper3(STEPS, 14, 15, 16, 17);
Stepper stepper4(STEPS, 18, 19, 20, 21);
Stepper stepper5(STEPS, 22, 23, 24, 25);

void setup()
{
}

void loop()
{
stepper1.setSpeed(60);
stepper2.setSpeed(60);
stepper3.setSpeed(60);
stepper4.setSpeed(60);
stepper5.setSpeed(60);
stepper1.step(200);
stepper2.step(200);
stepper3.step(200);
stepper4.step(200);
stepper5.step(200);
delay(100);
stepper1.setSpeed(60);
stepper2.setSpeed(60);
stepper3.setSpeed(60);
stepper4.setSpeed(60);
stepper5.setSpeed(60);
stepper1.step(200);
stepper2.step(200);
stepper3.step(200);
stepper4.step(200);
stepper5.step(200);
delay(100);
}

This is the code that seems to check out fine when i verify it, but once the A mega is plugged into the port, it doesn’t seem to read the Arduino.

Please let me know what im doing wrong, because im sure its something obvious that im missing.

Thank you very much.

I wired the power to a breadboard from each driver and then back to the arduino and plugged all the inputs into the mega

Do you have a separate power supply for the motors or are you trying to power it all from the Arduino, which is in turn powered by the USB port? I think the limit for the USB port is around 500mA, so you need a separate power supply.

The arduino is connected to the mains.

DariaVidisheva:
The arduino is connected to the mains.

But how are the motors powered?

And if you want the motors to move at the same time you should use the AccelStepper library. The standard Stepper library is not designed for simultaneous movements - unless you move each motor 1 step at a time.

...R

The are connected to a breadboard and then to the arduino which is powered by mains. and Its fine if i move them one step at a time actually. that would be even better tbh. As long as they move.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Including you power supplies, please no Fritzy picture.

Can you post a picture of your project too please?
What driver do you have?
Links to data/specs of driver and stepper.

I know its a lot but we need this information to give you accurate answers

Thanks Tom.... :slight_smile:

Hello Tom,

This is a quick cad drawing showing the set up I am working with as well as the code.

#include <Stepper.h>

// steps value is 360 / degree angle of motor
#define STEPS 200

// create a stepper object on pins 4, 5, 6 and 7
Stepper stepper1(STEPS, 4, 5, 6, 7);
Stepper stepper2(STEPS, 8, 9, 10, 11);
Stepper stepper3(STEPS, 14, 15, 16, 17);
Stepper stepper4(STEPS, 18, 19, 20, 21);
Stepper stepper5(STEPS, 22, 23, 24, 25);
 
void setup()
{
}

void loop()
{
   stepper1.setSpeed(60);
   stepper2.setSpeed(60);
   stepper3.setSpeed(60);
   stepper4.setSpeed(60);
   stepper5.setSpeed(60);
   stepper1.step(200);
   stepper2.step(200);
   stepper3.step(200);
   stepper4.step(200);
   stepper5.step(200);
   delay(100);
   stepper1.setSpeed(60);
   stepper2.setSpeed(60);
   stepper3.setSpeed(60);
   stepper4.setSpeed(60);
   stepper5.setSpeed(60);
   stepper1.step(200);
   stepper2.step(200);
   stepper3.step(200);
   stepper4.step(200);
   stepper5.step(200);
   delay(100);
}

Is this enough? Please let me know. And, thank you very much for your help.

Hi,
Thanks for the diagram, you will not be able to power those steppers off the 5V of the MEGA.
They will need their own 5V power supply.
Your stepper driver has provision for that as well.

Go back and start with just ONE stepper and get it working, you can get one of those geared steppers to work off the arduino power and USB.

Do not be surprised if you have to swap the 4 driver outputs around to get the stepper to rotate back and forth.

Tom.... :slight_smile:
PS I have those components as well, I'll assemble the project with one stepper when I can.
PPS. Mains Power means your utility AC supply, what is the supply you are using, PC or USB adapter.

Hey Tom,

I have actually tried one stepper motor this way and it seemed to work fine. In fact, iv tried every one i have to make sure they all work properly. It seems it is only when i add multiples that it becomes a problem.

I see what you mean about the power supply, i have a Power Supply Module which i could plug into the breadboard. Would that be enough power?

Daria

Hi,
Your driver boards have a jumper fitted that lets the 5V from the Arduino power the stepper.
If you look you should be able to see how to configure the jumper for external stepper motor power.

This may help.

Tom… :slight_smile: