Motor driver, TB6612FNG
Two MOSFET H bridges for two motors. STBY must be high, and PWM low is a brake.
- 16 pins
- In 4 projects
- In 2 lessons
The Motor driver, TB6612FNG in brief
What it is, and where it sits on the bench.
The TB6612FNG is a dual H-bridge on a small breakout, the driver in the SparkFun Inventor’s Kit. Its bridges are MOSFETs with about 0.25 ohm a side, half a volt across a bridge at one amp where an L293D loses more than two, and its logic runs from 2.7 to 5.5 volts, so an ESP32 or Pico can drive it directly. Each channel takes a PWM pin and two direction pins, AIN1 and AIN2 for motor A, while VM takes a separate 2.5 to 13.5 volt motor supply with the grounds joined. Mokxi follows Toshiba’s truth table row for row, including the row people miss: PWM low is a short brake, not a coast, so analogWrite() alternates driving and braking. Every input has a 200 kilohm pull-down inside, so an unwired STBY holds the whole chip in standby, the commonest reason a real board does nothing. With a battery on VM the bridge joins the analog solve and the pack sags under the motors. The SparkFun_TB6612 library’s drive() and brake() calls compile. The current limits, thermal shutdown and flyback diodes are not modeled.
- Family
- Outputs
- Pins
- 16
16 pins
Named as the editor names them, so a wire lands where you expect it.
analogWrite here.analogWrite here.How to use the TB6612FNG with an Arduino
The robot drive example wires channel A to pins 2 and 4 for direction and pin 5 for speed, channel B to pins 7, 8 and 6, and STBY to pin 9. VCC takes the Uno’s 5 volts, VM takes a four-AA pack, and the GND pins join both. With SparkFun_TB6612.h, a Motor takes AIN1, AIN2, PWMA, an offset of 1 or -1 and STBY, and drive() takes -255 to 255.
brake() shorts the motor and stops it hard, while standby() pulls STBY low and lets both motors coast. If nothing moves at all, check STBY first: left unwired, the chip’s own pull-down holds it in standby. Watch the pack’s readout as the motors start, since the bridge draws its current from VM.
Its logic runs from 2.7 to 5.5 volts, so an ESP32 or a Pico can drive the inputs directly with VCC on 3.3 volts.
#include <SparkFun_TB6612.h>
Motor leftMotor = Motor(2, 4, 5, 1, 9); // AIN1, AIN2, PWMA, offset, STBY
Motor rightMotor = Motor(7, 8, 6, 1, 9); // BIN1, BIN2, PWMB, offset, STBY
void setup() {}
void loop() {
forward(leftMotor, rightMotor, 255);
delay(1500);
brake(leftMotor, rightMotor);
delay(1000);
}What is true about the Motor driver, TB6612FNG, here
In its help article’s own words: what the simulation gets right, and where it stops.
Modeled
From Toshiba's datasheet:
The truth table, row for row, including the brake on PWM low.
Internal pull-downs. Every input has 200 k to ground inside, so an unwired
STBY reads LOW and the chip does nothing at all. That is the first fault on every
forum thread about this board.
The volts it keeps. 0.5 V at 1 A across the two transistors of a bridge, which is 0.25 ohm a side.
Where the current comes from. With a battery or a bench supply on VM, the
bridge is part of the analog solve, so the motors' current comes out of the motor
rail and a battery sags under it.
The supplies. Under 2.7 V of logic, under 2.5 V of motor supply or over the 15 V absolute maximum, the outputs are dead.
Not modeled
The 1.2 A average and 3.2 A peak current limits and the thermal shutdown behind them, the dead time, the 100 kHz PWM ceiling, and the flyback diodes.
From TB6612FNG motor driver, in full.
See the Motor driver, TB6612FNG in a project
4 built-in projects use it. Each opens in the editor, already wired.
Where it turns up in a lesson
2 lessons place it in their own circuits.
The boards it is shown on
This board has a built-in project with the Motor driver, TB6612FNG in it.
Arduino libraries for the Motor driver, TB6612FNG
Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.
The rest of the bench
Every one of these is drawn and simulated the same way.
Wire up the Motor driver, TB6612FNG
Open the editor and push it into the breadboard. It is free, and it runs on your own machine.