Summary
Most beginner robot cars are controlled using buttons, switches, or Bluetooth modules. They are great for learning the basics, but I wanted to build something that felt a little closer to a real IoT project. That is what led me to build a WiFi-controlled car using an ESP32. Instead of controlling the robot with physical buttons, the ESP32 hosts a simple webpage that can be opened from a phone or laptop. Once connected, the robot can be driven wirelessly using on-screen controls. The project combines robotics, motor control, networking, and embedded programming into a single build, making it an excellent learning project for anyone exploring an esp32 car project.

How the Project Works
The idea behind the project is straightforward.
The ESP32 connects to a WiFi network and hosts a web server. When a user opens the webpage, they see movement controls for the robot.
When a button is pressed:
- The webpage sends a command to the ESP32.
- The ESP32 processes the command.
- The ESP32 updates the motor driver outputs.
- The motors move in the requested direction.
The communication happens almost instantly, which makes the robot feel very responsive.
Components Required
For this project, I used:
- ESP32 Development Board
- L298N Motor Driver Module
- Robot Chassis Kit
- Two DC Geared Motors
- Two Robot Wheels
- Castor Wheel
- 7.4V Battery Pack
- Battery Holder
- Jumper Wires
- Power Switch
Most of these parts are commonly used in beginner robotics projects and can easily be reused in future builds.
Building the Chassis
The first step is assembling the robot platform.
Mount the two DC geared motors onto the chassis using the mounting brackets provided with the robot kit.
Once the motors are secure:
- Attach the wheels to the motor shafts.
- Install the castor wheel at the front or rear of the chassis.
- Verify that all wheels rotate freely.
- Check that the robot sits level on a flat surface.
Next, mount the battery holder near the center of the chassis. This helps maintain balance and prevents the robot from leaning toward one side.
Leave enough space on the top plate to mount the ESP32 and motor driver later.
Installing the Motor Driver
The L298N motor driver acts as the bridge between the ESP32 and the motors.
Mount the motor driver on the chassis using screws or double-sided tape.
Connect the left motor wires to:
- OUT1
- OUT2
Connect the right motor wires to:
- OUT3
- OUT4
Do not worry if the motors rotate in the wrong direction during testing. This can easily be corrected later by swapping the motor wires.
Connecting the ESP32
The ESP32 cannot drive motors directly because the GPIO pins do not provide enough current.
Instead, the ESP32 sends control signals to the L298N.
Connect the motor driver inputs as follows:
- IN1 → GPIO 26
- IN2 → GPIO 27
- IN3 → GPIO 14
- IN4 → GPIO 12
These pins control motor direction.
For speed control, connect:
- ENA → GPIO 33
- ENB → GPIO 25
These PWM-enabled pins allow motor speed adjustment through software.
Next, connect the grounds:
- ESP32 GND → L298N GND
This shared ground connection is essential. Without it, the ESP32 and motor driver will not communicate reliably.
Power Connections
Connect the battery pack to the motor driver:
Battery Positive → 12V Input on L298N
Battery Negative → GND on L298N
Depending on the battery and motor driver configuration, the ESP32 can either be powered through USB during development or through a regulated 5V supply connected to the board.
Before switching the system on, inspect all wiring carefully.
Pay particular attention to:
- Battery polarity
- Ground connections
- Motor terminal connections
A few minutes spent checking wiring can prevent a lot of troubleshooting later.
Programming the ESP32
Open Arduino IDE and install the ESP32 Board Package if it is not already installed.
Navigate to:
- Tools → Board → ESP32 Dev Module
- Select the correct COM port.
The program for this project performs three tasks:
- Connects the ESP32 to WiFi.
- Creates a web server.
- Processes movement commands.
Inside the sketch, update the WiFi credentials:
const char* ssid = "YourWiFiName";
const char* password = "YourWiFiPassword";
- Upload the code to the ESP32.
- After uploading, open the Serial Monitor and set the baud rate to 115200.
- Within a few seconds, the ESP32 should display an IP address similar to:
- 192.168.1.105
- Write down this address because it will be used to access the control interface.
Creating the Control Interface
The ESP32 hosts a simple webpage that can be opened from any device connected to the same WiFi network.
Open a browser on a smartphone or laptop.
Enter the IP address displayed in the Serial Monitor.
The control page should contain buttons for:
- Forward
- Backward
- Left
- Right
- Stop
- Each button sends a request to the ESP32.
When the ESP32 receives the request, it updates the motor driver outputs accordingly.
For example:
Forward activates both motors in the forward direction.
Backward reverses both motors.
Left slows or reverses one side to turn the robot.
Right performs the opposite action.
Stop disables all motor outputs.
This simple interface eliminates the need for a dedicated mobile application.
Testing the Robot
Before placing the robot on the floor, perform an initial motor test.
Lift the chassis slightly so the wheels can rotate freely.
Open the control webpage and test each movement command individually.
Start with Forward.
Both wheels should rotate in a way that would move the robot straight ahead.
Next test:
Backward
Left
Right
Stop
If the robot moves backward when Forward is pressed:
- Reverse the motor wires for both motors.
If the robot spins instead of moving straight:
- Reverse the wiring for one motor.
Continue testing until all movement directions behave correctly.
Only then should the robot be placed on the floor for driving tests.
- First Drive
- Place the robot on a smooth surface and reconnect to the control webpage.
- Drive the robot slowly at first.
Pay attention to:
- Turning response
- Motor synchronization
- WiFi responsiveness
- Battery performance
During my first test, one motor was slightly faster than the other, which caused the robot to drift to one side.
Small speed adjustments in the PWM values helped improve straight-line movement.
This is a normal part of the tuning process and something almost every robot requires.
Common Problems
The webpage does not load
Check:
- ESP32 is connected to WiFi.
- Correct IP address is being used.
- Phone and ESP32 are on the same network.
- Motors do not move
Verify:
- Battery is charged.
- L298N power LED is on.
- Motor wires are connected correctly.
- Common ground exists between ESP32 and L298N.
- Robot moves in the wrong direction
- Swap the motor wires connected to the affected motor.
- This is usually the quickest fix.
- Robot disconnects frequently
Check:
- Battery voltage.
- WiFi signal strength.
- Loose jumper wire connections.
- Upgrades to Try Next
Once the basic WiFi-controlled car is working, there are several ways to expand the project.
Some upgrades that work particularly well include:
- Ultrasonic Sensor Modules for obstacle avoidance
- ESP32 Camera Modules for video streaming
- Line-following sensors
- Bluetooth control mode
- Cloud-based IoT dashboards
- Voice-controlled navigation
The nice thing about using an ESP32 is that the same board can support all of these upgrades without major hardware changes.
Final Thoughts
This WiFi-controlled car was one of those projects that felt much more advanced than it actually was. The hardware itself is relatively simple, but the addition of wireless control makes the robot feel far more interactive and practical.
More importantly, the project introduces several concepts that appear repeatedly in robotics and IoT development, including motor control, networking, web servers, and real-time communication. For anyone looking for an engaging esp32 car project, this build offers a great balance between learning, experimentation, and hands-on fun.






