Controlling 4 Stepper Motors with Arduino Uno & EasyDriver

Hi everyone, I am new to Arduino and could use some help.

I have a laser engraver that the plan is to connect each leg to a Nema 11 stepper motor, so 4 motors total, and this would essentially make an adjustable Z-axis and lift the whole machine up and down. Each motor would have the same settings (speed and direction) and act as one. It is not heavy.

I will be controlling this with 2 momentary pushbuttons: one for up and one for down. It is only to move while holding down a button and stop when I release. This z axis will only be used to place larger/smaller items under the laser head and will not to be running while the laser is running. It's just a lift to help adjust laser height and focusing.

Being that the motors will be operating at the same speed, direction , steps, etc and using the same information, can I just splice all together and connect to the arduino uno, or will each motor still need to be connected to their own set of 3 pins on the arduino uno? Same with whatever other pins go from the easydriver to the uno, could those just be spliced and sent to same pins on the arduino?

I have an arduino uno, 2 sparkfun easydrivers, 2 stepper motor splitters and the pushbuttons.

The plan is to connect 2 motors using the splitter to 1 easydriver each, and then send the two splitters to the arduino. Can I just send the 2 sets of stepper wires to the same 4 pins? (Picture attached)

Please excuse the poor mockup, but that's what I'm looking to do. Will the attached schematic work? If so, can someone help me with the code as well as the ACTUAL wiring to the arduino uno? Thank you all in advance

4 motors to control the Z axis? How will You control the X and Y direction?

darthxrinzler:
The plan is to connect 2 motors using the splitter to 1 easydriver each, and then send the two splitters to the arduino. Can I just send the 2 sets of stepper wires to the same 4 pins? (Picture attached)

Connecting several stepper drivers to the same Arduino pins does not present an electrical problem. But what will you do if one of the motors misses some steps?

I have no idea how your "splitters" work but connecting two motors to one driver may not be a good idea. How will the driver regulate the current?

Can you post a link to the datasheet for the "splitter"?

And please post a link to the datasheet for your motors.

...R

Considder getting 4 of the A4988. They are cheap.

They take 2 signals. Step and direction.

You can tie all step together.
Then all direction together

Railroader:
4 motors to control the Z axis? How will You control the X and Y direction?

Yes. This is just a vertical lift. Separate mechanically and functionally from the laser engraver itself. Just to hoist the engraver above what is to be engraved.

Unusual construction, but okey. Just hard to guess.

Railroader:
Unusual construction, but okey. Just hard to guess.

I could just do one z axis motor on the actual laser head, and lift the laser head up an down, but I don't want the added weight on the laser head/rails.

Why I decided to lift the whole engraver itself instead.

It's an Ortur Laser Master 2.

Plan is to attach the legs to the lifts with this leg holder I designed and 3d printed.

dave-in-nj:
Considder getting 4 of the A4988. They are cheap.

They take 2 signals. Step and direction.

You can tie all step together.
Then all direction together

I have a few easydrivers. 2 real sparkfun ones and 5 clones, but I'm trying to keep the encloser relatively small. Don't want to make it much bigger if I don't have to. Looks like the splitters divide the current evenly and they're wired in parallel
I am going to be using a 24V 3A power supply to power them.

Whether I use 2 or 4 drivers, it sounds like I would still wire it the same to the Arduino since I can splice together the drivers/motors.

Can anyone draw me up a wiring diagram to the pins on the Arduino and supply code for basic 2 button functionality (slow up and down)

Lots of tutorials on how to do what you want

based on what I think.....
you want to lift the unit, gain ground clearance, allow for loading and unloading the machine.
drop the machine back to some point.

is that point important ? laser is non-contact so can it do it's thing if the distance it 1mm or 20 cm ?

the reason for asking is that if you put in say, a tee shirt one time, then a block of wood another, the part height comes in to play. and then the peaks and valleys of the part.

if distance is not important, you do have one tiny problem. a stepper can miss a step. assuming 200 steps per revolution, and two perfectly out of sink motors, after 100 operations, they would be 2 rotations out of sync.

The problem is tiny as you can just drive the steppers to the end of travel and let them miss steps. this brings everything back to a zero.

the following will not work, it is just a general idea.
you need to select what pins.
This uses a pair of buttons, or a momentary , 3 position switch, center off with wires to two pins.

things like digitalWrite(8, LOW); // sets direction
if it moves backwards, then change to HIGH here and LOW on other one

if the speed is too slow, you change
delay(1) to some value you like.

void setup() {                
  pinMode(8, OUTPUT);  // direction
 pinMode(9, OUTPUT); //step
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);


void loop() {

int switchUP = digitalRead(5) ; // pin 5 is the UP switch
int switchDOWN = digitalRead(6) ; // pin 6 is the DOWN switch


if (switchUP == HIGH) {
    digitalWrite(8, LOW); // sets direction 
    digitalWrite(9, HIGH);
    delay(1);        
    digitalWrite(9, LOW); 
    delay(1);      
   }  // end of up

if (switchDOWN == HIGH) {
    digitalWrite(8, HIGH); // sets direction 
    digitalWrite(9, HIGH);
    delay(1);        
    digitalWrite(9, LOW); 
    delay(1);      
   }  // end of down

} // === END OF LOOP ====

dave-in-nj:
based on what I think.....
you want to lift the unit, gain ground clearance, allow for loading and unloading the machine.
drop the machine back to some point.

is that point important ? laser is non-contact so can it do it's thing if the distance it 1mm or 20 cm ?

the reason for asking is that if you put in say, a tee shirt one time, then a block of wood another, the part height comes in to play. and then the peaks and valleys of the part.

if distance is not important, you do have one tiny problem. a stepper can miss a step. assuming 200 steps per revolution, and two perfectly out of sink motors, after 100 operations, they would be 2 rotations out of sync.

The problem is tiny as you can just drive the steppers to the end of travel and let them miss steps. this brings everything back to a zero.

the following will not work, it is just a general idea.
you need to select what pins.
This uses a pair of buttons, or a momentary , 3 position switch, center off with wires to two pins.

things like digitalWrite(8, LOW); // sets direction
if it moves backwards, then change to HIGH here and LOW on other one

if the speed is too slow, you change
delay(1) to some value you like.

void setup() {                

pinMode(8, OUTPUT);  // direction
pinMode(9, OUTPUT); //step
 digitalWrite(8, LOW);
 digitalWrite(9, LOW);

void loop() {

int switchUP = digitalRead(5) ; // pin 5 is the UP switch
int switchDOWN = digitalRead(6) ; // pin 6 is the DOWN switch

if (switchUP == HIGH) {
   digitalWrite(8, LOW); // sets direction
   digitalWrite(9, HIGH);
   delay(1);        
   digitalWrite(9, LOW);
   delay(1);      
  }  // end of up

if (switchDOWN == HIGH) {
   digitalWrite(8, HIGH); // sets direction
   digitalWrite(9, HIGH);
   delay(1);        
   digitalWrite(9, LOW);
   delay(1);      
  }  // end of down

} // === END OF LOOP ====

Thank you for the tutorial link, much appreciated.

As for clearance, it doesn't have to be precise, just needs to be able to lift the engraver over the object to be engraved. Objects to be engraved will be mostly perfectly flat. Spacing matters in terms of the lasers focal point and focusing the laser, but again doesn't have to be absolutely precise and perfect. Just building something to lift the engraver at the push of a button (and lower) instead of putting blocks of wood under the legs to lift it up during a job.

As for missed steps, I could always just get in the habit of "homing" the lift after every job by returning the engraver to ground level.

Thanks for the code I'll look at it and give it a try. Does this allow for the motors to only move while the button is being pushed/held down? Would like them to stop when I stop pressing the button. Thank you

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.