Wireless Bluetooth Bot using Arduino and HC-05

Wireless Bluetooth Bot
Wireless Bluetooth Bot

In this tutorial we are going to learn how to make a wireless Bluetooth Bot using Arduino and Bluetooth module hc-05, and control it using our smartphone.

Component required :

Bluetooth Module HC-05

HC 05 Bluetooth Module
HC 05 Bluetooth Module

The HC-05 Bluetooth Module is responsible for enabling Bluetooth Communication between Arduino and Android Phone.

L298N Motor Driver

L298N Motor Driver
L298N Motor Driver

The L298N Motor Driver Module is responsible for providing the necessary drive current to the motors of the robotic car.

Circuit Diagram

Wireless Bluetooth Bot circuit Diagram
Wireless Bluetooth Bot circuit Diagram

The following is the circuit diagram of Bluetooth Controlled Robot using Arduino, L298N and HC-05.

Applications used in this Project

App for voice command control – Download
App for Button and Gesture Control – Download

Voice command app

You can set the voice command and what data to send at that voice command.

I’ve configured 5 voice commands,

Forward & Data = 1

Backward & Data = 2

Right & Data = 3

Left & Data = 4

Stop & Data = 5

Gesture and Button Control App
In this the data sent is fixed by the developer of the app.

Forward – FF

Backward – BB

Right – RR

Left – LL

Stop – SS

Working Code of Voice Controlled Bot using Arduino

     #include <SoftwareSerial.h>

#define m11 11
#define m12 10
#define m13 8
#define m14 9


#define r 19
#define o 12

#define b 17




SoftwareSerial BT(6,7); //TX OF BLUETOOTH ON 4
String readvoice;

void setup() 
{
  pinMode(m11, OUTPUT);
  pinMode(m12, OUTPUT);
  pinMode(m13, OUTPUT);
  pinMode(m14, OUTPUT);

    pinMode(r, OUTPUT);
    pinMode(o, OUTPUT);
    pinMode(b, OUTPUT);


  digitalWrite(m11,HIGH);
  digitalWrite(m12,HIGH);
  digitalWrite(m13,HIGH);
  digitalWrite(m14,HIGH);

digitalWrite(o,HIGH);


  
  
 BT.begin(9600);
 Serial.begin(9600);
 
}
//-----------------------------------------------------------------------// 
void loop() 
{
     readvoice=""; //Reset the variable

  if(BT.available())
  {
  while (BT.available())
  {  //Check if there is an available byte to read
  delay(10); //Delay added to make thing stable
  char c = BT.read(); //Conduct a serial read
  readvoice += c; //build the string- "forward", "reverse", "left" and "right"
  } 
  }

   
  if (readvoice.length() > 0)
  {
   Serial.println(readvoice);

  if(readvoice == "*forward#" ||readvoice == "FF" ||readvoice == "FORWARD")
  {
  digitalWrite(m11,HIGH);
   digitalWrite(m12,LOW);
   digitalWrite(m13,HIGH);
   digitalWrite(m14,LOW);
   
  }

  else if(readvoice == "BB" || readvoice == "*backward#" ||readvoice == "BACKWARD")
  {
    digitalWrite(m11,LOW);
   digitalWrite(m12,HIGH);
   digitalWrite(m13,LOW);
   digitalWrite(m14,HIGH);
    Serial.println(readvoice);
  }

  else if (readvoice == "*right#" || readvoice == "RR" ||readvoice == "RIGHT")
  {
   digitalWrite(m11,HIGH);
   digitalWrite(m12,LOW);
   digitalWrite(m13,LOW);
   digitalWrite(m14,HIGH);
   
  
  }

 else if ( readvoice == "*left#" || readvoice == "LL" ||readvoice == "LEFT")
 {
   digitalWrite(m11,LOW);
   digitalWrite(m12,HIGH);
   digitalWrite(m13,HIGH);
   digitalWrite(m14,LOW);

   
 }

 else if (readvoice == "*stop#" || readvoice == "SS" ||readvoice == "STOP")
 {
   digitalWrite(m11,HIGH);
   digitalWrite(m12,HIGH);
   digitalWrite(m13,HIGH);
   digitalWrite(m14,HIGH);
 }

  else if (readvoice == "SWS" || readvoice == "RUN WATER")  //
 {
   digitalWrite(o,HIGH);
   
 }
 
  else if (readvoice == "SwS" || readvoice == "STOP WATER")  //
 {
   digitalWrite(o,LOW);
   
 }
 
  else if (readvoice == "SUS")
 {
   digitalWrite(r,HIGH);
   
 }
   else if (readvoice == "SuS")
 {
   digitalWrite(r,LOW);
   
 }
 else if (readvoice == "SVS")
 {
   digitalWrite(b,HIGH);
   
 }
 else if (readvoice == "SvS")
 {
   digitalWrite(b,LOW);
   
 }


}
}

OUTPUT VIDEO

Hope this tutorial helped you in building this project if anything is not working please Comment down we will try to resolve it soon as possible.

Leave a Reply

Your email address will not be published. Required fields are marked *