Unstable Stepper Motor

Hi everyone,

I’m making a camera slider for a school project, which involves a stepper motor turning a gear train and a belt.

I am using an Arduino UNO and an A4988 stepper driver to operate my stepper motor.

I also have made a custom PCB to solder in my driver, header pins, and stepper coils.

I am supplying the Arduino with a 12V, 2.5 amps max DC power supply.

Here is my wiring setup.

Arduino Vin - Driver Vmot

Arduino Gnd - Driver Gnd

220 uF capacitor wired across Vmot and Gnd

Stepper motor coils - 2a, 2b, 1a, 1b

Arduino 5V - Driver VDD

Arduino Gnd - Driver Gnd

Arduino pin 5 - Driver En pin

Arduino pin 6 - Driver Step pin

Arduino pin 7 - Driver Dir pin

I’ll include some photos at the end of this forum.

Here are my problems:

  1. The stepper motor does not rotate smoothly - it accelerates and decelerates with a rough noise, and sometimes stalls.
  2. This is the weirdest error that I cannot figure out. The stepper motor will only rotate when the A4988 driver is touching carpet (doesn’t work when touching plastic), or when I bring my finger close - it doesn’t even have to touch the underbelly of the driver - just bring the finger close to the driver and it starts rotating. It’s so weird and I can’t figure it out.

At first, I thought (and still think) that the stepper motor didn’t have enough torque to drive the belt, so I added a gear system of 8:40, which increased the output torque by 5.

I’ve just been running code from ChatGPT (I’m not experienced in Arduino Code), and nothing it does seems to help. It uses AccelStepper.h as the library.

Does anyone know how to solve these two problems?

Thanks,

Luke M

Here’s a video of the stepper motor trying to drive the camera platform.

Here are some photos of the wiring.

Accurate annotated schematic please

Here’s a Schematic of the system.

As for the stepper motor cables/coils, I wasn’t sure which should go to where.

On the website from which I got the motor, it reads:
Coil #1: Red & Yellow wire pair. Coil #2 Green & Brown/Gray wire pair.

Here’s the website: Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA | Buy in Australia | ADA324 | Adafruit | Core Electronics

I wired yellow to 1b, red to 1a, green to 2a, and grey to 2b, as shown in the diagram. The motor turns, but roughly, as seen in the video.

How are you powering the stepper ?

With a 12V 2.5 amps max power supply into the barrel jack port on the arduino - the driver gets this from the vin pin on the arduino.

Not a good idea…

You can fry the tracks on the 5V pin.

Run a separate +/-:pair from the supply directly to the driver board.

This is a high impedance stepper - not suitable for a current driver like the A4988. At least you need a PSU with a voltage 2-3 times higher than the rated voltage of the stepper.
But its far better to get a low impedance stepper for the A4988.
In any case you must adjust the motor current at the driver.

Not a good idea. You need to have experience in coding to understand what you get from ChatGPT. Sometimes its really crap.

why don’t you just buy an Adafruit motor shield and stack it on top of your Uno? Their website talks a lot about how well the stepper works with that shield.

This might help:

Gil's Crispy Critter Rules for Processor Hardware:

  1. Rule #1: An Arduino is NOT a Power Supply!
  2. Rule #2: Never connect anything inductive (motors, speakers) directly to an Arduino!
  3. Rule #3: Avoid connecting or disconnecting wires while the power is on.
  4. Rule #4: Do not apply power to any pin unless you are certain of what you're doing.
  5. Rule #5: Do not exceed the maximum voltage or current ratings.
  6. Rule #6: Many Arduinos cannot power transmitters directly.
  7. Rule #7: Before powering your project, take a break and double-check the wiring.
  8. Rule #8: Bad soldering makes for project failure.
    LaryD’s Corollaries:
  9. Coro #1: When starting out, add a 220Ω resistor in series with both input and output pins to protect against shorts.
  10. Coro #2: Invest in a Digital Multi-Meter (DMM) to measure voltages, currents, and resistance.
    Note: Violating these rules can turn your Arduinos into crispy critters. For optimal performance, keep your wires under 25 cm (10 inches).
    Additional Tips:
    • The L293 motor driver, though common, is inefficient as it can lose around 3V as heat when driving both legs of a motor. Consider using a motor driver with MOSFET outputs to reduce heat loss and conserve battery power.
    Not all motor drivers work with each motor, they have to be compatible.
    • The nRF24 radios do not work very well when powered with an Arduino even if the 5V adapter is used.
    • For more on powering Arduino boards, explore this guide: Powering Alternatives for Arduino Boards.

Are you saying I need a different stepper driver? What does it mean to have low or high impedance? Do you have any recommendations for a stepper driver that would work well with my motor?

How can that fry the 5V pin, doesn’t the arduino step it down to 5V?

There's a 1A diode between the barrel connector and the Vin pin. If your stepper needs more than 1A...

And please, please tell me you haven't hot glued wires to that board.

Hahaha, yes I know, it hurt me too. I soldered them in, but I just wanted to make sure that the flimsy wires wouldn’t touch, so I added a little hot glue in between.

So I’ve tried using a 21V max 3.33 amp power supply ( a computer charger) directly to the board, and it is just very loud. Please take a look at the video to see what’s happening.

Did you adjust the driver to 350mA before connecting the motor.
Don't expect high torque/speed from this combo (code for low speeds).
Leo..

I set the potentiometer on the driver to .28V between it and gnd.
The resistors have R100 on them. Does that limit it to 350mA?

Yes. this is the formula.
Current = Vref / (8* R) = Vref / (8 * 0.1) = 0.28 / 0.8 = 0.35A = 350mA.

So maybe try a lower speed.
Leo..

A stepper isn't a quiet motor - especially in full step mode. You must use microstepping to make it move more quiet.

High impedence steppers are usually driven by a simple H-bridge. That's a driver as @blh64 suggested in post #8. But the torque will get fairly low with higher speeds with such a driver/stepper combination.

With low impedance steppers you need a current controlling driver like the A4988. With such motors the rated voltage ( which is fairly low with such steppers - usually <5V) has no meaning - only the current is of relevance. The driver will control the current, and to do so, Vmot of the driver must be much higher than the rated voltage of the motor. Current controlling drivers work very similar to a buck converter. And you will still get a fairly high torque even with higher speeds.

And we need to see your sketch - maybe there are also problems. You cannot assume that ChatGPT always creates reasonable code-

Do you think I can still use the A4988?

#include <AccelStepper.h>

// Pins
const int dirPin = 3;
const int stepPin = 6;
const int enPin = 5;

// Create stepper instance (driver mode)
AccelStepper stepper(AccelStepper::DRIVER, stepPin, dirPin);

// How far to move each way (steps)
const long travelDistance = 1600; // ~half rev at 1/16 microstep for 200-step motor

void setup() {
  pinMode(enPin, OUTPUT);
  digitalWrite(enPin, LOW); // enable driver

  // Smooth motion parameters
  stepper.setMaxSpeed(400);      // top speed (steps/sec)
  stepper.setAcceleration(150);  // gentle acceleration
}

void loop() {
  // Move forward
  stepper.moveTo(travelDistance);
  while (stepper.distanceToGo() != 0) {
    stepper.run();
  }

  delay(200); // short pause

  // Move backward
  stepper.moveTo(-travelDistance);
  while (stepper.distanceToGo() != 0) {
    stepper.run();
  }

  delay(200); // short pause
}