Sub topic 15
Troubleshooting common faults
This chapter assumes you have worked through the earlier chapters. You should know how a STEP/DIR driver is wired, how to set its current limit, and how step timing relates to RPM. Most stepper faults come from a small set of causes: wiring, current setting, supply, timing, and load. The approach here is to match the symptom to a short list of checks and test one thing at a time.
A method that saves time
Change one variable per test. Before you touch code, make sure the hardware is safe and simple.
- Remove the load and any belt, gear, or lead screw.
- Power the driver at a modest speed, such as 60 RPM or less, with no acceleration.
- Use the simplest sketch you have, such as the constant-rate STEP/DIR example.
- Add complexity back (microstepping, acceleration, a library) only after the bare motor runs.
If the simple case works and the full system fails, the fault lies in what you added.
Symptom table
| Symptom | Most likely causes | First check |
|---|---|---|
| Motor does nothing, no hum | No motor supply, driver disabled, no STEP pulses | Measure supply voltage at the driver. Check the ENABLE pin |
| Motor hums or buzzes but does not turn | Swapped or mispaired coil wires, step rate too high, current too low | Verify coil pairs, then lower the speed |
| Motor vibrates or jerks in place | One coil pair wired wrongly, pulses too fast to start | Check pairs with a multimeter |
| Motor turns the wrong way | DIR polarity or one coil reversed | Flip DIR in code, or swap one coil's two wires |
| Motor stalls when speeding up | No acceleration ramp, supply voltage too low | Add a ramp, check torque at that speed |
| Motor loses position over time | Missed steps from overload or current too low | Reduce speed or load, raise current within the rating |
| Motor or driver is very hot | Current limit too high, no cooling | Lower the limit, add a heatsink and airflow |
| Driver resets or Arduino reboots | Supply sag, ground noise, shared supply | Use a separate motor supply with a common ground |
| Rough or noisy at certain speeds | Mechanical resonance | Change speed, use microstepping, or add damping |
Motor hums but does not turn
This is the most common fault. A hum means the coils are energized, but the rotor is not following the changing field. Work through the causes in order.
Check the coil pairs
A bipolar motor has two coils, called A and B. Each coil's two wires must connect to the same driver output pair (for example 1A/1B for coil A and 2A/2B for coil B). If one wire from each coil lands on the same output pair, the fields cancel and the rotor only shakes.
Find the pairs with a multimeter set to resistance. Two wires from the same coil read a few ohms, as given on the datasheet. Wires from different coils read open circuit. Another test: spin the shaft by hand while two wires are touched together. If the shaft feels noticeably stiffer, those two wires belong to the same coil, because the shorted coil resists the generated current.
Check the step rate
A motor that cannot accelerate instantly will hum if the first pulses arrive too fast. Try a slow rate, such as 100 steps per second, which is 4000 microseconds per step when you count both the high and low halves of a 5000 microsecond period. Use the helper from the speed chapter:
unsigned long stepIntervalMicros(float rpm, int stepsPerRev) {
return (unsigned long)(60000000.0f / (rpm * stepsPerRev));
}
const int STEP_PIN = 3;
const int DIR_PIN = 4;
void setup() {
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
digitalWrite(DIR_PIN, HIGH);
}
void loop() {
// 30 RPM at 200 steps per revolution = 10000 us per step.
unsigned long interval = stepIntervalMicros(30.0f, 200);
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(interval / 2);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(interval / 2);
}Remember that microstepping multiplies the steps per revolution. At 1/16 microstepping, stepsPerRev is 3200, and the same 30 RPM needs 625 microseconds per step. If you changed the microstep pins but not the code, the speed will be wrong by that factor.
Check the current limit
If the current limit is far below the motor's rating, the motor produces too little torque to turn even without a load. Measure the reference voltage on the driver's trimmer, then compare it with the formula for your driver. Raise it in small steps, and stay at or below the motor's rated current per phase.
Vibration, jerking, and wrong direction
Jerky motion without a hum often points to one coil being reversed relative to the other. A single reversed coil does not always stop the motor. Some wirings still turn it, but with uneven steps and the wrong direction. Swapping the two wires of one coil flips the direction. Swapping wires between coils is the error to avoid.
If the direction is merely opposite to what you want, change DIR_PIN polarity in code. That is simpler and safer than rewiring.
Missed steps and stalling
Open-loop control gives the driver no feedback, so a missed step is invisible to the Arduino. The position you believe in drifts away from the real one. The usual causes:
- The speed is above what the motor's torque curve supports. Torque falls as speed rises, as covered earlier.
- The load is too heavy or has friction that changes along the travel.
- The acceleration is too abrupt, so the rotor cannot keep up with the field.
- The supply voltage is too low, which limits how fast current builds in the coils at high speed.
To test, run the same move many times and mark the shaft. If the mark ends up in a different place after 50 round trips, you are losing steps.
An acceleration ramp is usually the fix. This sketch uses AccelStepper with moderate values, which you can raise gradually:
#include <AccelStepper.h>
AccelStepper stepper(AccelStepper::DRIVER, 3, 4);
void setup() {
stepper.setMaxSpeed(600); // steps per second
stepper.setAcceleration(300); // steps per second per second
stepper.moveTo(1600);
}
void loop() {
if (stepper.distanceToGo() == 0) {
stepper.moveTo(-stepper.currentPosition());
}
stepper.run();
}If the motor stalls, halve the acceleration and the maximum speed. If it then works, increase each value in small steps until you find the limit, then keep a safety margin of about 30 percent.
Blocking code starves the pulses
stepper.run() must be called very often. Any delay(), long Serial.print(), or slow sensor read inside loop() pauses the pulse stream. The motor then stutters or stalls during ramps. Replace delay() with millis()-based timing, and keep the rest of the loop short.
The built-in Stepper library blocks until each move finishes. That is fine for simple jobs, but the Arduino can do nothing else during a move.
Overheating
A stepper motor draws its set current even when it is standing still, so it warms up while holding position. Motor temperatures of 60 to 80 degrees Celsius can be normal, and many datasheets allow a case temperature up to 80 to 100 degrees. The driver is the more fragile part.
- Lower the current limit if the motor is too hot to touch for a few seconds and the load does not need the torque.
- Attach a heatsink to the driver chip and add airflow for currents above about 1 A.
- Use a driver feature that reduces current at standstill, if it has one, or disable the driver with the ENABLE pin when the motor does not need to hold.
- Do not set the current limit above the motor's rating to gain torque. The motor will overheat and its insulation will degrade.
Resets, noise, and erratic behavior
If the Arduino reboots or the motor moves on its own, suspect the power wiring.
- Use a separate supply for the motor, rated for the driver's voltage and at least the current you set.
- Connect the grounds of the motor supply and the Arduino at one point so the STEP and DIR signals have a common reference.
- Place a capacitor of 47 µF or more across the driver's motor supply pins, close to the driver, as the datasheet recommends. A long supply lead adds inductance, and the capacitor absorbs the voltage spikes.
- Keep motor wires away from signal wires, and twist each coil pair together.
Quick checks with a multimeter
A meter finds most faults in minutes.
- Motor supply at the driver terminals, measured while the driver is idle and again while the motor runs. A large drop under load means the supply is too weak.
- Coil resistance for each pair, compared with the datasheet.
- Driver reference voltage, used to confirm the current limit.
- Logic voltage on STEP when you run the test sketch. A meter will show an average value, so a reading between 0 and 5 V suggests pulses are present.
Exercise
A motor driven at 1/8 microstepping with 200 full steps per revolution hums and does not turn. Your code uses stepsPerRev = 200 and asks for 120 RPM. What step interval did you intend, what interval is the driver actually seeing relative to the microstepped motion, and what should you check first?
Show answer
With 200 steps per revolution, 120 RPM gives 60000000 / (120 x 200) = 2500 microseconds per step. At 1/8 microstepping the motor needs 1600 microsteps per revolution, so the correct interval is 60000000 / (120 x 1600) = 312.5 microseconds. The code produces pulses eight times too slow for 120 RPM, so the motor would turn at 15 RPM, not hum from overspeed. A hum therefore points elsewhere: check the coil pairs and the current limit first. Then correct stepsPerRev to 1600. Also note that 312.5 microseconds is near the driver's minimum pulse limits, so confirm the speed is within the motor's torque curve.
Exercise
After 50 round trips, a marked shaft ends up 20 degrees from where it started, and the Arduino never reported an error. What does this indicate, and name two changes to try?
Show answer
The motor is missing steps, and open-loop control cannot report this. Try lowering the maximum speed or acceleration, reducing the load, or raising the current limit within the motor's rated current. A higher supply voltage can also help at high speeds.