Loading...

Voice Controlled Car using Arduino | Arduino Geek


Hello everyone! Welcome to Arduino Geek. Today we will discuss about an Arduino based voice controlled car. So let's get started.

Voice Controlled Car using Arduino:

Building a voice-controlled car using Arduino is a fun and exciting project that can be accomplished with a few components and some coding.

Components:

  1. Arduino board (Uno or Nano)
  2. Motor driver (L293D or L298N)
  3. DC motors
  4. Bluetooth module (HC-05 or HC-06)
  5. Jumper wires
  6. Battery pack
  7. Chassis with wheels
  8. Microphone module (e.g. MAX9814)
  9. Speaker or buzzer

How to make Voice controlled car:

Here are the basic steps you can follow:

1. Connect the motors: 

Connect the two DC motors to the motor driver, and then connect the motor driver to the Arduino board.

2. Connect the Bluetooth module: 

Connect the Bluetooth module to the Arduino board.

3. Connect the microphone module: 

Connect the microphone module to the Arduino board.

4. Code the Arduino: 

Write the code for the Arduino board using the Arduino IDE. You will need to include libraries for the Bluetooth and microphone modules.

5. Program the voice commands: 

Program the voice commands you want to use to control the car, such as "forward," "backward," "left," and "right."

6. Test the car: 

Test the car to ensure that it responds to your voice commands.

7. Fine-tune the code: 

Fine-tune the code as needed to ensure that the car responds accurately and reliably to your voice commands.

Note: The above steps provide a general overview of how to create a voice-controlled car using Arduino. You may need to modify or add more features to suit your specific requirements.

Arduino Code:

Here's an example Arduino code for a voice-controlled car using an Arduino Uno and a HC-05 Bluetooth module:

#include <SoftwareSerial.h>
SoftwareSerial BTserial(10, 11); // RX | TX

// Define the pins for the motor control
int leftMotorForward = 2;
int leftMotorBackward = 3;
int rightMotorForward = 4;
int rightMotorBackward = 5;

void setup()
{
  Serial.begin(9600);
  BTserial.begin(38400);
  pinMode(leftMotorForward, OUTPUT);
  pinMode(leftMotorBackward, OUTPUT);
  pinMode(rightMotorForward, OUTPUT);
  pinMode(rightMotorBackward, OUTPUT);
}

void loop()
{
  if (BTserial.available())
  {
    char cmd = BTserial.read();
    Serial.println(cmd);
    if (cmd == 'F')
    {
      digitalWrite(leftMotorForward, HIGH);
      digitalWrite(leftMotorBackward, LOW);
      digitalWrite(rightMotorForward, HIGH);
      digitalWrite(rightMotorBackward, LOW);
    }
    else if (cmd == 'B')
    {
      digitalWrite(leftMotorForward, LOW);
      digitalWrite(leftMotorBackward, HIGH);
      digitalWrite(rightMotorForward, LOW);
      digitalWrite(rightMotorBackward, HIGH);
    }
    else if (cmd == 'L')
    {
      digitalWrite(leftMotorForward, LOW);
      digitalWrite(leftMotorBackward, HIGH);
      digitalWrite(rightMotorForward, HIGH);
      digitalWrite(rightMotorBackward, LOW);
    }
    else if (cmd == 'R')
    {
      digitalWrite(leftMotorForward, HIGH);
      digitalWrite(leftMotorBackward, LOW);
      digitalWrite(rightMotorForward, LOW);
      digitalWrite(rightMotorBackward, HIGH);
    }
    else if (cmd == 'S')
    {
      digitalWrite(leftMotorForward, LOW);
      digitalWrite(leftMotorBackward, LOW);
      digitalWrite(rightMotorForward, LOW);
      digitalWrite(rightMotorBackward, LOW);
    }
  }
}

Arduino Code Description:

In this code, we're using an Arduino board with a Bluetooth module (connected to pins 10 and 11) to control a motor driver board. The motor driver board controls four motors using pins 2, 3, 4, and 5.

The program waits for incoming Bluetooth commands (F, B, L, R, or S) and performs the appropriate action on the motor driver board.

F: Moves both motors forward
B: Moves both motors backward
L: Turns left by reversing the left motor
R: Turns right by reversing the right motor
S: Stops both motors
The program also prints the received command to the Serial Monitor.
 
close