DRV8833/Past one DC motor/10. A bipolar stepper instead
Past one DC motor · 10 of 11

A bipolar stepper instead

A bipolar stepper is two coils with no common connection, which is exactly two H-bridges' worth of load. The same four pins drive it — what changes is the order, and what limits the current.

The same load, differently arranged

Two DC motors is two H-bridges driving two independent loads. A bipolar stepper is two H-bridges driving two coils of the same motor, in a fixed order. The board does not need a mode for this and does not have one; only the sequence your code writes is different.

Two channels, one bipolar stepper
full step
Sequence
Steps per cycle
4
Rotor moves
90° per step
Coils energised now
0
Both coils are energised at every step, which is where full stepping gets its holding torque. Both channels are also drawing current the whole time — on this board that current is set by VM and the winding, so match VM to the motor’s rated voltage rather than to the biggest supply on the bench.

Coil A goes to the Motor A terminal, coil B to Motor B. Find the pairs with a meter before you wire anything: two leads reading a few ohms to each other are one coil. Getting the pairing wrong produces a shaft that judders in place rather than turning. Swapping the two ends of one coil is harmless; it reverses the direction of rotation.

Full and half stepping

Full stepping energises both coils at every step: four states per cycle, and the holding torque of two coils at every one of them.

Half stepping inserts a state between each pair in which one coil is off. Twice the positions and a smoother movement, at the cost of noticeably less torque at the positions where only one coil is holding. That is a trade, not a fault.

Neither sequence is microstepping. Microstepping drives each coil to a series of fractions of full current, and the DRV8833 has no way to set those: its current regulation has a single fixed threshold, and on this board even that is switched off by the 0 Ω sense resistors.

VM is the current knob

This is the part that catches people arriving from an A4988 or a DRV8825, where a trimmer sets the current limit.

There is no trimmer here and no limit to set. With the sense resistors at 0 Ω, coil current at standstill is set by VM and the winding resistance, which means the supply voltage is a design decision made per motor. A 5 V stepper wants VM at 5 V. Run the same motor at 10.8 V and it takes more than twice the current, gets hot holding position, and may pass the 1.5 A per bridge the chip is rated to carry continuously.

The code

drv8833_stepper.ino

Full-step sequence, four states, one coil per channel. Coil A goes to the Motor A terminal and coil B to Motor B; if the shaft judders instead of turning, the two wires of one coil are swapped, or the pairs are split across the wrong terminals.

// DRV8833 wiring for this sketch (ESP32-S3).
//
//   GND  -> GND       common with the motor supply's ground
//   VM   -> the motor's rated voltage, within 2.7-10.8 V. See below.
//   SLP  -> GPIO 4    high to run; pulled low in the chip, so not optional
//   AIN1 -> GPIO 5    drives AOUT1, one end of coil A
//   AIN2 -> GPIO 6    drives AOUT2, the other end of coil A
//   BIN1 -> GPIO 7    drives BOUT1, one end of coil B
//   BIN2 -> GPIO 15   drives BOUT2, the other end of coil B
//
// 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 sense resistors on this board are 0 ohms, so nothing chops the coil
// current: VM and the winding resistance set it between them. A 5 V stepper
// wants VM at 5 V, not at 10.8.

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

// Full step: both coils energised at every step.
const int SEQ[4][4] = {
  {HIGH, LOW,  HIGH, LOW },
  {LOW,  HIGH, HIGH, LOW },
  {LOW,  HIGH, LOW,  HIGH},
  {HIGH, LOW,  LOW,  HIGH},
};

int step = 0;

void applyStep(int i) {
  digitalWrite(AIN1, SEQ[i][0]);
  digitalWrite(AIN2, SEQ[i][1]);
  digitalWrite(BIN1, SEQ[i][2]);
  digitalWrite(BIN2, SEQ[i][3]);
}

void setup() {
  pinMode(SLP, OUTPUT);
  pinMode(AIN1, OUTPUT); pinMode(AIN2, OUTPUT);
  pinMode(BIN1, OUTPUT); pinMode(BIN2, OUTPUT);
  applyStep(0);
  digitalWrite(SLP, HIGH);
  delay(1);            // up to 1 ms to wake
}

void loop() {
  applyStep(step);
  step = (step + 1) % 4;
  delay(5);            // slower than the motor can follow, then speed up
}

Find the pairs before you wire anything. Measure resistance between the four leads: the two that read a few ohms to each other are one coil, and the two that read open are on different coils.

When it does not work

The shaft judders and does not turn

Almost always the coil pairing. Measure resistance between the four leads before wiring: two leads that read a few ohms to each other are one coil, and a lead that reads open against another is on the other coil. A pair split across two terminals cannot produce a rotating field.

It turns but skips steps under load

Step too fast for the load and the rotor cannot keep up with the field, which sounds like a rattle and loses position silently. Ramp the step rate rather than starting at speed, and check the coil current is what you intended.

It runs hot even when it is not turning

That is normal for a stepper holding position, and this board makes it worse than it needs to be: with no current chopping, the coils sit at whatever VM and the winding resistance produce, all the time. If it is too hot, VM is too high for that motor. To let it go cold between moves, write both inputs of each channel low, or pull SLP low.

Where this goes next

The sense resistors are fitted at 0 Ω, so nothing is chopping the current. What is left is Ohm's law and an overcurrent trip that does not care about either.

Current, and what limits it

Edit this page — content/books/drv8833/a-bipolar-stepper.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