Go Down

Topic: help with arduino mega controlling multiple steppers (Read 786 times) previous topic - next topic

karim_bj

Hello

I posted another note in the forum but received no answer!! I am hoping to get some help with my project, your help is very much appreciated.

I have three stepper motors connected to an Arduino Mega 2560 using three SN754410 H-Bridges. I have attached pictures (sorry for the busy looking background and too many wires, in advance).
I have also got an external power supply with 12VDC and 3A output; since I realized each stepper draws 0.4A current per phase (not sure what this means though). I have connected the outputs of the H-Bridges (from 4 wire steppers) to pins:
0 (RX), 1 (TX), 2, 3, ..., 9, 10, 11.

First of all is this setup correct?
Second, is there like a sample code for multiple steppers so I can test them to sweep back and forth?

Many thanks.

TomGeorge

Hi, okay on the pics, but I think a circuit diagram, either CAD or pic of hand drawn effort would help.
I think you also need to keep away from your rx/tx pins as they are part of the programming/ serial i/o.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running......VK3DMK

karim_bj

OK thank you so much! I removed the wires from those pins and shifted them.
However:

I connect the USB cable from Arduino to my PC but I cannot find the COM1 port there (not in Arduino MEga and not in Control Panel: Ports)!!

This is my setup (pictures attached - sorry for too many wirings and confusing background in advance).

This is the code I have used (very basic):

Code: [Select]


#include <Stepper.h>

#define STEPS 200

Stepper stepper1(STEPS, 0, 1, 2, 3);
Stepper stepper2(STEPS, 4, 5, 6, 7);
Stepper stepper3(STEPS, 8, 9, 10, 11);

void setup()
{
  stepper1.setSpeed(60);
  stepper2.setSpeed(60);
  stepper3.setSpeed(60);
  Serial.begin(9600);
}

void loop()
{
 
  Serial.println("CW");
 
  stepper1.step(STEPS);
  stepper2.step(STEPS);
  stepper3.step(STEPS);
 
  delay(500);
 
  Serial.println("CCW");
 
  stepper1.step(-STEPS);
  stepper2.step(-STEPS);
  stepper3.step(-STEPS);
 
  delay(500);
 
}


I would appreciate your help. Am I connecting to wrong pins to Arduino? Am I drawing too much current?? As you can see both the "ON" green and "L" yellow LEDs are lighting!! why is that?

Thank you,
Karim.

TomGeorge

Hi, sorry but to get this far with your project you must have drawn or followed a circuit diagram.
If not, then draw a diagram from what you have, these pictures show the myriad of wires needed to connect to the bridges, but not how you have done it.
Please a diagram, CAD or picture of hand drawn circuit.
Thanks for your efforts so far, however its your project and you know all about it, we don't which makes you miles ahead in understanding the system.
Have you tried the sketch, if  you want the circuit checked before you try it, then a circuit diagram is essential.

Tom..... :)
Everything runs on smoke, let the smoke out, it stops running......VK3DMK

Go Up