Back AeroTech PROJECT #16

ESP32
Bluetooth
Controlled Car

Robotics ESP32 Bluetooth L298N DC Motors Smartphone
ESP32 Bluetooth Controlled Car
// Overview

About This Project

In this project, I built a small smart car using the ESP32 microcontroller. The car can be controlled wirelessly via Bluetooth using a smartphone. The phone sends commands (F, B, L, R, S) and the ESP32 controls the motor driver to move the car in any direction.

// Features

Main Features

// Hardware

Required Components

ESP32 Board
🔧
Motor Driver L298N
⚙️
2–4 DC Motors
🚗
Car Chassis
🔋
18650 / Li-Po Battery
🔌
Jumper Wires
🛞
Wheels
📱
Smartphone
// Control App

Download App

Install the Bluetooth Car Controller app on your Android smartphone to control the car:

Install on Google Play
Bluetooth Car Controller App
// Source Code

ESP32 Code

C++ / ESP32
#include "BluetoothSerial.h"

BluetoothSerial SerialBT;

int IN1 = 26;
int IN2 = 27;
int IN3 = 14;
int IN4 = 12;

void forward();
void back();
void left();
void right();
void stopCar();

void setup() {
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);

  stopCar();

  SerialBT.begin("ESP32_CAR");
}

void loop() {
  if (SerialBT.available()) {
    char c = SerialBT.read();

    if      (c == 'F') forward();
    else if (c == 'B') back();
    else if (c == 'L') left();
    else if (c == 'R') right();
    else if (c == 'S') stopCar();
  }
}

void forward() {
  digitalWrite(IN1, 1);
  digitalWrite(IN2, 0);
  digitalWrite(IN3, 1);
  digitalWrite(IN4, 0);
}

void back() {
  digitalWrite(IN1, 0);
  digitalWrite(IN2, 1);
  digitalWrite(IN3, 0);
  digitalWrite(IN4, 1);
}

void left() {
  digitalWrite(IN1, 0);
  digitalWrite(IN2, 1);
  digitalWrite(IN3, 1);
  digitalWrite(IN4, 0);
}

void right() {
  digitalWrite(IN1, 1);
  digitalWrite(IN2, 0);
  digitalWrite(IN3, 0);
  digitalWrite(IN4, 1);
}

void stopCar() {
  digitalWrite(IN1, 0);
  digitalWrite(IN2, 0);
  digitalWrite(IN3, 0);
  digitalWrite(IN4, 0);
}

✓ Results

  • Smooth Bluetooth control
  • Reliable motor response
  • Easy to extend with sensors

↑ Future Improvements

  • Speed control with PWM
  • Obstacle avoidance (ultrasonic)
  • Web-based WiFi control
  • Camera streaming