Projects / RC car with an ESP-NOW handheld remote

RC car with an ESP-NOW handheld remote

Intermediate3 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. ESP3259°

    Build the chassis

    Mount motors, wheels and the servo.

  2. ESP32ROBOT

    Find the car's address

    Print it with WiFi.macAddress().

  3. ESP32LM2596

    Set the 5 V rail

    Adjust the LM2596 with a multimeter.

  4. ESP32ROBOT

    Test the motor driver

    Run the car with the wheels lifted.

  5. ESP32

    Write the remote

    Send x and y values.

  6. ESP32

    Add the fail-safe

    Stop after 300 ms with no data.

  7. ESP32

    Test the range

    Outdoors, in a clear area.

In short

How do you build an RC car with an ESP-NOW handheld remote?

Two ESP32s talk over ESP-NOW: a handheld with a joystick and a car with a motor driver and a steering servo. You need ESP32 DevKit V1 × 2, Joystick module (dual axis), DRV8833 dual motor driver, SG90 Micro Servo, TT gear motor 3 to 6 V, Robot car chassis kit 2WD (acrylic), Battery holder 18650 2S (series), 18650 cell 2600 mAh (branded) × 2 and LM2596 Buck Module. It takes 7 steps and about 180 minutes.

Level
Intermediate
Time
About 180 min
Parts
9

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
REMOTE: joystick XESP32 GPIO34Steering input
Joystick YESP32 GPIO35Throttle input
Joystick VCC and GNDESP32 3V3 and GNDPower
Remote ESP32USB power bankPower
CAR: 2S 18650 pack plusLM2596 IN+ and DRV8833 VMBattery (7.4 V, check the driver's limit of 10.8 V)
LM2596 OUT+ and OUT−Car ESP32 VIN and servo power, GND5 V rail (set with a multimeter first)
DRV8833 AIN1 and AIN2Car ESP32 GPIO26 and GPIO27Motor direction and PWM
DRV8833 AOUT1 and AOUT2TT motorDrive
DRV8833 SLP3V3Awake
Servo signalCar ESP32 GPIO18Steering
All groundsJoinedCommon ground

Code

ESP-NOW sends small packets directly between ESP32s with no router, with very low delay. The remote reads the joystick and sends two numbers 50 times a second; the car drives the motor from the throttle and the steering servo from the other axis. If the car hears nothing for 300 ms it stops and centres the steering, so a dropped link or a dead remote battery does not make it run away. First tests should be with the wheels off the ground. Set the LM2596 to 5 V with a multimeter before connecting the ESP32 and servo. The TT motors are rated for a lower voltage than the 7.4 V pack, so the code limits the power to about 70 percent. Use only protected 18650 cells, keep them secure and out of crash zones, and do not run a car near people, roads or pets. Print the car's address with the sketch and enter it as the remote's target. The link is not encrypted, so anyone nearby could in principle send commands; fine for a toy, not for anything that matters. Arduino IDE with the ESP32 boards package 2.0.x, board "ESP32 Dev Module".

Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// ESP-NOW RC car. Board package: ESP32 2.0.x (the receive callback signature differs in 3.x). No extra libraries for the car.
// REMOTE (ESP32 #1): replace CAR_MAC with the car's address. Print it with WiFi.macAddress() on the car first.
#include <WiFi.h>
#include <esp_now.h>
uint8_t CAR_MAC[] = {0x24, 0x6F, 0x28, 0x00, 0x00, 0x00};     // placeholder: use your car's address

typedef struct { int16_t x; int16_t y; } Cmd;
Cmd cmd;

void setup() {
  WiFi.mode(WIFI_STA);
  esp_now_init();
  esp_now_peer_info_t peer = {}; memcpy(peer.peer_addr, CAR_MAC, 6); peer.channel = 0; peer.encrypt = false;
  esp_now_add_peer(&peer);
}

void loop() {
  cmd.x = map(analogRead(34), 0, 4095, -100, 100);            // steering
  cmd.y = map(analogRead(35), 0, 4095, -100, 100);            // throttle
  if (abs(cmd.x) < 8) cmd.x = 0; if (abs(cmd.y) < 8) cmd.y = 0;   // dead zone around the centre
  esp_now_send(CAR_MAC, (uint8_t*)&cmd, sizeof(cmd));
  delay(20);                                                  // 50 times a second
}

/* ---- CAR (ESP32 #2). Library: ESP32Servo.
#include <WiFi.h>
#include <esp_now.h>
#include <ESP32Servo.h>
typedef struct { int16_t x; int16_t y; } Cmd;
volatile Cmd got; volatile unsigned long lastRx = 0;
Servo steer;
const int IN1 = 26, IN2 = 27;
const int MAX_PWM = 180;                      // limit to about 70 percent so the motor runs below its rating on 7.4 V

void onData(const uint8_t* mac, const uint8_t* data, int len) {
  if (len == sizeof(Cmd)) { memcpy((void*)&got, data, len); lastRx = millis(); }
}

void drive(int y) {                           // y from -100 to 100
  int pwm = map(abs(y), 0, 100, 0, MAX_PWM);
  if (y > 0) { analogWrite(IN1, pwm); analogWrite(IN2, 0); }
  else if (y < 0) { analogWrite(IN1, 0); analogWrite(IN2, pwm); }
  else { analogWrite(IN1, 0); analogWrite(IN2, 0); }
}

void setup() {
  WiFi.mode(WIFI_STA);
  Serial.begin(115200); Serial.println(WiFi.macAddress());   // copy this into CAR_MAC on the remote
  pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT);
  steer.attach(18);
  esp_now_init();
  esp_now_register_recv_cb(onData);
}

void loop() {
  if (millis() - lastRx > 300) { drive(0); steer.write(90); }   // fail safe: stop if no data for 300 ms
  else { drive(got.y); steer.write(map(got.x, -100, 100, 60, 120)); }
  delay(10);
}
*/

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Joystick forwardCar drives forward
Joystick sidewaysWheels steer
Switch the remote offCar stops within a third of a second
Walk awayRange of 30 m or more in the open

If it does not work

Nothing happens

Check the car address in the remote.

Car runs on its own

Check the dead zone and fail-safe.

Servo twitches

Use a separate 5 V supply and a common ground.

Motor stalls

Raise the PWM limit slightly and check the battery.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the RC car with an ESP-NOW handheld remote?

ESP32 DevKit V1 × 2, Joystick module (dual axis), DRV8833 dual motor driver, SG90 Micro Servo, TT gear motor 3 to 6 V, Robot car chassis kit 2WD (acrylic), Battery holder 18650 2S (series), 18650 cell 2600 mAh (branded) × 2 and LM2596 Buck Module.

How long does the RC car with an ESP-NOW handheld remote take to build?

About 180 minutes for a intermediate maker, in 7 steps.

How do I know the RC car with an ESP-NOW handheld remote works?

Joystick forward: Car drives forward. Joystick sideways: Wheels steer. Switch the remote off: Car stops within a third of a second.

Nothing happens: what should I check?

Check the car address in the remote.

Car runs on its own: what should I check?

Check the dead zone and fail-safe.

Servo twitches: what should I check?

Use a separate 5 V supply and a common ground.

Motor stalls: what should I check?

Raise the PWM limit slightly and check the battery.