Arduino Nano ESP32 - DRV8833 DC Motor Driver
In this guide, we will drive small DC motors from the Arduino Nano ESP32 through a DRV8833 motor driver module. The Nano ESP32 only gives 3.3V signals, and the DRV8833 accepts them as they are, so no level shifter is needed. In detail, we will learn:
- What the DRV8833 module does and what each of its pins means.
- How to wire one DC motor, then change its speed and direction from code.
- How to wire two DC motors and move them like the wheels of a robot car.

Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
※ NOTE THAT:
For Part 1 you only need one DC motor. The second motor is used in Part 2.
Overview of DRV8833 Motor Driver
A GPIO pin of the Arduino Nano ESP32 can give only a few milliamps, far too little to turn a motor. The DRV8833 from Texas Instruments sits in between: it holds two H-bridges, one for each motor, and switches the motor current from an external supply based on the signals it gets from the Nano ESP32. Because it uses MOSFET outputs, it loses much less voltage and runs cooler than the old L298N, which makes it a nice match for 3V to 9V battery robots. It can also drive one small bipolar stepper motor, but this guide covers DC motors only.

Main features:
| DRV8833 | |
|---|---|
| Motor supply (VCC pin) | 2.7V to 10.8V |
| Logic signals | 3.3V or 5V (no separate logic supply needed) |
| Output current | about 1.5A RMS per channel, 2A peak with good cooling |
| Channels | 2 (two DC motors), can be joined in parallel for about 3A on one motor |
| PWM frequency | up to 50kHz |
| Protection | under-voltage, over-current, over-temperature |
Pinout
Labels vary between makers. Some boards print IN1/IN2/OUT1, others print AIN1/AIN2/AOUT1, SLP or FLT. The job of each pin is the same:
- IN1, IN2 pins: control motor A. Connect to two PWM pins of the Arduino Nano ESP32.
- IN3, IN4 pins: control motor B. Connect to two more PWM pins.
- OUT1, OUT2 pins: connect to the two wires of motor A.
- OUT3, OUT4 pins: connect to the two wires of motor B.
- VCC pin: connect to the + of the motor power supply (2.7V to 10.8V).
- GND pin: connect to the - of the motor power supply AND to GND of the Arduino Nano ESP32.
- EEP pin (sleep): connect to 3.3V to turn the driver on. If this pin is LOW, the chip sleeps and the motors do not move.
- ULT pin (fault): goes LOW when the chip finds a problem (over-current, overheating, low voltage). It is optional, you can leave it unconnected.
How the DRV8833 Controls a Motor
Unlike the L298N, the DRV8833 has no ENA/ENB speed pin. Each motor is controlled only by its two inputs. The table shows what happens on motor A (motor B works the same with IN3 and IN4):
| IN1 | IN2 | Motor A |
|---|---|---|
| LOW | LOW | Coast (the motor is free and slows down by itself) |
| HIGH | LOW | Forward |
| LOW | HIGH | Reverse |
| HIGH | HIGH | Brake (the motor stops fast) |
To change speed, send a PWM signal to one input and keep the other LOW:
- Forward with speed: PWM on IN1, IN2 = LOW.
- Reverse with speed: IN1 = LOW, PWM on IN2.
That is why all four IN pins must go to PWM-capable pins. On the Arduino Nano ESP32, every digital pin can output PWM, so we use D10, D9, D6 and D5.
※ NOTE THAT:
Never power a motor from the 3.3V or 5V pin of the Arduino Nano ESP32. Use an external supply for the VCC pin of the DRV8833, and connect all GNDs together. Without a shared GND, the driver cannot read the control signals.
If you want to compare, the Arduino Nano ESP32 - DC Motor tutorial does the same job with the bigger L298N driver.
PART 1: Control One DC Motor with the DRV8833
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
| DRV8833 Module | Arduino Nano ESP32 / Others |
|---|---|
| IN1 | → D10 |
| IN2 | → D9 |
| EEP | → 3V3 |
| GND | → GND (and - of the 5V adapter) |
| VCC | → + of the 5V adapter (via DC power jack) |
| OUT1, OUT2 | → the two wires of the DC motor |
How To Program
- Set the two control pins as outputs.
- Run forward at a chosen speed (0 to 255).
- Run in reverse at a chosen speed.
- Brake quickly by setting both inputs HIGH, or coast by setting both LOW.
※ NOTE THAT:
On the Arduino Nano ESP32, once a pin is used with analogWrite(), it stays in PWM mode. So the code writes 0 for LOW and 255 for HIGH with analogWrite() instead of mixing in digitalWrite().
Arduino Nano ESP32 Code - One DC Motor
The sketch below speeds the motor up slowly, holds full speed, lets it coast, runs it backward, and then brakes. Each step is printed to the Serial Monitor.
Detailed Instructions
To get started with Arduino Nano ESP32, follow these steps:
- If you are new to Arduino Nano ESP32, refer to the tutorial on how to set up the environment for Arduino Nano ESP32 in the Arduino IDE.
- Wire the DRV8833, the motor and the 5V adapter as shown above. Double-check that EEP goes to 3V3.
- Connect the Arduino Nano ESP32 board to your computer using a USB cable.
- Launch the Arduino IDE on your computer.
- Select the Arduino Nano ESP32 board and its corresponding COM port.
- Copy the code above and paste it into the Arduino IDE. No extra library is needed.
- Click the Upload button to send the code to the Arduino Nano ESP32.
- Plug in the 5V adapter, then open the Serial Monitor.
- Watch the motor: it speeds up, runs fast, glides to a stop, turns the other way, then stops sharply.
※ NOTE THAT:
If "Forward" makes the motor spin the wrong way, just swap the two motor wires on OUT1 and OUT2. If the motor does not move at all, check the EEP pin first.
PART 2: Control Two DC Motors with the DRV8833
One DRV8833 has room for two motors, which is exactly what a two-wheel robot car needs. Motor A is the left wheel and motor B is the right wheel. To turn, one wheel goes forward while the other goes back.
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
| DRV8833 Module | Arduino Nano ESP32 / Others |
|---|---|
| IN1 | → D10 |
| IN2 | → D9 |
| IN3 | → D6 |
| IN4 | → D5 |
| EEP | → 3V3 |
| GND | → GND (and - of the 5V adapter) |
| VCC | → + of the 5V adapter (via DC power jack) |
| OUT1, OUT2 | → left motor (motor A) |
| OUT3, OUT4 | → right motor (motor B) |
Arduino Nano ESP32 Code - Two DC Motors
The code has a small helper for each motor: motorA(speed) and motorB(speed). The speed goes from -255 to 255. A positive number means forward, a negative number means reverse, and 0 lets the motor coast. With these two helpers, the car moves forward, backward, turns left, turns right and stops.
Detailed Instructions
- Add the second motor and the IN3/IN4 wires as shown in the diagram.
- Copy the code above and paste it into the Arduino IDE.
- Click the Upload button to send the code to the Arduino Nano ESP32.
- Lift the car (or hold the motors) so the wheels can spin freely, then plug in the 5V adapter.
- Open the Serial Monitor and compare the printed action with what the wheels do.
※ NOTE THAT:
If the car turns when it should go straight, one motor is wired backward. Swap the two wires of that motor on its OUT pins.