Ordered on weekdays before 14:00 = shipped the same day and delivered the next day in 98% of cases. Free returns 30-day reflection period 1-year warranty

Wiring diagram and code example

How to connect the Motor driver module TB6612FNG for Arduino to an Arduino UNO or ESP32, with an example sketch you can upload straight away.

TB6612FNG Dual Motor Driver Control

This project controls a DC motor channel using the dual H-bridge TB6612FNG driver. The sketch enables the driver via the standby pin and alternates running the motor forward, stopping, and running in reverse with PWM speed control. Open the Serial Monitor at 115200 baud to observe the operating status.

Wiring diagram: Motor driver module TB6612FNG for Arduino on an Arduino UNO
Wiring diagram · Click to enlarge
Connection table: Motor driver module TB6612FNG for Arduino on an Arduino UNO
Connection table · Click to enlarge
TB6612FNG_Dual_Motor_Driver_Control.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : TB6612FNG Dual Motor Driver Control
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : TB6612FNG Motor Driver
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

const int PIN_PWMA = 5;
const int PIN_STBY = 6;
const int PIN_AIN1 = 7;
const int PIN_AIN2 = 8;

void setup() {
  Serial.begin(115200);

  pinMode(PIN_PWMA, OUTPUT);
  pinMode(PIN_STBY, OUTPUT);
  pinMode(PIN_AIN1, OUTPUT);
  pinMode(PIN_AIN2, OUTPUT);

  // Take driver out of standby mode
  digitalWrite(PIN_STBY, HIGH);

  Serial.println(F("TB6612FNG Motor Driver Initialized"));
}

void driveMotorA(bool forward, int speed) {
  speed = constrain(speed, 0, 255);

  if (forward) {
    digitalWrite(PIN_AIN1, HIGH);
    digitalWrite(PIN_AIN2, LOW);
    Serial.print(F("Motor Forward at speed: "));
  } else {
    digitalWrite(PIN_AIN1, LOW);
    digitalWrite(PIN_AIN2, HIGH);
    Serial.print(F("Motor Reverse at speed: "));
  }

  analogWrite(PIN_PWMA, speed);
  Serial.println(speed);
}

void stopMotorA() {
  analogWrite(PIN_PWMA, 0);
  digitalWrite(PIN_AIN1, LOW);
  digitalWrite(PIN_AIN2, LOW);
  Serial.println(F("Motor Stopped"));
}

void loop() {
  // Drive forward at speed 200
  driveMotorA(true, 200);
  delay(2000);

  // Stop
  stopMotorA();
  delay(1000);

  // Drive reverse at speed 200
  driveMotorA(false, 200);
  delay(2000);

  // Stop
  stopMotorA();
  delay(1000);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

TB6612FNG Motor Driver with ESP32

This project demonstrates controlling a DC motor using the TB6612FNG dual H-bridge motor driver and an ESP32. The sketch enables the driver via the STBY pin and cycles motor channel A through forward rotation, deceleration, reverse rotation, and braking. Open the Serial Monitor at 115200 baud to view the current motor state and speed.

Wiring diagram: Motor driver module TB6612FNG for Arduino on an ESP32 DevKit V1
Wiring diagram · Click to enlarge
Connection table: Motor driver module TB6612FNG for Arduino on an ESP32 DevKit V1
Connection table · Click to enlarge
TB6612FNG_Motor_Driver_with_ESP32.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : TB6612FNG Motor Driver with ESP32
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : TB6612FNG Motor Driver
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// TB6612FNG Dual H-Bridge Motor Driver Demo on ESP32

const int PIN_STBY = 13;
const int PIN_AIN1 = 12;
const int PIN_AIN2 = 14;
const int PIN_PWMA = 27;

void setup() {
  Serial.begin(115200);

  pinMode(PIN_STBY, OUTPUT);
  pinMode(PIN_AIN1, OUTPUT);
  pinMode(PIN_AIN2, OUTPUT);
  pinMode(PIN_PWMA, OUTPUT);

  // Enable driver
  digitalWrite(PIN_STBY, HIGH);
  Serial.println("TB6612FNG Motor Driver Initialized");
}

void driveMotor(bool forward, int speed) {
  if (forward) {
    digitalWrite(PIN_AIN1, HIGH);
    digitalWrite(PIN_AIN2, LOW);
  } else {
    digitalWrite(PIN_AIN1, LOW);
    digitalWrite(PIN_AIN2, HIGH);
  }
  analogWrite(PIN_PWMA, constrain(speed, 0, 255));
}

void stopMotor() {
  digitalWrite(PIN_AIN1, LOW);
  digitalWrite(PIN_AIN2, LOW);
  analogWrite(PIN_PWMA, 0);
}

void loop() {
  // Forward acceleration
  Serial.println("Motor Forward: Accelerating");
  for (int spd = 50; spd <= 255; spd += 25) {
    driveMotor(true, spd);
    delay(150);
  }
  delay(1000);

  // Stop
  Serial.println("Motor Stop");
  stopMotor();
  delay(1000);

  // Reverse acceleration
  Serial.println("Motor Reverse: Accelerating");
  for (int spd = 50; spd <= 255; spd += 25) {
    driveMotor(false, spd);
    delay(150);
  }
  delay(1000);

  // Stop
  Serial.println("Motor Stop");
  stopMotor();
  delay(2000);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Motor driver module TB6612FNG for Arduino

Features:
1. Standby control to save power.
2. CW / CCW / short brake / stop motor control modes.
3. Built-in thermal shutdown circuit and low-voltage detection circuit.

Description:
The TB6612FNG motor driver can drive up to two DC motors with a constant current of 1.2 A (3.2 A peak). Two input signals (IN1 and IN2) can be used to control the motor in one of four operating modes: clockwise, counterclockwise, short brake and stop. The two motor outputs (A and B) can be controlled separately, and the speed of each motor is controlled via a PWM input signal with a frequency up to 100 kHz. The STBY pin must be pulled high to take the motor out of standby mode.

The logic supply voltage (VCC) can be in the range of 2.7-5.5 VDC, while the motor supply voltage (VM) is limited to a maximum of 15 VDC. The output current is rated up to 1.2 A per channel (or up to 3.2 A for a short, single pulse).

The board is supplied with all components as shown including the header pins.

Specifications:
Supply voltage: VM = 15V max, VCC = 2.7-5.5V
Output current: Iout = 1.2 A (average) / 3.2 A (peak)

Dimensions
Length: 2cm
Width: 2cm
Height: 0.3cm

  • Four modes
  • Standby control
  • Thermal shutdown
  • Low-voltage detection

Why choose this product?

  • Two motors – Controls up to two DC motors.
  • Four operating modes – Clockwise, counterclockwise, short brake and stop.
  • PWM speed control – Controls motor speed via PWM input signal.
  • Saves power – Standby control helps save power.
  • Built-in protection – With thermal shutdown and undervoltage detection.
Specifications
Width2 cm
Length2 cm
Supply voltageVM = 15V max, VCC = 2,7-5,5V
Frequency100 kHz
Height0,3 cm
Output currentIout = 1,2 A / 3,2 A

In the package

  • TB6612FNG motor driver board
  • header pins

Frequently bought together

Total: € 16,30

Reviews

No reviews yet.

Write a review
Your rating

Shipping & returns

Shipping

  • Parcel with track & trace€ 7,70Within 24 hours
  • Pick up at PostNL location€ 7,40Within 24 hours
  • Letterbox parcel€ 3,70Within 2 business days
  • Letterbox parcel 24 hours€ 4,55Within 24 hours
  • Pick up in storeFree
All about shipping

Returns

Not satisfied? You have 30 days after delivery to return the product.

All about returns

Recently viewed