Controlling two steppers with one arduino?

Hello All!

I've built a rotary indexer for drilling holes in tubing.
I'm going to manually operate the plunge of the drill but I'd like to control the rotational axis and the linear axis (both with stepper motors and drives)

What is the best way to do this?
I've been using a PC to run steppers (Mach 3) for 20+ years but I want to simplify this without the PC.

I'll need one input for rotary axis and another or the linear.
I'd like to do each step one at a time. (push a button to turn the rotary a set degree, and another to turn the linear a certain distance.)

I'm sure someone has done this before.

Any help is greatly appreciated!

An arduino can control at least 4 steppers. Pick a stepper library then look at the sample sketches in the library.

Sure, it can be done but unless you're already a programmer, you're going to be spending quite a bit of time learning to program, and about the misc. Arduino bits.

Why do you want to eliminate the PC? What you're doing now is probably the simplest way (time-wise) to do it.

"Why do you want to eliminate the PC? What you're doing now is probably the simplest way (time-wise) to do it."
Several reasons. First, I already have 5 PCs running six different CNC machines I've built over the years. Then there's the space the PC takes up + monitor etc. The interface card to the PC is another $200 and then a B.O.B. $100......

A PC is good if you want multi-axis moving simultaneously for 3D machining etc.
I need to move a drilling platform to a set position and rotate the indexing head a set number of degrees.

Just remember, with the rotary axis the stepper does 200 steps per revolution so you can only stop at multiples of 1.8°, not at 15, 26.2°, etc.

You will never get the control flexibility you have with Mach3 in an Arduino setup. Are you sure the stepper motors you are using can be used with an Arduino and associated controller board?

"Just remember, with the rotary axis the stepper does 200 steps per revolution so you can only stop at multiples of 1.8°, not at 15, 26.2°, etc."

That is not true. Microstepping drives do just that, break down steps into partial steps. In addition, I'm not using direct drive but rather a planetary gear head that further reduces the turning ratio.

I don't need flexibility, all I need are two knobs. One for rotary degrees (0-360) and another for distance down the X and only linear axis to move the drill head.

What is that ratio?

Hi, @tristar500

Google;

mach 3 stepper driver arduino cnc

Tom.... :smiley: :+1: :coffee: :australia:

OK, fair enough. I won't argue with your architectural choices.

You can do this with

  • Arduino: any type. This is not a technically challenging application unless you need high RPM motions. A Nano would be my first choice. If you need to run at higher speeds than it can support, then probably an Rpi Pico or an ESP32.
  • AccelStepper library (or any favorite you might have)
  • 2x motor drivers suitable for your steppers
  • Power supply (obvs)
  • User Interface - potentiometers or encoders for speed/position setting, pushbuttons to trigger motion
  • I would suggest some kind of feedback if you want the user to be able to set speeds & positions (markings on the knob are probably not precise enough)
  • If you're going to add a screen for feedback, then you might as well go whole hog and eliminate the knobs/pushbuttons and use a touchscreen for all of it.
1 Like

16:1 Harmonic Drive. (zero backlash)

So, with a 200 step motor, you will not be able to stop at say, 15°.
133 steps = 14.9625°, 134 steps = 15.075°.

1 Like

MICROSTEPPING drive.
motor can turn a fraction of a full step.

The MobaTools have some useful stepper examples, and are written to be modular and reasonably extensible. These example simulations might be useful for thinking about button vs potentiometer vs other controls.

Should direct your answer to OP so he sees it. I'd just use grbl for something like this.

1 Like

Yes, with microstepping you can get very close to 15° but never exactly. Also, the higher the microstepping, the less the holding torque. Good luck.

That's a great idea -- you could set it up the multi-stepper-device with a general purpose CNC control with grbl, and then perhaps add an Arduino to handle some UI and emit appropriate GCODE to send into the CNC.

If you are considering an encoder control, Here's a Wokwi simulation of using a rotary encoder and screen to adjust multiple variables. The print messages could be modified to print some initialization GCODE in setup() and "G01 X15.123;", "G01 Y314.5" etc. when the variables change.

Either that or run an off the shelf GCode sender program like UGS. OP doesn't want a PC, so maybe a Raspberry Pi and a 5" display would be OK. UGS should run on a Pi and lets you create macros so you can just push a button and get the motions you want.

1 Like

This looks pretty slick:

1 Like