Sub topic 15
Troubleshooting overheating, resets, and weak torque
This chapter assumes you have read the earlier chapters on H-bridge switching, flyback paths, driver selection, power and grounding, current limits, and the Arduino control code. You should be comfortable with Ohm's law, a multimeter, and analogWrite. The goal is a repeatable method for finding the cause of a fault, with the most common causes listed first.
A method before a fix
Motor faults look alike from the outside. A driver that gets hot, a board that resets, and a motor that is weak can all come from the same underlying problem, such as a supply that cannot deliver enough current. Changing several things at once hides the cause. Use this order instead:
- Remove the load. Run the motor unloaded and note the behavior.
- Check the supply voltage at the driver's motor terminals while the motor runs, not while it is idle.
- Check the ground connections.
- Check the signals from the Arduino.
- Change one thing, then test again.
A multimeter is enough for most of this. An oscilloscope helps with resets and PWM problems, but it is not required.
The motor does not start
Work from the simplest cause to the hardest.
- Enable pin not driven. On an L298N or L293D, the enable input must be high, or a PWM signal with a non-zero duty cycle. If a jumper holds it low, or the sketch never sets it, the outputs stay off.
- Both direction inputs equal. With IN1 and IN2 both LOW, or both HIGH on many drivers, the motor does not turn. The
setMotorfunction from the earlier chapter deliberately writes both LOW at speed 0. If the motor never moves, print the value being passed in. - Duty cycle too low. A motor needs a minimum voltage to overcome static friction and gear drag. At
analogWrite(EN, 40)out of 255, the average voltage may be below that threshold, so the motor hums and does not turn. Raise the value in steps and note where it starts to move. This number is the motor's dead zone. - No common ground. The Arduino ground and the motor supply ground must connect. Without that, the logic inputs have no reference, and the driver reads random levels.
- Wrong pin for PWM. On an Uno,
analogWriteonly produces PWM on pins 3, 5, 6, 9, 10, and 11. On any other pin it writes a plain HIGH for values of 128 or more, and LOW below that. - Power wired to the wrong terminal. Many modules have separate logic and motor power inputs. Check the module's labeling and the direction of each connection.
A quick test isolates the driver from the sketch: connect the enable pin to 5 V, set IN1 high and IN2 low with jumper wires, and see whether the motor turns. If it does, the fault is in the code or the PWM pin. If it does not, the fault is in the wiring, the supply, or the driver.
The Arduino resets
A reset almost always means the Arduino's supply voltage dropped below its brown-out threshold for a moment. The motor causes this in three ways.
- Start-up current. A motor at standstill has no back-EMF, so it draws its stall current for the first few milliseconds. A small motor rated at 0.5 A running can pull 2 A or more at start. If the supply, or the regulator feeding the Arduino, cannot supply this, the voltage sags.
- Shared supply. If the Arduino and the motor run from the same battery or the same thin wires, the sag reaches the Arduino. Using the Arduino's own supply separately from the motor supply removes this path.
- Electrical noise. Brushed motor commutation produces voltage spikes. Spikes on the supply or ground lines can trigger resets or corrupt readings.
The usual fixes, in order of effort:
- Add a bulk electrolytic capacitor across the driver's motor supply pins, placed close to the driver. Values from 100 µF to 1000 µF are common for small motors.
- Add a 100 nF ceramic capacitor directly across the motor terminals, with short leads. This reduces brush noise.
- Use thicker, shorter wires for motor power and the ground return.
- Power the Arduino from a separate regulator or battery, joined to the motor supply only at the ground.
- Ramp the speed up, as described in the ramping chapter, so the start-up current is spread over time.
To confirm a sag, measure the supply voltage at the Arduino with a multimeter that has a min/max function, or use an oscilloscope. A voltage that dips below about 4.5 V on a 5 V board while the motor starts explains the resets.
The driver overheats
Heat in a driver comes from current multiplied by voltage drop. Check these causes in this order.
Voltage drop in the driver
Bipolar drivers such as the L298N drop roughly 1.5 V to 3 V across the output stage at working current. At 1 A with a 2 V drop, the chip dissipates about 2 W. That is enough to make the chip too hot to touch, with no fault present. The power is:
P = I × V_drop
A MOSFET driver, with an on-resistance of tens of milliohms, dissipates much less at the same current. The calculation: at 1 A and 0.1 Ω of total on-resistance, P = I² × R = 0.1 W. If your driver is bipolar and runs warm, either add a heatsink, reduce the current, or move to a MOSFET driver.
Current above the rating
Compare three numbers: the motor's running current with your load, its stall current, and the driver's continuous current rating. The datasheet rating for the continuous current often assumes a good heatsink and a particular ambient temperature. On a bare module without a heatsink, you can often use only a part of the rated value. If the motor stalls in your mechanism, even briefly, the current rises to the stall value, and the driver heats quickly.
Shoot-through
If both switches on one side of the bridge conduct at once, current flows from the supply to ground through the driver, with no motor in the path. Integrated drivers prevent this internally. A discrete bridge built from separate MOSFETs does not, unless the code or a gate driver adds dead time. Signs of shoot-through include a driver that heats up even with the motor disconnected, and a supply that shows high current with no load.
PWM frequency and switching loss
A higher PWM frequency raises the switching losses in each transition. For a bipolar driver with slow transitions, 31 kHz can heat the chip more than 490 Hz does. If you raised the frequency to remove audible whine, and the driver now runs hotter, try a middle value.
| Cause | How to recognize it | Fix |
|---|---|---|
| Voltage drop in a bipolar driver | Warm at normal load, current within rating | Heatsink, lower current, or MOSFET driver |
| Current above rating | Hot and the motor load is heavy | Larger driver, lower load, or current limit |
| Stall or jam | Hot rapidly, motor not turning | Fix the mechanism, add stall detection |
| Shoot-through | Hot with the motor disconnected | Add dead time or use an integrated driver |
| High PWM frequency | Hot after changing the timer | Lower the frequency |
Weak torque or low speed
Torque in a brushed motor follows current, and current follows the voltage that actually reaches the motor. A weak motor is almost always a low voltage at the motor terminals.
- Voltage drop in the driver. A 6 V motor on a 7.4 V supply through an L298N may see only about 5 V at the motor. Measure the voltage across the motor terminals while it runs under load. Compare it with the supply voltage.
- Supply sag under load. A small battery or a weak adapter drops in voltage as the current rises. Measure at the driver input while the motor works.
- Duty cycle capped. If the sketch limits speed to a value below 255, the motor never sees the full voltage. Check for
constraincalls or a scale factor in the code. - Thin or long wires. Resistance in the wires drops voltage in proportion to current. A 0.5 Ω total wire resistance at 2 A drops 1 V.
- Current limiting. Some modules and supplies limit current. A bench supply in constant-current mode lowers its voltage until the current falls to the limit, and the motor slows or stalls.
- Mechanical load. Check that the shaft turns freely by hand with the power off. Gearbox friction, a tight bearing, or a wheel that rubs the chassis all lower the available torque.
A reference calculation helps. If the motor is rated for 6 V and the driver drops 2 V, you need at least 8 V at the supply to reach the rated voltage at the motor. This is why bipolar drivers are poorly matched to low-voltage motors, such as those powered from two or three AA cells.
Stutter and noise at low speed
At low duty cycles the average voltage may be too small to keep the motor moving steadily. It then advances in jerks as the PWM pulses push it past static friction. Three adjustments help:
- Set a minimum duty cycle that is just above the dead zone, and map your speed range onto the span above that minimum.
- Move the PWM frequency up, out of the audible range, using the timer change from the earlier chapter.
- Use a driver with a mode that keeps the current flowing between pulses, so the current is smoother. The decay modes chapter describes this.
A mapping function makes the first adjustment concrete:
const uint8_t IN1 = 7;
const uint8_t IN2 = 8;
const uint8_t EN = 9;
const int MIN_PWM = 60; // measured dead-zone edge for this motor
// level: -100 to 100 percent, mapped above the dead zone
void setMotorPercent(int level) {
level = constrain(level, -100, 100);
int pwm = 0;
if (level != 0) {
pwm = map(abs(level), 1, 100, MIN_PWM, 255);
}
digitalWrite(IN1, level > 0 ? HIGH : LOW);
digitalWrite(IN2, level < 0 ? HIGH : LOW);
analogWrite(EN, pwm);
}
void setup() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(EN, OUTPUT);
}
void loop() {
setMotorPercent(10);
delay(2000);
setMotorPercent(0);
delay(1000);
setMotorPercent(-10);
delay(2000);
setMotorPercent(0);
delay(1000);
}Set MIN_PWM by experiment: increase the PWM value from zero until the unloaded motor just starts, then add a small margin.
A short measurement checklist
Keep this list with the project. Each reading narrows the cause.
- Motor supply voltage at the driver, idle and during start-up.
- Voltage across the motor terminals under load.
- Current drawn from the supply, with a meter in series or a bench supply display.
- Ground continuity between the Arduino, the driver, and the supply.
- Temperature of the driver after one minute of running, by touch with care or an infrared thermometer.
Exercise
A project uses an L298N module with a 6 V motor drawing 1.2 A under load. The supply is 7 V. The motor is weak and the L298N is very hot. Estimate the voltage at the motor and the power dissipated in the driver, assuming a 2 V drop across the output stage, and name two changes that would improve both symptoms.
Show answer
The voltage at the motor is about 7 V − 2 V = 5 V, below the 6 V rating, so torque and speed are low. The driver dissipates about 1.2 A × 2 V = 2.4 W, which is high for a chip with no heatsink. Two improvements: replace the L298N with a MOSFET driver, whose voltage drop is tens of millivolts at this current, so the motor sees nearly 7 V and the driver dissipates little; or raise the supply to about 8 V and add a heatsink, which restores the motor voltage but keeps the heat in the driver (reduce the supply to the motor's limit if it is over-voltage at no load).
Exercise
An Arduino resets each time a motor starts, but runs normally once the motor is turning. The Arduino and the motor share one battery. List three changes, in order of increasing effort, that you would try.
Show answer
First, add a bulk capacitor of 100 µF to 1000 µF across the driver's motor supply pins, close to the driver, plus a 100 nF ceramic capacitor across the motor terminals. Second, ramp the speed up with a function like rampTo so the start-up current is spread over time. Third, separate the supplies: power the Arduino from its own regulator or battery and join the grounds only at one point. Thicker, shorter motor wires are also a valid change.