Description
These small TB6612FBG Dual Motor Driver Modules are capable of powering two DC 4.5-13.5V motors at 1.2A continuous current per channel (3.2A peak) while controlling speed and direction.
PACKAGE INCLUDES:
- TB6612FNG Motor Driver Module
- 2 x 8-pin male headers
KEY FEATURES OF TB6612FBG DUAL MOTOR DRIVER MODULE:
- Drive 2 DC motors with speed and direction control
- Drive 1 bipolar stepper motor
- Capable of 1.2A continuous or 3.2A peak per channel
- Efficient MOSFET H-Bridge technology for high efficiency
- 3.3 & 5V compatible
The logic circuitry operates over a range of 2.7 – 5.5V so it is both 3.3V and 5V compatible.
The module can also be used to control a single bipolar stepper motor. Since the module does not provide built-in current limiting, it is best used as a DC motor controller.
These work well when you want a drive solution for smaller motors that doesn’t require using a full shield. Being constructed of MOSFET H-bridge technology, they are more efficient and dissipate less heat than older style technology such as the L298.
The two H-bridges can be run in parallel to double the current handling capability if using with a single DC motor.
The drivers are rated for up to 1.2A. If the motors are on the smaller side such as is used on our Smart Car Chassis, two can be easily driven by each of the two drivers. This can be handy when using with a 4 wheel drive vehicle since you normally want both motors on the same side of the vehicle to be turning in unison anyway and that way one module can be used to drive all 4 wheels.
The module comes with 2 strips of male headers. These can be soldered on for use on a breadboard, or you can attach wires directly to the board depending on what your application requires. If soldering the headers on, it is recommended to insert the headers into a solderless breadboard first to hold them in alignment while soldering the pins.
The module has the pin-out labeling on the bottom side of the board. If desired, the headers can be soldered to the top side so that the labeling will be visible when the module is installed on a breadboard or just refer to our handy pic with the pins labeled.
Control Inputs
The STBY pin is the enable pin and is active HIGH to enable the motors to operate. The STBY pin is pulled LOW via a 200K pull-down resistor by default which disables the motors. To enable the motors to operate, this pin needs to be pulled HIGH. This can be done either by tying the pin to Vcc or by driving the pin HIGH using an output pin of a uC.
The PWMA/PWMB are PWM inputs for motor speed control. The PWMA input controls the speed of Motor A and PWMB controls the speed of Motor B. The higher the PWM value (up to 255) the faster the motor turns. At low PWM values, there is a point at which the DC motor does not receive enough drive power to cause the motor to turn. A motor may require a minimum PWM value of 25 or 50 to start turning. This is best determined experimentally.
The AIN1, AIN2, BIN1 and BIN2 are control pins that determine the configuration of the two H-Bridges in the device. The AIN1 / AIN2 pins control the ‘A’ motor bridge and the BIN1 / BIN2 pins control the ‘B’ motor bridge. The H-Bridge is what controls the direction that the motor turns as shown in the chart below. It can also be used for on/off control of desired.
AIN1 / (BIN1) | AIN2 / (BIN2) | |
Forward Direction | HIGH | LOW |
Reverse Direction | LOW | HIGH |
Brake / Stopped | LOW | LOW |
Brake / Stopped | HIGH | HIGH |
Note that the direction that the motors turn (forward vs reverse) with the above commands depends on how the ‘+’ and ‘-‘ leads of the motors are wired to the module. If they are turning backwards from what is expected, reverse the motor leads at the module.
Module Connections
1 x 8 Header (top to bottom left side)
- VM – Motor Voltage (4.5 – 13.5V)
- VCC – Logic voltage (2.7 – 5.5V)
- GND – Ground. There are 3 ground pins which are all tied together on the module.
- A1 – Motor A connection ‘+’
- A2 – Motor A connection ‘-‘
- B1 – Motor B connection ‘+’
- B2 – Motor B connection ‘-‘
- GND – Ground. There are 3 ground pins which are all tied together on the module.
1 x 8 Header (top to bottom right side)
- PWMA – PWM pin for Motor A for speed control
- AIN2 – IN2 digital input for Motor A – Connect to a digital output pin on the uC.
- AIN1 – IN1 digital input for Motor A – Connect to a digital output pin on the uC.
- STBY – Standby. Has pull-down resistor to ground to disable the driver. To enable, either tie to Vcc or use logic HIGH from output pin.
- BIN1 – IN1 digital input for Motor B – Connect to a digital output pin on the uC.
- BIN2 – IN2 digital input for Motor B – Connect to a digital output pin on the uC.
- PWMB – PWM pin for Motor B for speed control
- GND – Ground. There are 3 ground pins which are all tied together on the module.
OUR EVALUATION RESULTS:
These modules work well and are straightforward to use. The logic is easy enough that a library is not needed to implement the software to control them, but there are one or more libraries available should you want to make use of them.
The program below is a simple program to illustrate the control of DC motors. It moves the motors through a repeating sequence of running them both forward, then backwards, then in opposite directions. It then ramps the motor speed up and then back down in both forwards and reverse directions. It prints out what it is doing to the Serial Monitor window.
The AIN1,AIN2, BIN1, BIN2 digital pins can be connected to any digital pins that are available on the uC. The PWMA and PWMB pins must be connected to PWM pins as we will use them for speed control.
All of the low level motor control is done in a function called Motor. The Motor function takes the following inputs:
- mot = Motor to control. This can be ‘A’ for motor A or ‘B’ for motor B or ‘C’ to control both. Note that the single quotes are needed to denote that we are passing type char
- dir = Direction of motor. This can be ‘F’ for forward or ‘R’ for reverse. Again, but sure to use the single quotes.
- speed = Speed of motor. The value passed to the function is expressed in a range of 0-100%. That value is remapped to 0-255 for PWM control. The remapping ignores speed values that are too low to make the motors turn using the constant MIN_SPEED which in our example is set to 27, but 0 still means 0 to stop the motors. The optimum MIN_SPEED value for a particular setup will depend on the motors being used and the voltage at which they are being powered and is best determined experimentally.
TB6612FBG Dual Motor Driver Module Example Program
/* * TB6612FBG Dual Motor Driver Module Test * Code for exercising the TB6612FBG Motor Control module. * The low level motor control logic is kept in the function 'Motor' * Be sure to tie STBY pin HIGH to enable the device */ // AIN1-2 and BIN1-2 can be connected to any digital pins on uC // PWMA and PWMB must be connected to PWM pins. // Motor A int const PWMA = 10; // Must be PWM pin int const AIN1 = 9; int const AIN2 = 8; // Motor B int const PWMB = 5; // Must be PWM pin int const BIN1 = 7; int const BIN2 = 6; int const MIN_SPEED = 27; // Set to minimum PWM value that will make motors turn int const ACCEL_DELAY = 50; // delay between steps when ramping motor speed up or down. //=============================================================================== // Initialization //=============================================================================== void setup() { pinMode(PWMA, OUTPUT); // set all the motor control pins to outputs pinMode(PWMB, OUTPUT); pinMode(AIN1, OUTPUT); pinMode(AIN2, OUTPUT); pinMode(BIN1, OUTPUT); pinMode(BIN2, OUTPUT); Serial.begin(9600); // Set comm speed for serial monitor messages } //=============================================================================== // Main //=============================================================================== void loop() { // This will run both motors in both directions at a fixed speed // First go Forward at 75% power for 2 seconds Motor('C', 'F', 75); delay(2000); // now change motor directions to reverse and run at 75% speed Motor('C', 'R', 75); delay(2000); // now run motors in opposite directions at same time at 50% speed Motor('A', 'F', 50); Motor ('B', 'R', 50); delay(2000); // now turn off both motors Motor('C', 'F', 0); delay(2000); // Run the motors across the range of possible speeds in both directions // Maximum speed is determined by the motor itself and the operating voltage // Accelerate from zero to maximum speed for (int i = 0; i <= 100; i++) { Motor('C', 'F', i); delay(ACCEL_DELAY); } delay (2000); // Decelerate from maximum speed to zero for (int i = 100; i >= 0; --i) { Motor('C', 'F', i); delay(ACCEL_DELAY); } delay (2000); // Set direction to reverse and accelerate from zero to maximum speed for (int i = 0; i <= 100; i++) { Motor('C', 'R', i); delay(ACCEL_DELAY); } delay (2000); // Decelerate from maximum speed to zero for (int i = 100; i >= 0; --i) { Motor('C', 'R', i); delay(ACCEL_DELAY); } // Turn off motors Motor('C', 'F', 0); delay (2000); } /* * Motor function does all the heavy lifting of controlling the motors * mot = motor to control either 'A' or 'B'. 'C' controls both motors. * dir = Direction either 'F'orward or 'R'everse * speed = Speed. Takes in 1-100 percent and maps to 0-255 for PWM control. * Mapping ignores speed values that are too low to make the motor turn. * In this case, anything below 27, but 0 still means 0 to stop the motors. */ void Motor(char mot, char dir, int speed) { // remap the speed from range 0-100 to 0-255 int newspeed; if (speed == 0) newspeed = 0; // Don't remap zero, but remap everything else. else newspeed = map(speed, 1, 100, MIN_SPEED, 255); switch (mot) { case 'A': // Controlling Motor A if (dir == 'F') { digitalWrite(AIN1, HIGH); digitalWrite(AIN2, LOW); } else if (dir == 'R') { digitalWrite(AIN1, LOW); digitalWrite(AIN2, HIGH); } analogWrite(PWMA, newspeed); break; case 'B': // Controlling Motor B if (dir == 'F') { digitalWrite(BIN1, HIGH); digitalWrite(BIN2, LOW); } else if (dir == 'R') { digitalWrite(BIN1, LOW); digitalWrite(BIN2, HIGH); } analogWrite(PWMB, newspeed); break; case 'C': // Controlling Both Motors if (dir == 'F') { digitalWrite(AIN1, HIGH); digitalWrite(AIN2, LOW); digitalWrite(BIN1, HIGH); digitalWrite(BIN2, LOW); } else if (dir == 'R') { digitalWrite(AIN1, LOW); digitalWrite(AIN2, HIGH); digitalWrite(BIN1, LOW); digitalWrite(BIN2, HIGH); } analogWrite(PWMA, newspeed); analogWrite(PWMB, newspeed); break; } // Send what we are doing with the motors out to the Serial Monitor. Serial.print ("Motor: "); if (mot=='C') Serial.print ("Both"); else Serial.print (mot); Serial.print ("\t Direction: "); Serial.print (dir); Serial.print ("\t Speed: "); Serial.print (speed); Serial.print ("\t Mapped Speed: "); Serial.println (newspeed); }
Before they are shipped, these modules are:
- Inspected
- Sample tested per incoming shipment
- Repackaged in quality recloseable ESD bags for safe storage.
Notes:
- None
Technical Specifications
Operating Ratings | ||
Motor Voltage Range (VM) | 4.5 – 13.5VDC | |
Logic Voltage Range (VCC) | 2.7 – 5.5VDC | |
Max Current per Bridge – Continuous | 1.2A | |
Max Current per Bridge – Peak | 3.2A | |
Maximum PWM Frequency | 100kHz | |
Dimensions | ||
Driver Board (L x W x H) | 20 x 20mm (0.8 x 0.8″) | |
Datasheet | TB6612FBG |