Stepper Motor project issue

Hello All,

I am trying to get my Arduino to control a stepper motor. I've wired the Arduino to a TMC2208 then to a NEMA 11. The motor is moving how the code says it should but it is very slow and sometimes doesn't work. I am using a 5v 2.1A USB battery pack to power everything through the Arduino. I am unsure if I wired something wrong or if it needs more power. I have attached a photo and will put the code I am currently running below.

  • Stepper Motor Demonstration 4
    Stepper-Demo4.ino
    Demonstrates NEMA 17 Bipolar Stepper with A4988 Driver

    DroneBot Workshop 2018
    https://dronebotworkshop.com
    */

// Define Constants

// Connections to A4988
const int dirPin = 2; // Direction
const int stepPin = 3; // Step

// Motor steps per rotation
const int STEPS_PER_REV = 200;

void setup() {

// Setup the pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {

// Set motor direction clockwise
digitalWrite(dirPin,HIGH);

// Spin motor one rotation slowly
for(int x = 0; x < STEPS_PER_REV; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}

// Pause for one second
delay(1000);

// Set motor direction counterclockwise
digitalWrite(dirPin,LOW);

// Spin motor two rotations quickly
for(int x = 0; x < (STEPS_PER_REV * 2); x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin,LOW);
delayMicroseconds(1000);
}

// Pause for one second
delay(1000);
}

Please post a proper wiring diagram. No experienced engineer would appreciate a foto.

Hopefully this is more helpful.

There is NO WAY that you can power a stepper from the Nano, period. The A4988 stepper driver needs a motor power supply of minimum 8V and how ever much current that stepper motor needs (see motor data sheet).

You must set the coil current correctly before using the stepper motor with the A4988 driver. The Pololu page that I linked has instructions and a video showing how. Make sure that you use the sense resistor value on your A4988 break out board in the calculations.

If you doing anything other than just driving the stepper check out my tutorial on Multi-tasking in Arduino which has a complete stepper example controlled by user input and temp. sensor.
That tutorial also shows how to get the stepper to run faster and how to measure how fast it can run.

But if you actually read the posting you'll see we're talking about a TMC2208 module, which will work from 4.75V to 36V.

However you won't get much speed operated at such a low voltage - 24V is more commonly used for steppers.

One major issue with Your wiring is that the controller has no power.....
In a real wiring diagram it would have....

Thank you @MarkT for your response. I have very little experience electronics. I've been told a step up booster can help bring up the voltage although when I add it to the board the motor gets locked up.