Smartphone Bluetooth Controlled Robotic Car with L298N & Arduino
Build a mobile robotic car chassis controlled wirelessly over Bluetooth using an Arduino Uno, HC-05 transceiver module, L298N dual H-bridge motor driver, and an Android/iOS smartphone app.
1. Aim of the Project
Project Objective
The aim of this robotics project is to engineer an agile 2WD/4WD robotic vehicle platform capable of receiving wireless serial telemetry commands (Forward, Reverse, Left, Right, Stop) from a paired smartphone over Bluetooth 2.0 (HC-05/HC-06), translating these UART characters into dual H-bridge motor drive signals to control vehicle motion and steering with high precision.
2. Interactive 3D Assembly & Circuit Wiring Model
Rotate the 3D robotic car model 360 degrees in any direction, zoom in/out, disassemble/explode chassis components, toggle realistic circuit wires, and inspect individual hardware layers.
3. Laboratory Video Masterclass Tutorial
Complete video tutorial explaining TT gearmotor soldering, L298N polarity setup, and Bluetooth smartphone controller configuration.
4. Learning Outcomes
UART Serial Communication
Understand asynchronous baud rates (9600 bps), RX/TX crossover wiring, and byte-by-byte serial packet decoding.
H-Bridge Motor Control
Master DC motor direction control and speed regulation using pulse-width modulation (PWM) on the L298N driver IC.
Power Distribution Design
Learn how to separate microcontroller logic 5V power from high-current motor inductor inductive spikes using common grounds.
3. Technologies & Concepts Learned
Serial.available(), Serial.read())4. Required List of Components
| Component Name | Quantity | Specification / Purpose | Interface Type |
|---|---|---|---|
| Arduino Uno R3 | 1 | Central controller brain | USB / DC Jack |
| HC-05 / HC-06 Bluetooth Module | 1 | Wireless Serial Transceiver (Baud 9600) | UART (Pins D0, D1) |
| L298N Dual Motor Driver | 1 | High-power H-Bridge for DC motors | Digital GPIO (Pins D5, D6, D9, D10) |
| TT Geared DC Motors & Wheels | 2 or 4 | 3-6V DC High torque gearboxes | Analog DC Power |
| 2x 18650 Li-Ion Batteries & Holder | 1 | 7.4V Rechargeable high discharge pack | Power Supply |
| 2-Wheel / 4-Wheel Acrylic Chassis | 1 | Physical robot frame with caster wheel | Mechanical Assembly |
5. Circuit Connections & Pin Mapping
| Module Component | Module Pin | Arduino Pin | Connection Description |
|---|---|---|---|
| HC-05 Bluetooth | TXD | Digital Pin 0 (RX) | Module Transmit to Arduino Receive |
| HC-05 Bluetooth | RXD | Digital Pin 1 (TX) | Arduino Transmit to Module Receive |
| HC-05 Bluetooth | VCC / GND | 5V / GND Rail | 5V Regulated Power Supply |
| L298N Motor Driver | IN1 | Digital Pin 5 | Left Motor Forward Direction |
| L298N Motor Driver | IN2 | Digital Pin 6 | Left Motor Reverse Direction |
| L298N Motor Driver | IN3 | Digital Pin 9 | Right Motor Forward Direction |
| L298N Motor Driver | IN4 | Digital Pin 10 | Right Motor Reverse Direction |
| L298N Motor Driver | 12V Input | Battery Pack Positive (+) | 7.4V - 12V High Current Power |
| L298N Motor Driver | GND | Battery (-) & Arduino GND | Common System Ground |
6. Step-by-Step Assembly Tutorial
Assemble Chassis & DC Motors
Mount the TT motors onto the acrylic baseplate with screws. Solder flexible red and black wires to the motor terminals and install the rubber traction wheels.
Wire the L298N Motor Driver
Connect the left motors in parallel to Output A and the right motors to Output B. Connect input logic pins IN1, IN2, IN3, and IN4 to Arduino pins 5, 6, 9, and 10.
Connect Bluetooth & Upload Code
Crucial note: Disconnect the RX and TX pins on the HC-05 while uploading code to the Arduino via USB to prevent COM port conflicts. Reconnect RX and TX after uploading.
7. Complete Arduino Source Code
/*
* Project: Smartphone Bluetooth Controlled Robotic Car
* Author: ElectronLab STEM Curriculum
* Target: Arduino Uno + L298N + HC-05
*/
// L298N Control Pins
const int IN1 = 5;
const int IN2 = 6;
const int IN3 = 9;
const int IN4 = 10;
char command = 'S'; // Default state is Stop
void setup() {
// Start Serial at Bluetooth default baud 9600
Serial.begin(9600);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
stopCar();
}
void loop() {
if (Serial.available() > 0) {
command = Serial.read();
switch (command) {
case 'F': // Forward
moveForward();
break;
case 'B': // Backward
moveBackward();
break;
case 'L': // Turn Left
turnLeft();
break;
case 'R': // Turn Right
turnRight();
break;
case 'S': // Stop
default:
stopCar();
break;
}
}
}
void moveForward() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void moveBackward() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void turnLeft() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void turnRight() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void stopCar() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
8. Working Principle
The smartphone controller application transmits single-character ASCII packets ('F', 'B', 'L', 'R', 'S') over the 2.4 GHz Bluetooth wireless link. The HC-05 receiver decodes these radio frequency packets and streams the characters into the Arduino hardware UART buffer.
The Arduino software executes a non-blocking switch-case state engine to bias the H-bridge transistors inside the L298N driver, reversing polarity to individual motor channels for instant differential steering response.
9. Testing & Troubleshooting Guide
Cannot Upload Code (avrdude error)
Unplug the RX and TX jumpers from Arduino Pins 0 and 1 during upload. The USB programmer shares these exact serial channels with the PC.
Car Spins in Circles When Moving Forward
One of your DC motors is wired with reversed polarity. Swap the positive and negative wires for that motor on the L298N terminal block.
Arduino Resets When Motors Turn On
Motors draw sudden current spikes that cause voltage brownouts. Power the Arduino and L298N with high-capacity 18650 Li-Ion cells and ensure grounds are tightly bonded.