Codey Online › Biblioteka komponentów Arduino i ESP32 › TB6612FNG Motor Driver
TB6612FNG Motor Driver
Aktuatory

TB6612FNG Motor Driver

TB6612FNG to podwójny sterownik silników z mostkiem H, który pozwala mikrokontrolerowi niezależnie sterować dwoma silnikami DC. Użyj PWMA/AIN1/AIN2 dla silnika A oraz PWMB/BIN1/BIN2 dla silnika B, a STBY działa jako pin enable/standby. Podaj zasilanie silników na VM (do wyjść silnikowych, takich jak AO1/AO2 i BO1/BO2) oraz zasilanie logiki na VCC, ze wspólną masą.

Szerokość: 21.7 mm

Pinout — TB6612FNG Motor Driver

Pin Sygnał Opis
PWMA PWM PWM speed-control input for motor channel A
STBY enable Standby enable input — drive high to enable the driver, low for standby
GND ground Common ground for logic, motor supply, and controller
VCC power Logic supply input for TB6612FNG control side, typically 3.3V or 5V
AIN1 digital Logic direction-control input 1 for motor channel A
AIN2 digital Logic direction-control input 2 for motor channel A
PWMB PWM PWM speed-control input for motor channel B
BIN1 digital Logic direction-control input 1 for motor channel B
BIN2 digital Logic direction-control input 2 for motor channel B
VM power Motor supply input for H-bridges — connect motor voltage, up to about 6V on this module
AO1 power Motor A output terminal 1 from the driver H-bridge
AO2 power Motor A output terminal 2 from the driver H-bridge
BO1 power Motor B output terminal 1 from the driver H-bridge
BO2 power Motor B output terminal 2 from the driver H-bridge
GND.1 ground Common ground connection, tied to the other GND pins
GND.2 ground Common ground connection, tied to the other GND pins

Przykładowy schemat połączeń — TB6612FNG Motor Driver

Z Do Przewód
board:5V x1:VCC red
board:GND x1:GND black
board:5V x1:VM red
board:GND.1 x1:GND.1 black
board:GND.2 x1:GND.2 black
board:D5 x1:PWMA green
board:D7 x1:AIN1 blue
board:D8 x1:AIN2 yellow
board:D6 x1:STBY purple
board:D9 x1:PWMB cyan
board:D10 x1:BIN1 magenta
board:D11 x1:BIN2 brown
x1:AO1 x1:AO2 pink
x1:BO1 x1:BO2 teal

Przykładowy kod Arduino — TB6612FNG Motor Driver

Ten przykład został napisany i sprawdzony kompilacją dla arduino-uno. Codey Online dostosuje go do każdej innej obsługiwanej płytki.

// TB6612FNG Motor Driver canonical example
// Drives one DC motor on channel A using PWM speed control and direction pins.

const int PWMA = 5;
const int AIN1 = 7;
const int AIN2 = 8;
const int STBY = 6;

void setup() {
  pinMode(PWMA, OUTPUT);
  pinMode(AIN1, OUTPUT);
  pinMode(AIN2, OUTPUT);
  pinMode(STBY, OUTPUT);

  Serial.begin(9600);
  while (!Serial) {
    ;
  }

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

  Serial.println("TB6612FNG motor driver demo");
}

void setMotorA(bool forward, int speedValue) {
  speedValue = constrain(speedValue, 0, 255);

  if (forward) {
    digitalWrite(AIN1, HIGH);
    digitalWrite(AIN2, LOW);
    Serial.print("Motor A forward, speed=");
  } else {
    digitalWrite(AIN1, LOW);
    digitalWrite(AIN2, HIGH);
    Serial.print("Motor A reverse, speed=");
  }

  analogWrite(PWMA, speedValue);
  Serial.println(speedValue);
}

void motorStop() {
  analogWrite(PWMA, 0);
  digitalWrite(AIN1, LOW);
  digitalWrite(AIN2, LOW);
  Serial.println("Motor A stop");
}

void loop() {
  setMotorA(true, 200);
  delay(2000);

  motorStop();
  delay(1000);

  setMotorA(false, 200);
  delay(2000);

  motorStop();
  delay(1000);
}

Podobne komponenty

A4988 Stepper Driver

A4988 Stepper Driver

BTS7960 Motor Driver

BTS7960 Motor Driver

DRV8825 Driver Board

DRV8825 Driver Board

L298N Motor Driver Board

L298N Motor Driver Board

Zbuduj swój projekt Arduino lub ESP32 z pomocą AI

Opisz, co chcesz zbudować. Codey Online napisze kod, narysuje schemat połączeń, skompiluje projekt i wgra go na płytkę bezpośrednio z przeglądarki.

Zacznij za darmo