How To Build An Arduino Bluetooth Controlled Robot

In this tutorial, I will be going to show you a Bluetooth controlled robot using an Arduino and HC-05 Bluetooth module. By utilizing this IoT project I will use a smartphone and an android app that can operate the robotic car.

Robotics is consistently a fancy topic for understudies, hobbyists, and DIYers. As a learner, constructing a robot is most likely one of the significant activities to do subsequent to finding out about the nuts and bolts.

Additionally, I have given a basic Bluetooth Controller App, which can be introduced on your Android Phone and begin transmitting the information.

There are another two modules except for Arduino which are the major parts in this project.

About Parts

HC-05 Bluetooth Module

The HC-05 Bluetooth Module is liable for empowering bluetooth communication among Arduino and android phone.

L298N Motor Driver Module

The L298N motor driver module is liable for giving the vital drive current to the engines of the robotic car.

Note: I am using an L298N motor driver in this project, but you can also use an L293D motor driver as we use only two BO motors here. But in the case of four BO motors, we should use the L298N motor driver.

Circuit Diagram

Components Required

  • Arduino Nano
  • HC-05 Bluetooth Module
  • L298N Motor Driver
  • BO Motor
  • Smartphone
  • Bluetooth Controlled App
  • Connecting Wires
  • Breadboard
  • 9V Battery

Circuit Connection

Going to build this bluetooth controlled robot, at first we should look for the HC-05 bluetooth module where the +5V and GND pins are directly connected to the 5V power supply or Arduino 5V supply.

After that, we need to connect the TX pin of the bluetooth module to the RX pin of the Arduino as we know that we should only transmit data from the smartphone to the Bluetooth module of the bluetooth controlled robot and don’t need to receive any kind of information from Arduino.

This RX pin of Arduino depends on the SoftwareSerial library (Pin 2 and Pin 3 are arranged as RX and TX on Arduino).

Presently, the L298N motor driver module’s digital I/O pins 2 through 5 of Arduino are designed as input pins of the motor driver and are associated with IN1 through IN4 of the L298N motor driver module. Both the enable pins are associated with 5V through the jumper wires.

Android Application

Here I have used a simple bluetooth controlled app named “Arduino Bluetooth RC Car” which can communicate with Bluetooth module. It is available in google play store.

Working of Bluetooth Controlled Robot

To begin with, this bluetooth controlled robot, in the Android App, I have utilized 4 keys as forward, reverse, left, and right.

At the point when a key is pressed by the user, the comparing information is transmitted to the bluetooth module from the smartphone over bluetooth communication.

In the Arduino code, the Arduino gets any of this information from the bluetooth module (according to the key mapping) and plays out a simple switch case activity, where each case related with suitable directions to the motor driver input pins.

As an example, if the forward key is pressed in the smartphone app, then the Arduino will activate IN1 and IN3 from the motor driver module to move the bluetooth controlled robot in the forward direction while IN2 and IN4 are in deactivate mode.

Application of Bluetooth Controlled Robot

  • Low range mobile operated bluetooth controlled robot toy car
  • Military spy robot application
  • Home automation robot

Arduino Code

// Electro Gadget - circuitdiagrams.in
int m1a = 2;
int m1b = 3;
int m2a = 4;
int m2b = 5;
char val;

void setup() 

{ 

pinMode(m1a, OUTPUT); // Digital pin 2 set as output Pin
pinMode(m1b, OUTPUT); // Digital pin 3 set as output Pin
pinMode(m2a, OUTPUT); // Digital pin 4 set as output Pin
pinMode(m2b, OUTPUT); // Digital pin 5 set as output Pin
Serial.begin(9600);

}

void loop()

{

 while (Serial.available() > 0)
 {
  
 val = Serial.read();
 Serial.println(val);
 }

 if( val == 'F') // Forward

 {
 digitalWrite(m1a, HIGH);
 digitalWrite(m1b, LOW);
 digitalWrite(m2a, HIGH);
 digitalWrite(m2b, LOW); 
 }
 else if(val == 'B') // Backward
 {
 digitalWrite(m1a, LOW);
 digitalWrite(m1b, HIGH);
 digitalWrite(m2a, LOW);
 digitalWrite(m2b, HIGH); 
 }
 else if(val == 'L') //Left
 {
 digitalWrite(m1a, LOW);
 digitalWrite(m1b, LOW);
 digitalWrite(m2a, HIGH);
 digitalWrite(m2b, LOW);
 }
 else if(val == 'R') //Right
 {
 digitalWrite(m1a, HIGH);
 digitalWrite(m1b, LOW);
 digitalWrite(m2a, LOW);
 digitalWrite(m2b, LOW); 
 }
 else if(val == 'S') //Stop
 {
 digitalWrite(m1a, LOW);
 digitalWrite(m1b, LOW);
 digitalWrite(m2a, LOW);
 digitalWrite(m2b, LOW); 
 }
 else if(val == 'I') //Forward Right
 {
 digitalWrite(m1a, HIGH);
 digitalWrite(m1b, LOW);
 digitalWrite(m2a, LOW);
 digitalWrite(m2b, LOW);
 }
 else if(val == 'J') //Backward Right
 {
 digitalWrite(m1a, LOW);
 digitalWrite(m1b, HIGH);
 digitalWrite(m2a, LOW);
 digitalWrite(m2b, LOW);
 }
 else if(val == 'G') //Forward Left
 {
 digitalWrite(m1a, LOW);
 digitalWrite(m1b, LOW);
 digitalWrite(m2a, HIGH); digitalWrite(m2b, LOW);
 }
 else if(val == 'H') //Backward Left
 {
 digitalWrite(m1a, LOW);
 digitalWrite(m1b, LOW);
 digitalWrite(m2a, LOW);
 digitalWrite(m2b, HIGH); 
 }
}

Video Output

Visit our site for more awsome tutorial Electro Gadget

Leave a comment