How to make aDIY 2WD WiFi-Controlled Car Using ESP32 and Blynk | Complete Guide

Hello and welcome back! In this project, we will learn how to make a 2WD WiFi-controlled car using an ESP32 board. To control this car, I used Blynk Cloud. Also, I used free widgets on the Blynk platform, so we don’t need any additional cost for this project. If you are a beginner with Blynk, please check out our basic tutorials first. I also designed a custom PCB chassis with JLCPCB for this project, so there’s no need for a separate chassis.
The car is powered by two Li-ion batteries, and for motor control, I used an L293D motor driver IC. Additionally, I included a simple 5V regulator circuit to provide a stable power supply for the motor driver. This project is perfect for school or university projects. You can also modify the code and hardware as you like. This is a great project for learning ESP32, motor control, and IoT applications.
- If you want to do this project with the Nodemcu ESP8266 board, please use this link.
OK, let’s do this project step by step. The required components are given below.
- ESP32 board x 1 — Our Store / Amazon
- L293D motor driver IC x 1 — Our store / Amazon
- IC base x 1 — Our store / Amazon
- LM7805 Voltage regulator x 1 — Our store / Amazon
- 100uf Capacitor x 2 — Our store / Amazon
- 5mm white LED x 2 — Our store / Amazon
- 100 ohm Resistor x 2 — Our store / Amazon
- 0.1uf Capacitor x 1 — Our store / Amazon
- 1N4007 Diode x 1 — Our store / Amazon
- Barrel jack socket x 1 — Our store / Amazon
- DIP slide switch x 1 — Our store / Amazon
- Two-pin terminal x 2 — Our store / Amazon
- Female header x 2 — Our store / Amazon
- Gear motor x 2 — Our store / Amazon
- 65mm Robot wheel x 2 — Our store / Amazon
- Cater wheel x 1 — Our store / Amazon
- Li-ion battery x 2 — Our store / Amazon
- Li-ion battery holder x 2 — Our store / Amazon
Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.
Step 1
Firstly, identify these components.


















Step 2
Secondly, let’s order PCBs for this project. For that, follow the instructions below.


- Click the “Instant Quote” button and upload the Gerber file, which you can download from the link below.
- Gerber file – Download
- For this project, I ordered five red PCBs. Next, select the build time and shipping method. Finally, click “Save to Cart” and complete the payment.





Step 3
Thirdly, once you receive the package, inspect your custom chassis PCBs to ensure everything is correct.




Step 4
Next, solder the components one by one onto the chassis PCB.






Step 5
Now, connect the ESP32 board and L293D motor driver IC to their respective places on the PCB. Please make sure to connect them on the correct side of the PCB.


Step 6
Afterward, connect the wheels to the gear motors. Then, install the motors on the bottom side of the chassis using double-sided tape.






Step 7
Now, install the caster wheel on the back side of the chassis. After that, put the motor wires through the holes and connect them to the terminals.






Step 8
Next, install the battery holder on the back side of the chassis and connect the power jack to the barrel port. Then, connect the ESP32 board to your computer.




Step 9
Now, let’s set up the Blynk Cloud for this project. For that, follow the instructions below.












- After that, click the gear icon on each widget one by one and select the Datastream for the widget. Then, click the save button.








- Next, click the Device tab and select the template we created earlier. Then, you will see the Blynk auth token.




Step 10
Now, copy and paste the following program to the Arduino IDE.
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// Define the motor pins using GPIO numbers
#define ENA 2
#define IN1 4
#define IN2 5
#define IN3 18
#define IN4 19
#define ENB 21
#define LED1 22
#define LED2 23
BlynkTimer timer;
bool forward = 0;
bool backward = 0;
bool left = 0;
bool right = 0;
bool lights = 0;
int Speed = 0;
//#define BLYNK_TEMPLATE_ID "TMPL6PWiB_DYZ"
//#define BLYNK_TEMPLATE_NAME "WIFI Control Car"
// Enter your Auth token
char auth[] = "**********************";
// Enter your WIFI SSID and password
char ssid[] = "*************";
char pass[] = "**************";
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
// Set motor pins as outputs
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(ENB, OUTPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
}
BLYNK_WRITE(V0) {
Speed = param.asInt();
}
BLYNK_WRITE(V1) {
forward = param.asInt();
}
BLYNK_WRITE(V2) {
backward = param.asInt();
}
BLYNK_WRITE(V3) {
left = param.asInt();
}
BLYNK_WRITE(V4) {
right = param.asInt();
}
BLYNK_WRITE(V5) {
lights = param.asInt();
if (lights == 1) {
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
} else {
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
}
}
void WIFIcar() {
if (forward == 1) {
carForward();
Serial.println("Car moving forward");
} else if (backward == 1) {
carBackward();
Serial.println("Car moving backward");
} else if (left == 1) {
carLeft();
Serial.println("Car turning left");
} else if (right == 1) {
carRight();
Serial.println("Car turning right");
} else {
carStop();
Serial.println("Car stopped");
}
}
void loop() {
Blynk.run(); // Run Blynk library
WIFIcar();
}
/************** Motor movement functions *****************/
void carForward() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void carBackward() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void carLeft() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void carRight() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void carStop() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
- After that, enter the Blynk auth token and WiFi details. You can use either your mobile hotspot or your WiFi name and password for the connection.


- Then, select the board and port. After, click the upload button.



Step 11
Now, let’s set up the Blynk mobile dashboard.
- First, download the Blynk app from the App Store or Play Store. Then, log in to your account, and you will see the template you created during the web setup.
- After that, click the Widget Configuration button and then tap the “+” icon to add widgets.

- Then, add one slider widget and five button widgets to the dashboard and customize them as you like.

- Now, click on each widget one by one and select the Datastream we created in the web dashboard. You can also customize the colors, size, and text as you like.
- Remember to change the light button to Switch mode.



Step 12
- Finally, remove the USB cable, insert the batteries into the battery holder, and power on your WiFi car. Now, you can test the car using either the mobile dashboard or the web dashboard.
- If the gear motors are not rotating in the correct direction, simply swap the motor wires.




Troubleshooting Tips
- Double check your WiFi name (SSID) and password in the code.
- Double check the Blynk auth token.
- Make sure your mobile hotspot or router is turned on.
- Select the correct board and port.
- Make sure the motor wires are connected to the correct terminals.
- Check the battery voltage.
How to make aDIY 2WD WiFi-Controlled Car Using ESP32 and Blynk | Complete Guide