11:07:07 AM NPT Arduino, Robotics & IoT tutorials for Nepal
Beginner

Bluetooth Controlled Car with Arduino and HC-05 (Android App)

Build a Bluetooth controlled car with Arduino Uno, HC-05 and L298N, driven from an Android phone. Wiring, voltage divider, code and fixes.

On this page
Bluetooth Controlled Car with Arduino and HC-05 (Android App)

Driving a small car from your phone is one of the most satisfying beginner builds, and it needs no special hardware beyond an HC-05 Bluetooth module. You press Forward, Back, Left or Right on your Android phone, the phone sends a single character, and the Arduino turns that character into motor movement.

This guide shows the correct wiring (including the voltage divider the HC-05 needs), complete code, and two ways to control the car from Android.

What you need

Scroll sideways to see all columns.

Item Qty Notes
Arduino Uno 1
HC-05 Bluetooth module 1 The 6-pin version on a breakout board is easiest
L298N motor driver module 1
BO gear motors with wheels 2
Chassis with caster wheel 1 Two-wheel-drive kit
Battery pack for motors 1 A protected battery pack or AA pack sized for the motors and driver
USB power bank 1 For the Arduino and HC-05
Resistor 1 kΩ 1 Part of the voltage divider
Resistor 2 kΩ (or two 1 kΩ in series) 1 Part of the voltage divider
Android phone 1 With Bluetooth
Jumper wires, switch 1 set

Connection table

The HC-05 module works from 5 V on the breakout board (it has a regulator), but its data pins are 3.3 V. The Arduino TX pin outputs 5 V, so the HC-05 RX pin needs a voltage divider. The HC-05 TX pin outputs 3.3 V, which the Arduino reads as a valid HIGH, so it can go straight in.

Divider: Arduino D11 to 1 kΩ to the HC-05 RX pin, and 2 kΩ from the HC-05 RX pin to GND. The voltage at RX is 5 x 2 / (1 + 2) = about 3.3 V.

Scroll sideways to see all columns.

Pin or terminal Connects to
HC-05 VCC Arduino 5 V only on a breakout rated for 5 V input
HC-05 GND Arduino GND
HC-05 TXD Arduino D10 (software RX)
HC-05 RXD Arduino D11 through 1 kΩ to RXD, then 2 kΩ from RXD to GND
L298N ENA / ENB Arduino D5 / D6 (PWM), jumper caps removed
L298N IN1, IN2 Arduino D7, D8
L298N IN3, IN4 Arduino D3, D4
L298N OUT1, OUT2 Left motor
L298N OUT3, OUT4 Right motor
L298N 12V terminal Motor battery +
L298N GND Motor battery -, and Arduino GND
L298N 5V terminal Arduino 5 V for driver logic, with the 5V-EN jumper removed

The Arduino is powered from the USB power bank, separate from the motor battery. Only the grounds are shared.

We use SoftwareSerial on D10 and D11 instead of the hardware pins D0 and D1, because D0 and D1 are also used by USB uploads and will block uploading while the HC-05 is connected.

How it works

The HC-05 acts as a wireless serial cable. Your phone pairs with it and any text sent from a Bluetooth serial app appears on the Arduino's SoftwareSerial pin as normal serial data. The Arduino reads one character at a time:

Scroll sideways to see all columns.

Character Action
F Forward
B Backward
L Turn left
R Turn right
S Stop
0 to 9 Set speed (optional)

Because the commands are single characters, the code is short and easy to debug with the normal Serial Monitor first.

Step-by-step build

  1. Assemble the chassis and motors, then mount the L298N, Arduino and HC-05.
  2. Build the voltage divider on a small piece of breadboard, then connect it to the HC-05 RX pin.
  3. Wire everything using the table. Double-check the HC-05 TX and RX are not swapped: TX of the module goes to RX of the Arduino and vice versa.
  4. Upload the code over USB. The HC-05 is on SoftwareSerial pins D10 and D11, so it does not block uploads.
  5. Power the car. The HC-05 LED should blink fast (not paired).
  6. On your phone, open Bluetooth settings and pair with "HC-05". The usual default PIN is 1234 (some modules use 0000). The LED pattern varies by breakout and usually changes once a serial connection opens.
  7. Open a Bluetooth serial controller app (any Bluetooth serial terminal or car-controller app from the Play Store, or one you build with MIT App Inventor), connect to HC-05 and send the characters in the table. Many controller apps let you set which character each button sends, so match them to F, B, L, R and S.

Build your own Android app (optional)

MIT App Inventor has a BluetoothClient component. Add a ListPicker to choose the device, five buttons, and in each button's click event call BluetoothClient.SendText with "F", "B", "L", "R" or "S". Use the button's TouchDown event to move and TouchUp to send "S", so the car stops when you let go. A homemade app is also a strong talking point for your viva.

Complete code

sketch-1.inoDownload code
// Bluetooth car with HC-05 - not compiled yet
#include <SoftwareSerial.h>

SoftwareSerial bt(10, 11);   // RX = D10 (from HC-05 TX), TX = D11 (via divider)

const int ENA = 5, IN1 = 7, IN2 = 8;
const int IN3 = 3, IN4 = 4, ENB = 6;

int speedVal = 170;          // 0-255
unsigned long lastCmd = 0;

void drive(int left, int right) {
  digitalWrite(IN1, left  > 0); digitalWrite(IN2, left  < 0);
  digitalWrite(IN3, right > 0); digitalWrite(IN4, right < 0);
  analogWrite(ENA, abs(left));
  analogWrite(ENB, abs(right));
}

void setup() {
  pinMode(ENA, OUTPUT); pinMode(ENB, OUTPUT);
  pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT);
  Serial.begin(9600);
  bt.begin(9600);            // HC-05 default data mode baud rate is commonly 9600
  drive(0, 0);
}

void loop() {
  if (bt.available()) {
    char c = bt.read();
    Serial.println(c);       // for debugging

    if (c >= '0' && c <= '9') {
      speedVal = map(c - '0', 0, 9, 90, 255);
    }

    switch (c) {
      case 'F': drive(speedVal, speedVal);   break;
      case 'B': drive(-speedVal, -speedVal); break;
      case 'L': drive(-speedVal, speedVal);  break;
      case 'R': drive(speedVal, -speedVal);  break;
      case 'S': drive(0, 0);                 break;
      default: break;
    }
    if (c == 'F' || c == 'B' || c == 'L' || c == 'R' || c == 'S') {
      lastCmd = millis();
    }
  }

  // Safety: stop if no command for 1.5 seconds (phone out of range)
  if (millis() - lastCmd >= 1500) {
    drive(0, 0);
  }
}

The 1.5 second timeout assumes your app keeps sending the character while a button is held. If your app sends once per press, remove the timeout block or increase the time.

Testing

  • With the car lifted, open the Serial Monitor, then send characters from the phone app. Each one should print.
  • Check each direction in the air first. Swap motor wires if a direction is reversed.
  • Test range in a clear room. Bluetooth range is commonly stated as around 10 m in open space, and walls reduce it.

Troubleshooting

Scroll sideways to see all columns.

Symptom Likely cause Fix
Phone does not see HC-05 No power or module in wrong mode Check 5 V and GND; the LED should blink
Pairing PIN rejected Different default PIN Try 1234, then 0000
Paired but nothing happens TX and RX swapped HC-05 TX goes to D10, RX goes to D11 via divider
Garbled characters Baud rate mismatch Set the baud rate of the module and sketch to match, usually 9600
Car moves wrong direction Motor wires or L298N inputs reversed Swap the motor leads
Arduino resets when driving Shared supply Separate motor battery and power bank, common GND
Car keeps running after releasing App sends no stop command Send "S" on release, or keep the timeout

FAQ

Do I really need the voltage divider?

The HC-05 data pins are 3.3 V devices. Many people connect 5 V directly and it appears to work, but it can shorten the life of the module, so the divider is a cheap and safe habit.

Can I use an iPhone?

The HC-05 uses classic Bluetooth, which iPhones do not support for this type of serial link. Use an Android phone, or choose a BLE module such as the HM-10.

Can I use HC-06 instead?

Yes. It is a slave-only version and works the same way for this project.

How do I change the name or PIN of the HC-05?

Put the module in AT command mode (hold the button on power-up on many boards) and use AT commands. The baud rate in AT mode is commonly 38400, but check your module's documentation.

Related tutorials

See all Robotics →