Control NEMA 23 large bipolar stepper motor with DM556T driver using the Stepper Library?

TLDR: Can I use the Stepper.h library in Arduino using the setup shown in my drawing, or do I have to switch it up?

So I'm trying to control my NEMA 23 stepper motor (Link) using this stepper driver via my Arduino.

I've got it working just fine with the setup shown for what I need at the moment using digitalWrite(pin, HIGH/LOW), but as my project gets more complicated I would like to be able to streamline my code and make it less messy and more efficient.

I've been reading up on the <Stepper.h> library and it looks great and exactly like what I need, but I'm having trouble figuring out how to connect everything. Every tutorial I've seen either uses the driver I'm using (or one like it) or the stepper motor library.

I've tried looking through the docs, but they don't really specify what the different pins mean when establishing the stepper object in Arduino:

Stepper(steps, pin1, pin2)

  • pin1, pin2: two pins that are attached to the motor.

Like what does that even mean. I have to assume they can't just be attached willynilly.

Here is a crude drawing of how I have it set up now: (please ignore the change in color of the wires going from the stepper motor to the driver).

This setup has been working well without using the stepper library, but I've been having trouble when trying to implement <Stepper.h>. I wasn't sure which pins were pin1 and pin2, so I used what had been working before when I had one pin for Pulse and one for Direction:

Stepper myStepper(steps_per_rev, 8, 9);

However, that has not been working, so I've been assuming that the setup needs to be different. (however, it could also be some small bug in my code that I'm not seeing at the moment).

AccelStepper.h is a popular and often used library.

I say the same, can't see any bug, not even the code.

Whenever I use stepper motors with Arduino, I use a stepper motor driver - either something from Pololu or for bigger motors something in the form factor you have drawn that you can get from multiple manufacturers such as Leadshine.

In either case, they let you control the stepper with three inputs: step, direction and enable. The driver takes care of turning the motor coils on & off in the right sequence to do what you ask.

It appears to me that the stepper library does the same thing: it abstracts the coil switching details away in software but it does need to know how the coils are wired up.

Since you have a sophisticated driver module to take care of all this, you do not need the stepper library. As @Railroader suggests, you can use Accelstepper - it seems popular or you can simply control it yourself using step and direction.

The Stepper library is not for step/dir type drivers. The Stepper library 2 pin constructor is for a different type of driver using the L293/L298 pieces of crap drivers.

AccelStepper is a good library for the step/dir drivers, but I find the MobaTools stepper library a bit easier to learn and use. And of course you can roll your own stepper code. See Robin2's simple stepper code tutorial.

Oh I understand! Thank you very much

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