Could use some advice on a project I'm working on involving controlling stepper motors via Arduino

So I'm working on an Arduino project that uses a part I've never worked with- stepper motors. The goal is to turn three stepper motors attached to timing belts to open and close curtains when the Arduino receives a command. Unfortunately, I don't know how to drive and power the motors.

The parts I have so far:

  • 3 NEMA 17 42BYGH stepper motors (along with the cables, timing belts and timing belt wheels)
  • An Arduino Uno R3 (which I can change out if necessary)
  • 5 A4988 stepper drivers
  • A RAMPS board (someone on a discord server told me it was the optimal way to run motors from an Arduino, and I'm starting to doubt that)
    1. A12v power supply

Anyone have any tips for wiring this up? If possible, I'd like to power this all from the same supply, which probably means I need a little step-down board to power the Arduino off the motor power supply. Thanks for any and all help, and sorry if I don't know my terminology very well. I'm just starting with designing my own ideas instead of building stuff I found on the internet.

You failed to design in any way for your program to know where the zero or stating position of your timing belt. You may also need to add safety limit switches just in case your stepper motor program has a bug!

I have limit switches, I just didn't include them in the list as I didn't think they were relevant. I've wired and coded those before, it's the motors I'm having trouble with.

The Pololu link has information, including A4988 wiring and a setup video...

0J10073.600

A RAMPS board isn't terrible -- but the tricky part is writing your own code for the pre-wired connections for the drivers and end switches. RAMPS 1.4 - RepRap could help:

// For RAMPS 1.4
#define X_STEP_PIN         54
#define X_DIR_PIN          55
#define X_ENABLE_PIN       38
#define X_MIN_PIN           3
#define X_MAX_PIN          -1 //PIN 2 is used

#define Y_STEP_PIN         60
#define Y_DIR_PIN          61
#define Y_ENABLE_PIN       56
#define Y_MIN_PIN          14
#define Y_MAX_PIN          -1 //PIN 15 is used

#define Z_STEP_PIN         46
#define Z_DIR_PIN          48
#define Z_ENABLE_PIN       62
#define Z_MIN_PIN          18
#define Z_MAX_PIN          -1 //PIN 19 is used

//extruder 1
#define E0_STEP_PIN        26
#define E0_DIR_PIN         28
#define E0_ENABLE_PIN      24

//extruder 2
#define E1_STEP_PIN        36
#define E1_DIR_PIN         34
#define E1_ENABLE_PIN      30

Here's a configuration of some arduino code attached to a set of stepper motors attached to RAMPS pins:

RAMPS is generally ok. Wiring diagrams and more here RAMPS 1.4 - RepRap

The RAMPS board provides power for the Mega, so you don't need a separate 5V supply.

Are the steppers independent? If so you can use a library like AcccelStepper to move them.

I have a PCB I designed I could send you if you cover postage. You should be able to just plug in the step driver's to the board then program the atmega328 as needed. I use it to control a CNC machine and it works very well for me but it's a very specific process, yours would ultimately need your own tweaking.

But as far as the original request it seems to fit the Bill nicely:

  • Up to four a4988 step driver's just plug into female headers

  • Has a screw terminal for your 12v supply, or use the input power jack which I typically use for power. The input jack accepts an older very common Dell laptop power supply readily available for cheap.

  • Has an onboard regulator for the 5v to the Arduino

  • Uses a 28 pin female ic socket so if you have the Uno with the removable 28 pin dip atmega28p you can program it on the Uno, then plug it into this board

  • I designed it with all through hole parts so it's very easy to solder different configurations if needed

Google Photos

I just realized something here, RAMPS was intended for Mega so a better board for Uno which does a similar job for 4 stepper motors is the CNC shield e.g. Arduino CNC Shield - GRBL – Premium Made In Europe

Not sure from your parts list whether you want 3 or 5 motors.

1 Like

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