Robot car power

Why your robot car's motors do not turn

When the code runs but the motors do not turn, look at the voltage that reaches them. The battery sags under load, the motor driver loses some, and motors sharing the Arduino's battery can pull its supply down until it resets. Three circuits show each one with meters.

  • Battery and driver figures come from their datasheets, cited on this page.
  • Each circuit runs on this page and opens in the simulator.
  • A robot car sketch to run on the virtual Arduino Uno.

What the circuits model

These are simple models, not a battery or a motor. Each reading is right at the current stated, and shows how big each loss is. Measure your own build with a multimeter.

  • A battery is a fixed voltage with its datasheet internal resistance in series. The datasheets give the resistance at 1 kHz, which Energizer's internal resistance bulletin says is usually lower than under a steady load, so a real battery sags at least this much.
  • The motors are a steady current: 1 A while running, 2 A as they start. Those are the currents the L298 datasheet gives its voltage drops at. A real motor's current depends on its load; check its datasheet for its stall current.
  • Each switch in a motor driver is a resistor that drops the datasheet's typical voltage at that current. The L298 uses bipolar transistors, whose drop does not grow in step with current the way a resistor's does, so its drop here is right at the stated current only.

The three circuits

1. Three batteries under the same load

  • Left: a 9 V battery, 1.812 ohm inside (Duracell MN1604 datasheet).
  • Middle: six AA cells, 9 V and 0.181 ohm each (Duracell MN1500 datasheet).
  • Right: two 18650 lithium-ion cells in series (2S), 7.2 V and at most 0.018 ohm each (Samsung INR18650-25R specification).
  • Each voltmeter reads its battery's own terminals while the motors draw 1 A.
VoltmeterSimulator reading
9 V battery at 1 A7.19 V
6 x AA at 1 A7.91 V
2S Li-ion at 1 A7.16 V

The 9 V battery loses 1.81 V of its 9 V, the AA pack 1.09 V, the 2S pack 0.04 V. At 1 A the 9 V battery is also far outside what it is rated for: the Energizer 522 datasheet's capacity chart covers 10 to 50 mA.

Try this

  • Double-click a current source, set it to 2 and press OK: that is the motors starting. Read the voltmeters again.

2. An L298 and a TB6612FNG on the same battery

  • Both run from six AA cells, with the motors drawing 1 A.
  • Left: the L298, a bipolar driver. Its datasheet gives a typical 1.35 V across the high-side switch and 1.2 V across the low-side switch at 1 A. The current goes through one of each.
  • Right: the TB6612FNG, a MOSFET driver. Its datasheet gives a typical 0.5 V across both switches together at 1 A.
  • Each voltmeter reads the voltage across the motors.
VoltmeterSimulator reading
Motors through the L2985.36 V
Motors through the TB6612FNG7.41 V

The same battery gives the motors 5.36 V through the L298 and 7.41 V through the TB6612FNG. That is what the motors get, not what the battery says. The TB6612FNG is rated for 15 V and 1.2 A average per channel, so check your motors fit.

3. Why the Arduino resets when the motors start

  • Left: one 9 V battery feeds both the Uno's VIN pin and the motors, which draw 2 A as they start.
  • Right: the Uno has its own 9 V battery, and the motors run from six AA cells. A wire joins the two grounds, which the driver's inputs need to read the Uno's pins.
  • The Uno's datasheet asks for 7 to 12 V at VIN, which feeds its 5 V regulator.
VoltmeterSimulator reading
Shared 9 V battery: VIN while the motors start5.38 V
Separate supplies: the Uno's VIN9.00 V
Separate supplies: the motor pack while the motors start6.83 V

With one shared battery, VIN falls to 5.38 V while the motors start, below the 7 V the Uno needs, so its 5 V rail can drop and the board can reset. With separate supplies, the Uno's battery is not loaded by the motors at all.

The code side: a robot car sketch

The robot car starter on the virtual Arduino Uno drives two DC motors through an L298N-style driver and stops, backs up and turns when an HC-SR04 sees something closer than 25 cm. Slide the distance and watch the motors change direction.

The playground models the code's logic: speed and direction. It does not model the battery or the driver, so its motors always turn. The circuits above are the power side.

Still not turning?

  • Describe your car and let Debug my circuit find the fault. The link fills in a robot car example to change to match yours.
  • Check the battery and the driver with a multimeter while the motors run: measure across the battery, then across one motor.
  • See the power supply circuits for how a regulated supply holds its voltage.

Where the figures come from

  • 9 V alkaline battery: Duracell MN1604 datasheet, nominal internal impedance 1,812 milliohm at 1 kHz. Energizer 522 datasheet: capacity chart from 10 to 50 mA.
  • AA alkaline cell: Duracell MN1500 datasheet, nominal internal impedance 181 milliohm at 1 kHz.
  • 18650 lithium-ion cell: Samsung INR18650-25R specification, initial internal impedance at most 18 milliohm (AC 1 kHz), nominal 3.6 V.
  • Internal resistance under load: Energizer technical bulletin, Battery Internal Resistance.
  • L298: ST datasheet, source and sink saturation voltages, typical, at 1 A and 2 A.
  • TB6612FNG: Toshiba datasheet, output saturation voltage (upper and lower), typical, at 1 A; 15 V and 1.2 A average limits.
  • Arduino Uno R3: Arduino datasheet A000066, VIN 7 to 12 V.
  • Every reading is the simulator's, from the circuits as shown.

Questions

Why do my robot car's motors not turn on a 9 V battery?
A 9 V battery has a high internal resistance: its datasheet gives about 1.8 ohm at 1 kHz, and the resistance under a steady load is usually higher. When the motors draw current, the battery's own voltage drops. Its capacity is also rated for small currents: the datasheet's capacity chart covers 10 to 50 mA.
How much voltage does an L298N lose?
The L298 datasheet gives a typical 1.35 V across the high-side switch and 1.2 V across the low-side switch at 1 A, so about 2.55 V in all, and about 3.7 V at 2 A. A motor on a 6 V pack gets well under 6 V.
Is a MOSFET driver better for small motors?
It loses less voltage. The TB6612FNG datasheet gives a typical 0.5 V across both switches at 1 A, against about 2.55 V for the L298. Check its limits for your motors: 15 V and 1.2 A average per channel.
Why does my Arduino reset when the motors start?
If the Arduino and the motors share one battery, the motors' starting current pulls the battery's voltage down. In the simulator, a 9 V battery at 2 A gives about 5.4 V, below the 7 V the Uno's datasheet asks for at VIN. Give the motors their own battery and connect the two grounds.
Are these circuits exact models of a battery and a motor driver?
No. Each battery is a fixed voltage with its datasheet internal resistance, each driver switch a resistor that drops the datasheet voltage at the stated current, and the motors a steady current. The readings are right at those currents and show the size of each loss. Measure your own build with a multimeter.
Does the Arduino playground show battery sag?
No. The playground runs your code and shows the motors' speed and direction. It does not model the battery or the driver, so the motors there always turn. Use the circuits on this page for the power side.