DRV8833/Wiring it up/06. Wire it to your board
Wiring it up · 06 of 11

Wire it to your board

Eight pins on the control header. Six of them carry signals, five need a GPIO for two motors and three for one, and the pin that catches everybody is not one of the four in the diagrams.

Eight pins, in order

With the component side up and the header at the bottom, the header runs GND, VM, SLP, FLT, AIN1, AIN2, BIN1, BIN2 from left to right. Pin 1, GND, is the square pad, under Motor A. From the back the order is reversed, and the pads there are unnamed.

Eight pins, five of them wired
pin 3 — SLP
Pin
Pins that must be wired
4
GPIOs for two motors
5
GPIOs for one motor
3
SLP. Sleep, active low. High to run. Pulled low inside the chip, so it is not optional. Drive it high from a GPIO. To tie it to VM instead, go through a 20–75 kΩ resistor, never a bare wire.

The signal pins go straight to the chip. There is no resistor, pull-up or pull-down on any of them on the board; the only pulls are the chip's own, which hold SLP and the four inputs low when nothing drives them.

What you actually have to connect

For two DC motors: GND, SLP, AIN1, AIN2, BIN1, BIN2. That is five GPIO pins plus a ground, not the four the wiring diagrams tend to show.

For one motor, leave the other channel unwired. Its inputs are pulled low inside the chip, which is the coast state, and an unwired channel costs nothing.

FLT is optional in the sense that the motor turns without it, and worth wiring because when something goes wrong it is the only part of the board that says so. It needs INPUT_PULLUP, because no pull-up is fitted.

VM on the header is the same net as VM on the power terminal, brought out so the supply can arrive on either side of the board. Use one or the other.

Ground first

Wire GND before anything else and check it before anything else. Logic levels are voltages relative to a shared return; without one, the highs and lows your microcontroller sends are not the highs and lows the driver reads, and the failure looks like a driver that responds intermittently rather than one that is wired wrong.

The code

drv8833_pins.ino

One header for every sketch in this book, written for an ESP32-S3. The GPIO numbers are arbitrary — any free pin works — but these are clear of the S3's strapping pins, its octal PSRAM and its native USB, which is not true of every number you might reach for.

// DRV8833 wiring for every sketch in this handbook (ESP32-S3).
//
//   GND  -> GND       common with the motor supply's ground
//   VM   -> 2.7-10.8 V motor supply, here or at the power terminal.
//           There is no logic supply pin.
//   SLP  -> GPIO 4    high to run; pulled low in the chip, so not optional
//   FLT  -> GPIO 16   open drain, needs INPUT_PULLUP
//   AIN1 -> GPIO 5    channel A
//   AIN2 -> GPIO 6    channel A
//   BIN1 -> GPIO 7    channel B
//   BIN2 -> GPIO 15   channel B
//
// Any free GPIO will do. On an ESP32-S3 N16R8, avoid 0/3/45/46 (strapping),
// 33-37 (octal PSRAM) and 19/20 (native USB).
//
// Arduino IDE, Tools menu (esp32 core 3.x):
//   Board             ESP32S3 Dev Module
//   USB CDC On Boot   Enabled   (Disabled if your USB goes through a
//                               USB-serial chip)
//   Flash Size        16MB (128Mb)
//   PSRAM             OPI PSRAM
// No library needed.
//
// The motor inputs are only ever written with analogWrite: 0 for LOW,
// 255 for HIGH. On esp32 core 3.x, once analogWrite has taken a pin,
// digitalWrite on that pin is refused and does nothing. On an Uno,
// analogWrite(pin, 0) and (pin, 255) are plain LOW and HIGH.

const int SLP  = 4;
const int FLT  = 16;
const int AIN1 = 5;
const int AIN2 = 6;
const int BIN1 = 7;
const int BIN2 = 15;

void setup() {
  pinMode(SLP, OUTPUT);
  pinMode(FLT, INPUT_PULLUP);   // no pull-up is fitted on the board

  analogWrite(AIN1, 0);         // both channels coasting
  analogWrite(AIN2, 0);
  analogWrite(BIN1, 0);
  analogWrite(BIN2, 0);

  digitalWrite(SLP, HIGH);      // wake the driver
  delay(1);                     // up to 1 ms before the outputs respond
}

void loop() {}

SLP is in the list because it is not optional. Leaving it out is the single most common reason a correctly wired DRV8833 does nothing at all. The four motor inputs are started with analogWrite(pin, 0) rather than digitalWrite, for the reason in the comment.

When it does not work

Four pins are wired and nothing moves

The four-pin figure everybody quotes leaves out SLP. It has to be driven high from a GPIO, or tied to VM through a 20 to 75 kilohm resistor, and until it is, the driver is asleep and every other pin is ignored. The red LED being lit does not mean it is awake.

VM is connected at the header and at the power terminal

Pick one. They are the same net, so feeding both is not fatal, but it doubles the paths motor current can take and makes a loose screw terminal much harder to spot.

The fault pin reads randomly

FLT is open drain and this board fits no pull-up, so an un-pulled pin floats and reads as noise. Set INPUT_PULLUP on it, and read the article on what a real fault looks like before trusting what it reports.

Where this goes next

The pin in that list that is not like the others. An unwired SLP is not floating and occasionally lucky — it is low, every time, on every board.

Sleep is the default

Edit this page — content/books/drv8833/wire-it-to-your-board.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

DRV8833 Dual Motor Driver

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum