Kaito Adhitya
Published © GPL3+

IoT RC Car Controlled via Blynk and ESP32-S3 Uno

A smart RC car you can drive from your phone using the ESP32-S3 and Blynk IoT platform.

BeginnerFull instructions provided4 hours133
IoT RC Car Controlled via Blynk and ESP32-S3 Uno

Things used in this project

Hardware components

ESP32
Espressif ESP32
In this project I'm using ESP32 S3 Uno, but you can use any type of ESP32 that you have.
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
DC Motor, 12 V
DC Motor, 12 V
×2

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Schematics

Wiring

Wiring table

Code

Program

C/C++
Here I'm using 4 virtual buttons from Blynk. If you want to add more buttons or components, you can customize them yourself.
#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "your_template_id"
#define BLYNK_TEMPLATE_NAME "Your RC Project"
#define BLYNK_AUTH_TOKEN "your_auth_token"

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>

// === Wi-Fi and Blynk Credentials ===
char ssid[] = "your_wifi_name";
char pass[] = "your_wifi_password";
char auth[] = "your_auth_token";

// === Motor driver L298N connections ===
#define ENA 12    // Enable A (PWM)
#define ENB 13    // Enable B (PWM)
#define IN1 18
#define IN2 17
#define IN3 19
#define IN4 20

// === Motor speed variables (0–255) ===
int motorSpeedA = 200;
int motorSpeedB = 200;

// === Motor movement functions ===
void moveForward() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, motorSpeedA);
  analogWrite(ENB, motorSpeedB);
}

void moveBackward() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
  analogWrite(ENA, motorSpeedA);
  analogWrite(ENB, motorSpeedB);
}

void turnLeft() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, motorSpeedA / 2);  // reduce left motor speed
  analogWrite(ENB, motorSpeedB);
}

void turnRight() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
  analogWrite(ENA, motorSpeedA);
  analogWrite(ENB, motorSpeedB / 2);  // reduce right motor speed
}

void stopMotor() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, 0);
  analogWrite(ENB, 0);
}

// === Blynk Button Assignments ===
BLYNK_WRITE(V1) { if (param.asInt()) moveForward(); else stopMotor(); }
BLYNK_WRITE(V2) { if (param.asInt()) moveBackward(); else stopMotor(); }
BLYNK_WRITE(V3) { if (param.asInt()) turnLeft(); else stopMotor(); }
BLYNK_WRITE(V4) { if (param.asInt()) turnRight(); else stopMotor(); }

// === Slider for motor speed (optional) ===
BLYNK_WRITE(V5) {
  int val = param.asInt();
  motorSpeedA = map(val, 0, 1023, 0, 255);
  motorSpeedB = motorSpeedA;
  Serial.print("Speed: ");
  Serial.println(motorSpeedA);
}

void setup() {
  Serial.begin(115200);

  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);

  stopMotor();

  // Connect to Blynk Cloud
  Blynk.begin(auth, ssid, pass, "blynk.cloud", 8080);
}

void loop() {
  Blynk.run();
}

Credits

Kaito Adhitya
1 project • 0 followers

Comments