The SparkFun Motor Driver TB6612FNG (v11) is a versatile and efficient dual H-bridge motor driver capable of controlling two DC motors independently or one bipolar stepper motor. Its compact form factor and ease of use make it an excellent choice for small robotics projects, educational purposes, and hobbyist applications.
Pin Number | Pin Name | Description |
---|---|---|
1 | VM | Motor voltage supply, connects to the motor power source |
2 | VCC | Logic voltage supply, connects to the control board (e.g., Arduino) |
3 | GND | Ground pin |
4 | A01 | Motor A output 1 |
5 | A02 | Motor A output 2 |
6 | B01 | Motor B output 1 |
7 | B02 | Motor B output 2 |
8 | PWMA | PWM input for motor A speed control |
9 | AIN1 | Direction control for motor A |
10 | AIN2 | Direction control for motor A |
11 | STBY | Standby pin (active low) |
12 | BIN1 | Direction control for motor B |
13 | BIN2 | Direction control for motor B |
14 | PWMB | PWM input for motor B speed control |
Power Connections:
Motor Connections:
Control Connections:
// Define the connections to the TB6612FNG
const int PWMA = 3; // PWM control for motor A
const int AIN1 = 4; // Direction control for motor A
const int AIN2 = 5; // Direction control for motor A
const int STBY = 6; // Standby
void setup() {
// Set all the motor control pins to outputs
pinMode(PWMA, OUTPUT);
pinMode(AIN1, OUTPUT);
pinMode(AIN2, OUTPUT);
pinMode(STBY, OUTPUT);
// Take the motor driver out of standby
digitalWrite(STBY, HIGH);
}
void loop() {
// Set motor A to spin in one direction
digitalWrite(AIN1, HIGH);
digitalWrite(AIN2, LOW);
analogWrite(PWMA, 128); // Set speed (0 to 255)
delay(1000); // Run for 1 second
// Set motor A to spin in the opposite direction
digitalWrite(AIN1, LOW);
digitalWrite(AIN2, HIGH);
analogWrite(PWMA, 128); // Set speed (0 to 255)
delay(1000); // Run for 1 second
// Stop the motor
digitalWrite(AIN1, LOW);
digitalWrite(AIN2, LOW);
analogWrite(PWMA, 0); // Set speed to zero (motor off)
delay(1000); // Wait for 1 second
}
This example demonstrates basic forward and reverse control of a motor connected to motor driver A. Adjust the analogWrite
value between 0 and 255 to control the speed of the motor.