Build a Bluetooth Controlled Car with Arduino
A Bluetooth car is the most popular first robotics project for students in Bangladesh. You drive it from your Android phone using a free Bluetooth controller app — the phone sends letters like F, B, L, R and the Arduino turns the motors.
What You Need:
- 1x Arduino Uno R3
- 1x HC-05 Bluetooth Module
- 1x L298N Motor Driver
- 2x N20 gear motors with wheels and mounts
- 2x 18650 Li-ion batteries with holder (7.4V)
- Jumper Wires
1. Wiring
L298N Motor Driver:
- IN1, IN2, IN3, IN4 → Pins 5, 6, 9, 10
- OUT1/OUT2 → left motor, OUT3/OUT4 → right motor
- 12V → battery +, GND → battery − and Arduino GND
- 5V → Arduino VIN (keep the 5V jumper on)
HC-05:
- VCC → 5V, GND → GND
- TXD → Arduino Pin 2
- RXD → Arduino Pin 3 through a voltage divider (1kΩ + 2kΩ from a resistor pack)
2. The Code
#include <SoftwareSerial.h>
SoftwareSerial bt(2, 3);
void drive(int a, int b, int c, int d) {
digitalWrite(5, a); digitalWrite(6, b);
digitalWrite(9, c); digitalWrite(10, d);
}
void forward() { drive(1,0,1,0); }
void back() { drive(0,1,0,1); }
void left() { drive(0,1,1,0); }
void right() { drive(1,0,0,1); }
void stopCar() { drive(0,0,0,0); }
void setup() {
for (int p : {5, 6, 9, 10}) pinMode(p, OUTPUT);
bt.begin(9600);
}
void loop() {
if (bt.available()) {
char c = bt.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();
}
}3. Pairing
Pair your phone with HC-05 (default PIN 1234 or 0000), open any “Arduino Bluetooth RC Car” app from the Play Store and connect. Unplug the HC-05 TX/RX wires while uploading code.
Need help? Stuck on wiring or code? Message us on WhatsApp at +880 1577-098376 and we will help you with your project.
