TB6612FNG Motor Driver Arduino Tutorial

Introduction

The TB6612FNG motor driver module is a dual motor driver that can control two DC motors simultaneously. It has a peak current capacity of 3.2 amperes and continuous current capacity of 1.2 ampere, with an operating voltage of 15 volts.

Hardware Requirements

  • TB6612FNG motor driver module
  • Breadboard
  • Jumper wires
  • Power source (5V and 8V)
  • Indicator LED
  • 220 ohm resistor
  • 2 DC motors

Circuit Connection

  1. Place the motor driver module on the breadboard.
  2. Connect the power source (5V) to the breadboard's power rail.
  3. Connect the VM pin of the motor driver to the positive terminal of the 8V battery holder.
  4. Connect the negative terminal of the battery holder to the breadboard's negative terminal.
  5. Connect the VCC pin of the motor driver to the breadboard's positive terminal (5V power rail).
  6. Connect the ground pin of the motor driver to the breadboard's negative terminal.
  7. Make high the PWMA and PWMB pins of the motor driver by connecting them with the breadboard's positive terminal (5V power rail).
  8. Connect the SDBY pin of the motor driver to the 5V power rail of the breadboard to activate the driver.

Indicator LED Connection

  • Connect an indicator LED with the VM pin of the motor driver through a 220 ohm resistor.

Motor Connection

  1. Connect two DC motors to the motor terminals of the driver.
  2. Motor A on the right side and Motor B on the left side.

Signal Pins Connection

  • Connect two jumper wires with AIN1 and BIN1 pins of the driver.
  • AIN1 is for controlling Motor A and BIN1 is for controlling Motor B.

Power Supply

  1. Provide 5V power supply to the breadboard from a trainer board.
  2. Attach two lithium-ion batteries with a battery holder for 8V power supply.

Controlling Motors

  • Control the motors by providing high and low signals in the AIN1 and BIN1 pins of the driver.

Arduino Connection

  1. Connect all signal pins with Arduino to control motors using programs.
  2. Change the connection accordingly.

Arduino Code

// Define motor A and motor B control pins
const int motorAPin = AIN1;
const int motorBPin = BIN1;

void setup() {
  // Set up motor control pins as output
  pinMode(motorAPin, OUTPUT);
  pinMode(motorBPin, OUTPUT);
}

void rotateMotor(int motor, int speed) {
  // Speed value works as PWM speed value
  // Positive value indicates forward direction and negative value indicates backward direction
  if (speed > 0) {
    digitalWrite(motor, HIGH);
    analogWrite(motor, speed);
  } else {
    digitalWrite(motor, LOW);
    analogWrite(motor, -speed);
  }
}

void loop() {
  // Rotate both motors in forward with 255 speed for 3 seconds
  rotateMotor(motorAPin, 255);
  rotateMotor(motorBPin, 255);
  delay(3000);

  // Rotate both motors in forward with 100 speed for 3 seconds
  rotateMotor(motorAPin, 100);
  rotateMotor(motorBPin, 100);
  delay(3000);

  // Rotate both motors in backward with 255 speed for 3 seconds
  rotateMotor(motorAPin, -255);
  rotateMotor(motorBPin, -255);
  delay(3000);
}


TB6612FNG Overview
Part Number: TB6612FNG
Description: Brushed DC Motor Driver IC
Manufacturer: Toshiba
Background: The TB6612FNG is a popular brushed DC motor driver integrated circuit (IC) designed by Toshiba. It is widely used in robotics, drones, and other applications where compact and efficient motor control is required.
Key Features:
  • Compact DIP-8 package
  • Low power consumption
  • High output current (up to 1.2A)
  • Supports forward and reverse rotation
  • Internal shutdown circuitry for overcurrent protection
Applications:
  • Robotics
  • Drones
  • Automotive systems
  • Industrial automation
  • Consumer electronics


TB6612FNG Motor Driver Arduino Tutorial
The TB6612FNG is a popular motor driver IC used to control DC motors. It's widely used in robotics, automation, and other applications where precise motor control is required. In this tutorial, we'll explore how to use the TB6612FNG with an Arduino board.
Hardware Requirements
• TB6612FNG motor driver IC • Arduino Board (e.g., Uno, Mega, or Nano)
• DC Motor (e.g., 6V or 12V) • Jumper Wires
TB6612FNG Pinout and Description
Pin Name Description
VCC Power supply (5V or 6V)
GND Ground connection
A01/A02 Motor output pins for motor A
B01/B02 Motor output pins for motor B
PWM_A/PWM_B Pulse-width modulation (PWM) input pins for motors A and B
Connecting the TB6612FNG to Arduino
1. Connect VCC to Arduino's 5V pin. 2. Connect GND to Arduino's GND pin.
3. Connect PWM_A/PWM_B to Arduino's PWM pins (e.g., D9 and D10). 4. Connect A01/A02 and B01/B02 to the DC motor terminals.
Arduino Code Example
```c++ #include < Arduino.h> const int pwmAPin = 9; // PWM pin for motor A const int pwmBPin = 10; // PWM pin for motor B void setup() { pinMode(pwmAPin, OUTPUT); pinMode(pwmBPin, OUTPUT); } void loop() { analogWrite(pwmAPin, 255); // Set motor A speed to maximum (255) analogWrite(pwmBPin, 128); // Set motor B speed to half (128) delay(1000); analogWrite(pwmAPin, 0); // Stop motor A analogWrite(pwmBPin, 0); // Stop motor B delay(1000); } ```


Q1: What is TB6612FNG motor driver? The TB6612FNG is a dual H-bridge DC motor driver IC that can drive two DC motors with up to 1.3A of current.
Q2: What are the main features of TB6612FNG? The main features of TB6612FNG include high current capability, low power consumption, and built-in protection against overcurrent, overtemperature, and undervoltage.
Q3: How to connect TB6612FNG with Arduino? The TB6612FNG can be connected to an Arduino board using a breadboard or a PCB. The motor driver's VCC pin should be connected to the Arduino's 5V pin, and the GND pin should be connected to the Arduino's GND pin.
Q4: How to control TB6612FNG using Arduino? The TB6612FNG can be controlled using Arduino by sending PWM signals to the motor driver's IN1 and IN2 pins. The direction of rotation can be controlled by setting the IN1 and IN2 pins high or low.
Q5: What are the advantages of using TB6612FNG with Arduino? The advantages of using TB6612FNG with Arduino include ease of use, compact design, and high current capability. The motor driver is also relatively inexpensive.
Q6: Can I use TB6612FNG to drive stepper motors? No, the TB6612FNG is designed to drive DC motors only and cannot be used to drive stepper motors. Stepper motors require a different type of motor driver.
Q7: What are the limitations of using TB6612FNG with Arduino? The limitations of using TB6612FNG with Arduino include limited current capability (up to 1.3A), and limited speed control. The motor driver may also heat up during prolonged use.
Q8: Can I use multiple TB6612FNG with Arduino?
Q9: What are the common applications of TB6612FNG? The TB6612FNG is commonly used in robotics, automation, and motor control projects. It is also used in DIY projects such as robotic arms, rovers, and line followers.
Q10: Where can I find more information about TB6612FNG? More information about the TB6612FNG motor driver can be found in its datasheet, which is available on the manufacturer's website. Additional resources and tutorials are also available online.




Pioneer/Company Description
1. Adafruit A leading provider of DIY electronics, including motor drivers and Arduino-compatible products.
2. SparkFun Electronics A popular online retailer and manufacturer of electronic components, including motor drivers and Arduino shields.
3. Arduino LLC The company behind the Arduino platform, providing a range of microcontrollers and development tools.
4. Toshiba Corporation (TB6612FNG manufacturer) A Japanese multinational conglomerate that produces a wide range of electronic components, including the TB6612FNG motor driver IC.
5. Pololu Robotics and Electronics A company specializing in robotics and electronics products, including motor drivers and Arduino-compatible modules.
6. STMicroelectronics A leading manufacturer of microcontrollers and other semiconductor products, often used in conjunction with the TB6612FNG motor driver.
7. Seeed Technology A Chinese company providing a range of DIY electronics products, including motor drivers and Arduino-compatible modules.
8. DFRobot A Chinese robotics company offering a variety of electronic components, including motor drivers and Arduino shields.
9. RobotShop An online retailer specializing in robotics and electronics products, including motor drivers and Arduino-compatible modules.
10. Makerfabs A company providing a range of DIY electronics products, including motor drivers and Arduino-compatible modules.




Component Description Pins Arduino Connection
TB6612FNG Motor Driver IC Dual H-bridge motor driver with PWM control and current limiting VCC, GND, PWMA, PWMB, AIN1, AIN2, BIN1, BIN2 Connected to Arduino's digital pins (e.g. 2-9)
Motor A DC motor connected to output A of the TB6612FNG A01, A02 Connected to TB6612FNG's output A (AIN1, AIN2)
Motor B DC motor connected to output B of the TB6612FNG B01, B02 Connected to TB6612FNG's output B (BIN1, BIN2)
PWM Pins Pulse-width modulation pins for motor speed control PWMA, PWMB Connected to Arduino's PWM-capable digital pins (e.g. 3, 5, 6, 9, 10, 11)
AIN1 and AIN2 Input pins for motor A direction control AIN1, AIN2 Connected to Arduino's digital pins (e.g. 2, 4)
BIN1 and BIN2 Input pins for motor B direction control BIN1, BIN2 Connected to Arduino's digital pins (e.g. 7, 8)
VCC and GND Power supply pins for the TB6612FNG IC VCC, GND Connected to Arduino's power pins (5V, GND)
Arduino Pinout TB6612FNG Pinout Description
2 AIN1 Motor A direction control (high = forward, low = reverse)
4 AIN2 Motor A direction control (high = forward, low = reverse)
7 BIN1 Motor B direction control (high = forward, low = reverse)
8 BIN2 Motor B direction control (high = forward, low = reverse)
3 PWMA Motor A PWM speed control
5 PWMB Motor B PWM speed control
9 VCC Power supply for the TB6612FNG IC (5V)
GND GND Ground connection for the TB6612FNG IC
Arduino Code Example Description
const int motorAPin1 = 2; Define motor A direction control pin (AIN1)
const int motorAPin2 = 4; Define motor A direction control pin (AIN2)
const int motorBPin1 = 7; Define motor B direction control pin (BIN1)
const int motorBPin2 = 8; Define motor B direction control pin (BIN2)
const int pwmAPin = 3; Define motor A PWM speed control pin (PWMA)
const int pwmBPin = 5; Define motor B PWM speed control pin (PWMB)
void setup() Initialize the motor driver pins as outputs
void loop() Control the motors using PWM and direction control