Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use DFRobot Motor Driver: Examples, Pinouts, and Specs

Image of DFRobot Motor DriverDesign with DFRobot Motor Driver in Cirkit Designer

Introduction

The DFRobot Motor Driver, based on the TB6612FNG chip, is a compact and efficient motor driver module designed for controlling DC motors and stepper motors. It supports features such as speed control, direction control, and the ability to drive two motors simultaneously. This module is ideal for robotics, automation, and other motor control applications where precise and reliable operation is required.

Explore Projects Built with DFRobot Motor Driver

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino-Controlled Dual Motor Driver with IR Sensing: A project utilizing DFRobot Motor Driver in a practical application
Arduino-Controlled Dual Motor Driver with IR Sensing

This circuit controls two DC motors using a TB6612FNG motor driver, which is interfaced with an Arduino Mega 2560 microcontroller. The Arduino provides PWM signals to control the speed and direction of the motors. Multiple IR sensors are connected to the Arduino's analog inputs, likely for sensing the environment or for line-following capabilities in a robot.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The DFRobot Motor Driver (TB6612FNG) has the following key specifications:

Parameter Value
Operating Voltage 2.7V to 5.5V
Motor Drive Voltage 4.5V to 13.5V
Continuous Output Current 1.2A per channel (max)
Peak Output Current 3.2A per channel (short duration)
PWM Frequency Up to 100 kHz
Control Logic Voltage 2.7V to 5.5V
Number of Channels 2 (can drive 2 DC motors or 1 stepper motor)
Standby Current 1 µA (typical)
Dimensions 21mm x 18mm x 3mm

Pin Configuration and Descriptions

The TB6612FNG motor driver module has the following pinout:

Pin Name Type Description
VCC Power Input Logic voltage input (2.7V to 5.5V).
VM Power Input Motor power supply (4.5V to 13.5V).
GND Ground Ground connection.
AIN1 Input Input signal for Motor A direction control.
AIN2 Input Input signal for Motor A direction control.
PWMA Input (PWM) PWM signal input for Motor A speed control.
BIN1 Input Input signal for Motor B direction control.
BIN2 Input Input signal for Motor B direction control.
PWMB Input (PWM) PWM signal input for Motor B speed control.
STBY Input Standby control pin. Set HIGH to enable the driver, LOW to disable.
AO1 Output Motor A output terminal 1.
AO2 Output Motor A output terminal 2.
BO1 Output Motor B output terminal 1.
BO2 Output Motor B output terminal 2.

Usage Instructions

How to Use the Component in a Circuit

  1. Power Connections:

    • Connect the VCC pin to a 3.3V or 5V logic power supply.
    • Connect the VM pin to the motor power supply (4.5V to 13.5V).
    • Connect the GND pin to the ground of the power supply.
  2. Motor Connections:

    • Connect the motor terminals to AO1 and AO2 for Motor A, and BO1 and BO2 for Motor B.
  3. Control Connections:

    • Use the AIN1, AIN2, and PWMA pins to control Motor A.
    • Use the BIN1, BIN2, and PWMB pins to control Motor B.
    • Set the STBY pin HIGH to enable the driver.
  4. Direction and Speed Control:

    • Set the direction of the motor by configuring AIN1 and AIN2 (or BIN1 and BIN2).
    • Control the speed by providing a PWM signal to PWMA (or PWMB).

Important Considerations and Best Practices

Example Code for Arduino UNO

Below is an example of how to control two DC motors using the DFRobot Motor Driver with an Arduino UNO:

// Define motor control pins
#define AIN1 7  // Motor A direction control pin 1
#define AIN2 8  // Motor A direction control pin 2
#define PWMA 9  // Motor A speed control (PWM) pin
#define BIN1 10 // Motor B direction control pin 1
#define BIN2 11 // Motor B direction control pin 2
#define PWMB 3  // Motor B speed control (PWM) pin
#define STBY 12 // Standby control pin

void setup() {
  // Set motor control pins as outputs
  pinMode(AIN1, OUTPUT);
  pinMode(AIN2, OUTPUT);
  pinMode(PWMA, OUTPUT);
  pinMode(BIN1, OUTPUT);
  pinMode(BIN2, OUTPUT);
  pinMode(PWMB, OUTPUT);
  pinMode(STBY, OUTPUT);

  // Enable the motor driver
  digitalWrite(STBY, HIGH);
}

void loop() {
  // Motor A: Forward at 50% speed
  digitalWrite(AIN1, HIGH);
  digitalWrite(AIN2, LOW);
  analogWrite(PWMA, 128); // 50% duty cycle (0-255)

  // Motor B: Reverse at 75% speed
  digitalWrite(BIN1, LOW);
  digitalWrite(BIN2, HIGH);
  analogWrite(PWMB, 192); // 75% duty cycle (0-255)

  delay(2000); // Run motors for 2 seconds

  // Stop both motors
  analogWrite(PWMA, 0);
  analogWrite(PWMB, 0);

  delay(2000); // Wait for 2 seconds
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Motors Not Running:

    • Ensure the STBY pin is set HIGH to enable the driver.
    • Verify that the power supply connections (VCC, VM, and GND) are correct.
    • Check the PWM signal and ensure it is within the supported frequency range.
  2. Motor Running in the Wrong Direction:

    • Swap the AIN1 and AIN2 (or BIN1 and BIN2) signals to reverse the motor direction.
  3. Overheating:

    • Ensure the current drawn by the motors does not exceed 1.2A per channel.
    • Use heat sinks or improve ventilation if necessary.
  4. Noisy Operation:

    • Add decoupling capacitors near the motor terminals to reduce electrical noise.
    • Ensure proper grounding and minimize long wire runs.

FAQs

Q: Can I use this module to control a stepper motor?
A: Yes, the TB6612FNG can control a stepper motor by driving its two coils. You will need to generate the appropriate step sequences using the control pins.

Q: What is the maximum PWM frequency supported?
A: The module supports PWM frequencies up to 100 kHz.

Q: Can I use a 12V power supply for both VM and VCC?
A: No, VCC should be between 2.7V and 5.5V. Use a voltage regulator if your logic circuit requires 5V or 3.3V.