DRV8871 motor driver

Adafruit's DRV8871 breakout: one H bridge for a 6.5 V to 45 V brushed motor, two inputs and no logic supply. Aliases: DRV8871, Adafruit 3190.

TI's DRV8871 makes its own logic supply from VM, so the board has four header pins and two screw terminals, and a 3.3 V or a 5 V board drives it.

Pins

Pin What it does
IN2, IN1 The two inputs. Each has a 100 kΩ pull-down.
VM The motor supply, 6.5 V to 45 V. The same net as the POWER + terminal.
GND Ground, the POWER - terminal. Join it to the board's ground.
OUT2, OUT1 The motor, the MOTOR terminal's 2 and 1.

The truth table

IN1 IN2 Motor
H L forward (OUT1 high)
L H reverse
L L coast (both outputs off)
H H brake (both outputs low)

For speed, put analogWrite on one input and hold the other low: the motor is driven and coasts in turn.

const int IN1 = 9, IN2 = 10;

void setup() {
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
}

void loop() {
  digitalWrite(IN2, LOW);
  analogWrite(IN1, 180);   // forward, about 70 percent
  delay(2000);
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, HIGH); // brake
  delay(1000);
}

While it runs

The face shows what the motor is being told: off, fwd, rev or brake.

What the model gets right

From TI's datasheet (SLVSCY9B):

The logic table, coast and brake both.

Input levels. A low is 0.5 V or less and a high 1.5 V or more, so any 3.3 V or 5 V board drives it. Between the two an input keeps its last state.

On-resistance. 307 mΩ high side and 258 mΩ low side, typical.

The supply. Off under 6.5 V (the undervoltage lockout) and over the 50 V absolute maximum.

Where the current comes from. With a battery on VM the bridge is part of the analog solve, so the motor's current comes out of the pack and it sags.

What it does not model

The current limit. The board's 30 kΩ R_ILIM sets a trip current of 64 kV / 30 kΩ, 2.13 A (rilim holds it and the face prints it), past which the chip chops the current. Here the motor gets whatever the resistances give it, and the 4.5 A overcurrent shutdown and thermal shutdown are not there either. 3.6 A is the chip's peak rating. The sleep after 1 ms of coast and the 50 µs to wake. Heat.

See it in action

DRV8871 motor driver runs a 12 V motor through the whole table from an Uno. Open it at /templates.