Voice-Controlled Robot Car Using Bluetooth (Arduino + HC-05)

ampheoampheo
3 min read

Transform your robot car into a voice-controlled vehicle using Arduino, an HC-05 Bluetooth module, and a smartphone app. This method is simple, cost-effective, and perfect for beginners!


1. Components Needed

  • Arduino Uno/Nano (or any Arduino board)

  • HC-05 Bluetooth Module

  • L298N Motor Driver (for DC motors)

  • Robot Car Chassis (with 2x DC motors & wheels)

  • Battery Pack (6V–12V for motors)

  • Smartphone (Android/iOS with a voice control app)


2. Wiring Diagram

HC-05 Bluetooth Module Connections

HC-05 PinArduino PinNotes
VCC5VPower (use 3.3V if HC-05 is 3.3V logic)
GNDGNDCommon ground
TXDRX (Pin 0)Arduino receives data
RXDTX (Pin 1)Arduino sends data

⚠️ Warning: If using a 3.3V HC-05, add a voltage divider (1kΩ + 2kΩ resistors) on RX to avoid damaging the module!

L298N Motor Connections

(Refer to the previous robot car guide for wiring.)


3. Arduino Code (Bluetooth Voice Control)

cpp

#include <SoftwareSerial.h>
SoftwareSerial BT(0, 1); // RX (Pin 0), TX (Pin 1)

// Motor control pins (L298N)
const int ENA = 9;   // Left motor speed (PWM)
const int IN1 = 8;   // Left motor direction
const int IN2 = 7;
const int ENB = 10;  // Right motor speed (PWM)
const int IN3 = 6;   // Right motor direction
const int IN4 = 5;

void setup() {
  BT.begin(9600);    // Start Bluetooth communication
  pinMode(ENA, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(ENB, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
}

void loop() {
  if (BT.available()) {  // Check if data is received
    char command = BT.read();  // Read the command

    switch(command) {
      case 'F':  // "Forward"
        moveForward(200);  // Move forward at speed 200
        break;
      case 'B':  // "Backward"
        moveBackward(200);
        break;
      case 'L':  // "Left"
        turnLeft(150);
        break;
      case 'R':  // "Right"
        turnRight(150);
        break;
      case 'S':  // "Stop"
        stopMotors();
        break;
    }
  }
}

// Motor control functions
void moveForward(int speed) {
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}

void moveBackward(int speed) {
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}

void turnLeft(int speed) {
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}

void turnRight(int speed) {
  analogWrite(ENA, speed);
  analogWrite(ENB, speed);
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}

void stopMotors() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
}

4. Smartphone App Setup

  1. "Voice BT Arduino" (Android) – Simple voice-to-command app.

  2. "Arduino Bluetooth Controller" (Android/iOS) – Customizable buttons & voice control.

How to Configure the App:

  1. Pair HC-05 with your phone (default PIN: 1234 or 0000).

  2. Open the app and connect to the HC-05 module.

  3. Assign voice commands to send single letters:

    • Example: Say “Forward” → App sends 'F' to Arduino.

5. How It Works

  1. You speak a command (e.g., “Turn left”).

  2. The app converts speech to text and sends 'L' via Bluetooth.

  3. Arduino receives 'L' and executes turnLeft(150).

  4. The robot car responds instantly!


6. Troubleshooting

ProblemSolution
HC-05 not connectingCheck pairing PIN, power supply, and baud rate (9600).
Motors not movingVerify L298N power supply and Arduino code.
Voice commands not workingEnsure the app is sending the correct characters (F, B, etc.).

7. Upgrades & Next Steps

  • Add obstacle avoidance (Ultrasonic sensor + auto-stop).

  • Use an ESP32 for Wi-Fi/Google Assistant/Alexa control.

  • Implement a joystick app for manual driving.


Final Thoughts

This Bluetooth voice control method is the easiest way to make your robot car hands-free!

0
Subscribe to my newsletter

Read articles from ampheo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ampheo
ampheo