Ilia
Ilia Hardware, software and startups 24/7

How to Connect L298N Motor Driver to ESP32

How to Connect L298N Motor Driver to ESP32

L298N is a popular, low-cost motor driver board. Here is how you can connect L298N to ESP32 and drive a ROS2 (Kaia.ai-compatible) differential robot.

Wiring

Copy the wiring from these photographs.

TODO add schematic.

ESP32 to L298N Wiring ESP32 to L298N Wiring

ESP32 to L298N and N20 Motor Wiring ESP32 to L298N Wiring

L298N to N20 Motor Wiring L298N Wiring

Firmware

Use the default firmware with no changes.

Use the default config.yaml file with no changes.

Power supply

Make sure to power your L298N from a stable power supply.

For example, if your robot runs on batteries, powering your L298N directly from the battery can cause problems when the battery gets low on charge. Specifically, your robot’s motors may not be able to achieve their maximum RPM when the battery voltage is low.

To work around this problem, you may want to put a DC-DC converter between your battery and L298N to stabilize the motor power.

Bringup instructions

Follow video instructions to build and bring-up your robot.

Happy robot building!