Arduino Nano ESP32 - Car
One of the coolest things to try if you're just starting with Arduino Nano ESP32 is making a robot car. In this guide, we'll learn how to use Arduino Nano ESP32 to build a robot car and control it with a IR remote control. For controlling the robot car via Web (Wifi), see Arduino Nano ESP32 controls Car via Web tutorial.

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 .
Overview of Robot Car
In the Arduino Nano ESP32 context, the robot car is often called by different names like robot car, RC car, remote control car, smart car, or DIY car. It can be controlled from a distance without any wires. You can use either a special remote control that uses infrared light or a smartphone app through Bluetooth or WiFi. The robot car can go left or right and also go forward or backward.
A 2WD (Two-Wheel Drive) car for Arduino Nano ESP32 is a small robotic vehicle that you can build and control using an Arduino Nano ESP32 board. It typically consists of the following components:
- Chassis: The base or frame of the car,where all other components are mounted.
- Wheels: The two wheels that provide locomotion to the car. They are attached to two DC motor.
- Motors: Two DC motors are used to drive the two wheels.
- Motor Driver: The motor driver board is an essential component that interfaces between the Arduino Nano ESP32 and the motors. It takes signals from the Arduino Nano ESP32 and provides the necessary power and control to the motors.
- Arduino Nano ESP32 Board: The brain of the car. It reads inputs from sensors and user commands and controls the motors accordingly.
- Power Source: The 2WD car requires a power source, usually batteries and a battery holder, to power the motors and the Arduino Nano ESP32 board.
- Wireless receiver: an infrared, Bluetooth or WiFi module for wireless communication with a remote control or smartphone.
- Optional Components: Depending on your project's complexity, you may add various optional components like sensors (e.g., ultrasonic sensors for obstacle avoidance, line-following sensors), and more.
In this tutorial, to make it simple, we will use:
- 2WD Car kit (including Chassis, wheels, motors, battery holder)
- L9110S Motor Driver
- IR infrared kit (including IR controller and IR receiver)
Check the hardware list at the top of this page.
How It Works

- Arduino Nano ESP32 connects to the DC motors of the robot car through L9110S motor driver module.
- Arduino Nano ESP32 connects to an IR receiver.
- The battery powers ESP32, DC motors, motor driver, and IR receiver.
- Users press the UP/DOWN/LEFT/RIGHT/OK keys on the IR remote controller.
- Arduino Nano ESP32 receives the UP/DOWN/LEFT/RIGHT/OK commands through the IR receiver.
- Arduino Nano ESP32 controls the car to move FORWARD/BACKWARD/LEFT/RIGHT/STOP by controlling the DC motor via the motor driver.
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
The L9110S module powers the motors directly from its VCC and GND pins and does not have an onboard 5V regulator. This means you can power everything from a single power source — four 1.5V AA batteries (totaling 6V). Here's how we can do it:
- Connect the 6V battery to the VCC and GND pins of the L9110S module to power the motors.
- Connect the same 6V battery to the Vin and GND pins of the Arduino Nano ESP32 board to power the Arduino Nano ESP32 (the IR receiver is powered from the Arduino Nano ESP32's 5V pin).
- Make sure the L9110S module, the Arduino Nano ESP32 board, and the IR receiver share a common GND.
Unlike the L298N, the L9110S has no ENA/ENB enable jumpers and no 12V screw terminal, so the wiring is simpler.
Arduino Nano ESP32 Code
Detailed Instructions
- If this is the first time you use Arduino Nano ESP32, see how to setup environment for Arduino Nano ESP32 on Arduino IDE.
- Install DIYables_IRcontroller library on Arduino IDE by following this instruction
- Do the wiring as the diagram shown above.
- Disconnect the wire from the Vin on the ESP32 because we will power Arduino Nano ESP32 via USB cable when uploading code.
- Flip the car upside down so that the wheels are on top.
- Connect the Arduino Nano ESP32 board to your PC via a USB cable
- Open Arduino IDE on your PC.
- Select the right Arduino Nano ESP32 board (e.g. Arduino Nano ESP32 and COM port.
- Copy the provided code and open it in the Arduino IDE.
- Click the Upload button in the Arduino IDE to transfer the code to the Arduino Nano ESP32.
- Use the IR remote controller to make the car go forward, backward, left, right, or stop.
- Check if the wheels move correctly according to your commands.
- If the wheels move the wrong way, swap the wires of the DC motor on the L9110S module.
- You can also see the results on the Serial Monitor in the Arduino IDE.
- If everything is going well, unplug the USB cable from the ESP32, and then connect the wire back into the Vin 5V pin. This will give power to the Arduino Nano ESP32 from the battery.
- Flip the car back to its normal position with the wheels on the ground.
- Have fun controlling the car!
Code Explanation
Read the line-by-line explanation in comment lines of code!
You can learn more about the code by checking the following tutorials:
- Arduino Nano ESP32 - DC motor tutorial
You can extend this project by:
- Adding obstacle avoidance sensors to immidilately stop the car if an obstacle is detected.
- Adding function to control the speed of car (see Arduino Nano ESP32 - DC motor tutorial). The provided code controls car with full speed.