Let’s build your Bluetooth-controlled 2-wheel Arduino car using a caster wheel for front balance.
Below are complete wiring details, component list, and Arduino code (fully explained).
Components Required
| Component | Quantity | Description |
|---|---|---|
| Arduino UNO | 1 | Main microcontroller |
| L298N / HW-130 Motor Driver | 1 | To drive two DC motors |
| HC-05 Bluetooth Module | 1 | To receive commands from phone |
| DC Motors (with wheels) | 2 | For rear wheel drive |
| Caster wheel | 1 | For front balance |
| Battery (7.4V–12V) | 1 | Power source |
| Jumper wires | — | Connections |
Wiring Connections
Motor Driver L298N
| L298N Pin | Connects To | Description |
|---|---|---|
| IN1 | Arduino pin 4 | Motor A control 1 |
| IN2 | Arduino pin 5 | Motor A control 2 |
| IN3 | Arduino pin 6 | Motor B control 1 |
| IN4 | Arduino pin 7 | Motor B control 2 |
| ENA | Arduino pin 10 (PWM) | Speed control for left motor |
| ENB | Arduino pin 11 (PWM) | Speed control for right motor |
| OUT1, OUT2 | Left motor terminals | Motor A output |
| OUT3, OUT4 | Right motor terminals | Motor B output |
| +12V | Battery + | Power input |
| GND | Battery – & Arduino GND | Common ground |
| 5V | Arduino 5V | To power Arduino |
Bluetooth Module (HC-05)
| HC-05 Pin | Connects To | Description |
|---|---|---|
| VCC | 5V on Arduino | Power |
| GND | GND | Common ground |
| TX | Arduino A1 (Software RX) | Bluetooth TX → Arduino RX |
| RX | Arduino A0 (Software TX) | Bluetooth RX → Arduino TX (Use voltage divider if needed) |
Android App
Use any Bluetooth Controller App (e.g., “Bluetooth RC Controller” or “Arduino Bluetooth Controller” from Play Store).
Assign these characters for movement:
- ‘F’ → Forward
- ‘B’ → Backward
- ‘L’ → Left
- ‘R’ → Right
- ‘S’ → Stop
Arduino Code
Upload this to your Arduino UNO:
#include <SoftwareSerial.h>
SoftwareSerial BT(A1, A0); // RX | TX
#define ENA 10
#define ENB 11
#define IN1 4
#define IN2 5
#define IN3 6
#define IN4 7
char command;
void setup() {
Serial.begin(9600);
BT.begin(9600);
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
analogWrite(ENA, 200); // Set initial motor speed (0–255)
analogWrite(ENB, 200);
Serial.println("Bluetooth Car Ready. Waiting for commands...");
}
void loop() {
if (BT.available()) {
command = BT.read();
Serial.println(command);
switch (command) {
case 'F': forward(); break;
case 'B': backward(); break;
case 'L': left(); break;
case 'R': right(); break;
case 'S': stopCar(); break;
default: stopCar(); break;
}
}
}
void forward() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void backward() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void left() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void right() {
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);
}
Powering Tips
- If using 9V battery, ensure it can supply enough current (better use Li-ion 18650 pack).
- Connect battery + to motor driver +12V and Arduino VIN if using same battery.
- Always share common GND between Arduino, motor driver, and Bluetooth module.
Working Summary
- Pair your phone with HC-05 (default password:
1234or0000). - Open the app and connect to HC-05.
- Press control buttons → car moves accordingly:
- F → both wheels forward
- B → both wheels reverse
- L → left motor stops, right runs → turn left
- R → right motor stops, left runs → turn right
- S → all motors stop