Stepper.h library problem

Hello, I am having a problem with the Stepper.h library.
I am using a Arduino Uno,
a MicrostepDriver (https://www.mcielectronics.cl/website_MCI/static/documents/TB6600_data_sheet.pdf),
a Nema step motor
(https://www.omc-stepperonline.com/download/23HS22-2804S-HG50.pdf),
and a Dell 19V power supply.

The step motor is connected to the MicrostepDriver as follows:
Blue to B-
Red to B+
Green to A-
Black to A+

The Dell power supply is connected to the MicrostepDriver as follows:
Black to GND
White to VCC

DIR - and PUL - are connected to GND on the UNO.
DIR + is connected to Pin 2 and PUL + is connected to Pin 3 (Pins 2 and 3 on the UNO, that is).

The Microstep settings are as follow:
S1: ON
S2: ON
S3: OFF
(1 Microstep)
S4: ON
S5: OFF
S6: ON
(1 A current)

The Nema step motor has a step angle of 1.8 degrees, so 200 steps/revolution.
With the following code the motor only makes around 1/4 of a full revolution:

#include <Stepper.h>

int stepsPerRevolution=200;

Stepper myStepper(stepsPerRevolution,2,3);

int motSpeed=12;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
myStepper.setSpeed(motSpeed);
}

void loop() {
  // put your main code here, to run repeatedly:
myStepper.step(stepsPerRevolution);
delay(2000);
myStepper.step(-stepsPerRevolution);
delay(2000);
}

I have however been successful doing the same thing with the AccelStepper.h library, so that when I asked myStepper to take 200 steps, it completed one full revolution.

sorry if I have mis-formatted this post or forgotten to include any information.

-Einar

Double-check switch S2. If that is OFF instead of ON (on off off instead of on on off) you would get 4x microstepping.

Hi John, I have double checked now, S2 is definitely ON.
-Einar

Then, aside from a fault in the S2 switch, I can't think of a reason for your stepper to move 1/4 turn in 200 steps.

I am having the same problem :slight_smile:
As I mentioned it does however function correctly in the AccelStepper.h library which makes me think it's a coding situation...
-Einar

Stepper::Stepper(int number_of_steps, int motor_pin_1, int motor_pin_2)

Stepper.h knows nothing of step/dir drivers.

So the Stepper.h library is incompatible with a MicrostepDriver?
-Einar

You meant "step/dir driver" and not "Microstep Driver".

With a step/dir driver, you don't need Stepper.h