Architecture
The L298N is a dual full H-bridge that can drive two DC motors independently at up to 2A each. It accepts direction signals (IN1–IN4) and PWM enable signals (ENA/ENB) from the ESP32. We use LEDC (ESP32's hardware PWM) for smooth speed control instead of the Arduino analogWrite() alias.
Bluetooth Serial is handled by the built-in BluetoothSerial library — no extra hardware. Commands arrive as single characters: F=forward, B=backward, L=left, R=right, S=stop, 0-9=speed.
⚠️ Warning
The L298N's 5V regulator (if using the onboard one) can only supply ~50 mA. Power the ESP32 separately from a 5V UBEC or LiPo BEC — do NOT power it from the L298N's +5V pin when using motors over 1A.
Components
8 itemsNeed these parts? Get this build sheet by email
Parts list with buy links, plus new builds as they're published. By subscribing you agree to our Privacy Policy. Unsubscribe anytime.
Wiring
| L298N Pin | ESP32 GPIO |
|---|---|
| IN1 | 25 |
| IN2 | 26 |
| IN3 | 27 |
| IN4 | 14 |
| ENA | 32 (PWM) |
| ENB | 33 (PWM) |
| 12V | Battery+ |
| GND | Battery− & ESP32 GND |
ESP32 VIN → 5V UBEC output. UBEC input → Battery+/−.
Live simulation
Steps
- 1Assemble the car chassis and mount both TT motors per kit instructions
- 2Wire L298N to ESP32 following the table — double-check IN1-4 polarity
- 3Power ESP32 from the 5V UBEC, L298N motor supply from the 7.4V LiPo
- 4Upload the sketch and pair your phone with 'ESP32-RCCar' in Bluetooth settings
- 5Open 'Serial Bluetooth Terminal' app, connect to ESP32-RCCar
- 6Send 'F' to move forward, 'S' to stop — adjust speed with '5' or '8'
- 7If one motor spins the wrong direction, swap its IN1/IN2 wires
