You will build a robotic car that responds to voice commands via a Bluetooth module (HC-05). The voice commands will be converted to text using a mobile app like “Arduino Voice Control”, then transmitted over Bluetooth to the Arduino, which will control the car’s motion.


Components Required

ComponentQuantity
Arduino UNO/Nano1
L298N Motor Driver1
HC-05 Bluetooth Module1
DC Motors (Gear Motors)2 (or 4)
Wheels2 (or 4)
Chassis1
Battery Pack (6V or 12V)1
Jumper WiresAs needed

Wiring Connections

1. L298N Motor Driver to Arduino:

L298N PinsArduino Pins
IN14
IN25
IN36
IN47
ENA10 (PWM)
ENB11 (PWM)

2. HC-05 Bluetooth Module to Arduino:

HC-05 PinsArduino Pins
VCC5V
GNDGND
TXDRX (Pin A0)
RXDTX (Pin A1)

Voice Commands Expected

You can use an Android app like “Arduino Bluetooth Control” or “BT Voice Control for Arduino”.

Commands to send via voice (converted to text over Bluetooth):


Arduino Code

#include <SoftwareSerial.h>

// Motor Pins
const int IN1 = 4;
const int IN2 = 5;
const int IN3 = 6;
const int IN4 = 7;
const int ENA = 10;
const int ENB = 11;

// SoftwareSerial for Bluetooth on A0 (RX) and A1 (TX)
SoftwareSerial BTSerial(A0, A1); // RX, TX

String command = "";

void setup() {
  // Motor pins as output
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);

  // Start hardware Serial for debug output
  Serial.begin(9600);
  while (!Serial) {
    ; // Wait for Serial Monitor to open
  }
  Serial.println("Serial monitor started. Waiting for Bluetooth commands...");

  // Start SoftwareSerial for Bluetooth communication
  BTSerial.begin(9600);
}

void loop() {
  if (BTSerial.available()) {
    command = BTSerial.readStringUntil('\n');
    command.trim();  // remove whitespace and newline

    Serial.print("Command received via Bluetooth: ");
    Serial.println(command);

    if (command == "forward") {
      moveForward();
      Serial.println("Moving forward");
    } else if (command == "backward") {
      moveBackward();
      Serial.println("Moving backward");
    } else if (command == "left") {
      turnLeft();
      Serial.println("Turning left");
    } else if (command == "right") {
      turnRight();
      Serial.println("Turning right");
    } else if (command == "stop") {
      stopMotors();
      Serial.println("Stopping motors");
    } else {
      Serial.println("Unknown command");
    }
  }
}

void moveForward() {
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, 200);
  analogWrite(ENB, 200);
}

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

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

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

void stopMotors() {
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
  analogWrite(ENA, 0);
  analogWrite(ENB, 0);
}

Mobile App (Voice to Bluetooth)

You can use any of these Android apps:


Tips & Troubleshooting