Every robot car needs a simple, speedy way to get commands from the remote to its microcontroller, and ESP-NOW fits the bill perfectly. It works a bit like a private walkie-talkie channel for microcontrollers. Instead of routing through a Wi-Fi hub, the remote and the car exchange messages face-to-face. That eliminates the lengthy connection handshake of regular Wi-Fi and cuts out needless overhead.
The result is low latency—almost no noticeable timeout between pressing the button and watching the wheels turn. That split-second improvement is what makes the robot car feel like an extension of your hand, not a distant toy lagging a token mace like old IR remotes do. Bonus—the tech is power-efficient, too, which keeps the weight and space requirements modest—key when you’re trying to keep a 3- to 4-inch chassis tidy.
By skipping the heavier stack of a classic router and using direct, peer-to-peer messages, ESP-NOW takes the hassle out of remote control, speed and silence are the secret ingredients that the robot car craves to drive smoothly and crisply respond to your every steer and throttle jab. Below is a tutorial on how to setup the basics then the rest is up to you.
Watch This
This tutorial will guide you step-by-step on how to set up two ESP32 microcontrollers and program them to communicate with each other. The guide covers everything from installation of necessary software to writing and uploading code for wireless communication.
Materials Required:
Two ESP32 microcontroller boards
Breadboard and jumper wires
USB cables to connect each ESP32 to your computer
Computer with Arduino IDE installed (or PlatformIO for more advanced users)
Optional sensors or peripherals (for adding functionality)
Pinout of the ESP32 (ESP32-WROOM-32D)
You may have a different ESP so PLEASE CHECK
Choose one esp32 as your transmitter and the other as your receiver, here are the diagrams for wiring and the physical pictures. Esp32 types can vary but the same pins are used.
Transmitter:
Push Button: Connect one terminal to Pin 4 and the other to Ground.
Potentiometer: Connect the power pin to 3.3V, the ground pin to Ground, and the signal (orange wire) to Pin 34.
(Note: You can modify the pins for the button and potentiometer in the code if needed.)
Receiver:
LED: Connect the positive lead to Pin 2 and the negative lead to Ground.
Servo: Connect the power pin to 3.3V, the ground pin to Ground, and the signal (orange wire) to Pin 13.
If you're new to using the ESP32 with the Arduino IDE,
then you’ll need to download esp32 by Espressif
from your board manager, install it.
The transmitter requires the mac address of the receiver esp32 in order to transmit data to it. To obtain the receiver's mac address, copy this code into the arduino ide and run it on the receiver esp32 to get its mac address.
You should get an output similar to this on the serial monitor (you may need to restart the esp32 to get the output):
#include <WiFi.h>
#include <esp_wifi.h>
void readMacAddress(){
uint8_t baseMac[6];
esp_err_t ret = esp_wifi_get_mac(WIFI_IF_STA, baseMac);
if (ret == ESP_OK) {
Serial.printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
baseMac[0], baseMac[1], baseMac[2],
baseMac[3], baseMac[4], baseMac[5]);
} else {
Serial.println("Failed to read MAC address");
}
}
void setup(){
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.STA.begin();
Serial.print("[DEFAULT] ESP32 Board MAC Address: ");
readMacAddress();
}
void loop(){
}
Replace the question marks (??) with your corresponding Mac Address value. You don't need to worry about the rest of the code unless you want to change the pins. Copy and Paste the code and upload it to the transmitter esp32.
Download the Transmitter code from HERE.
You should see data being sent on the serial monitor, it includes the potentiometer, button, and servo degree values:
In order to run the servo you need to download the
ESP32 Servo Library, you can find it directly in the
library manager. Install it.
Now, download the code from here. For the receiver. You can change the pins for the servo or led if you need to.
Power both your esp32’s, you should be seeing data coming in from the receiver on the serial monitor:
Turning the potentiometer should move the servo and pressing the button should turn on the led: