In this project, I will be going to show you a Bluetooth Controlled Robot using an Arduino and HC-05 Bluetooth module. 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. Android controlled robots make use of a smartphone for robotic control with the help of Bluetooth technology. This is a very simple robotics project using a microcontroller.
Principle Behind Bluetooth Controlled Robot
This Bluetooth controlled robot is operated simply using Bluetooth technology and also with the user command. The user has to install an app on his/her smartphone for controlling this robot. After pairing with a smartphone and Bluetooth controlled robot, the user can operate it via commands like forward, backward, right, left, and stop. Also, it has some extra features like forward and backward light indicators, a horn and speed control. These all commands are sent to the Bluetooth receiver from the smartphone. After receiving the command through the Bluetooth receiver, it sends the analog signal to the Arduino for decoding the code. And then after processing the right code the Arduino controls the motors, lights and horns of the robot.
Must Read Obstacle Avoiding Line Follower Robot
What is Bluetooth Controlled Robot?
Android Bluetooth controlled robot is a humanoid-assisted robotic system which can be easily controlled by using an android smartphone instead of any other methods like buttons, gestures, etc. For moving the robot, we just need to touch the forward, backward, right and left buttons of the app. Also, we can control it using the gesture function which is in-built in the app.
Project
Circuit Diagram
Components Required
- Arduino Nano
- HC-05 Bluetooth Module
- L298N Motor Driver
- BO Motor (x2)
- LED (White, Red)
- Buzzer (As Horn)
- Smartphone
- Bluetooth Controlled App
- Jumper Wires
- Mini Breadboard
- Chasis
- 9V Battery
About Parts
Arduino
For the compact build, I choose Arduino Nano despite Arduino UNO. Arduino Nano is a small, flexible microcontroller board using an Atmega328p chip. It can also use as a substitute for UNO. All the functions are the same in these two boards. The size of its PCB is 18×45 mm. The clock speed is 16Mhz. Its input voltage is 5-12V. There are 30 pins including power pins, data pins, analog pins, and serial pins on this board.
HC-05 Bluetooth Module
The HC-05 Bluetooth Module is liable for empowering Bluetooth communication among Arduino and android phone. It has already a default baud rate of 9600 bps. We just need to connect RX and TX with a serial converter of the Arduino and that’s it.
HC-05 Bluetooth module has two modes that are one in master mode and another one in slave mode. We can set any mode by using some AT commands. Even we can set the module’s settings by using AT command. First, we need to enter AT mode with a 38400 bps baud rate by pressing Enable button at the Bluetooth module or by giving a HIGH level at Enable pin.
L298N Motor Driver
The L298N motor driver module is liable for giving the vital drive current to the engines of the robotic car.
N.B: 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 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 the Arduino depends on the SoftwareSerial library (Pin 0 and Pin 1 are arranged as RX and TX pins of the Arduino.)
Presently, the L298N motor driver module’s digital I/O pin 2 to pin 5 of Arduino are designed as to output pins of the motor driver and are associated with IN1 through IN4 of the L298N motor driver module.
Arduino Nano | HC-05 Module |
---|---|
+5V | VCC |
GND | GND |
TX | RX |
RX | TX |
Arduino Nano | L298N Motor Driver |
---|---|
D2 | IN1 |
D3 | IN2 |
D4 | IN3 |
D5 | IN4 |
Android Application for Controlling The Robot
Here I have used a simple Bluetooth controlled app named “Arduino Bluetooth RC Car” available in the Playstore, which can communicate with a Bluetooth module using serial communication. After installing the app, we need to turn on Bluetooth and location in the smartphone to work it properly.
Now tap on the settings tab and then scan to find the correct Bluetooth module. There are some basic keys listed in the settings tab which I included in the Arduino code to work its basic functions which are forward, backward, right, left, etc. The following codes are mentioned below. We can also control this robot using gesture control with this same app.
Function | Code |
---|---|
Forward | F |
Backward | B |
Left | L |
Right | R |
Forward Left | G |
Forward Right | I |
Backward Left | H |
Backward Right | J |
Stop | S |
Front Light ON | W |
Front Light OFF | w |
Back Light ON | U |
Back Light OFF | u |
Horn ON | V |
Horn OFF | v |
Working Principle of Bluetooth Controlled Robot
To begin with, for this Bluetooth controlled robot, I have utilized 7 keys forward, backward, left, right, light ON/OFF, horn, and speed.
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 serial 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 is 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 robot in the forward direction while IN2 and IN4 are in deactivation mode.
Application of Bluetooth Controlled Robot
- Low range mobile operated Bluetooth controlled robot.
- Military spy robot application.
- Home automation robots like a wheelchair.
Disadvantages of Bluetooth Controlled Robot
- As we know the connectivity range of Bluetooth communication is approximately 10 meters, so the controlling range of this robot is also limited.
- If the power is not sufficient for all the modules, especially the Bluetooth module, then the whole process will not work. Also, we can’t attach more than 3 batteries to the small chassis. So we need powerful batteries.
Future Development
- In future, we can add more sensors to work it efficiently.
- We can also add a wireless camera and display to view the sight where the robot will be moving.
Arduino Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | int motorRF = 2; //right front motor int motorRB = 3; //Left front motor int motorLF = 4; //Right back motor int motorLB = 5; //Left back motor int lightF = 6; //Front light int lightB = 7; //Back light int horn = 8; //Horn int ena = 10; //Enable A int enb = 11; //Enable B int spd = 26; //Speed char val; void setup() { pinMode(motorRF, OUTPUT); //D2 set to IN1 pinMode(motorRB, OUTPUT); //D3 set to IN2 pinMode(motorLF, OUTPUT); //D4 set to IN3 pinMode(motorLB, OUTPUT); //D5 set to IN4 pinMode(motorLB, OUTPUT); //D6 set to Front Light pinMode(motorLB, OUTPUT); pinMode(motorLB, OUTPUT); pinMode(motorLB, OUTPUT); Serial.begin(9600); } void loop() { while (Serial.available() > 0) { val = Serial.read(); Serial.println(val); } if ( val == 'F') //Forward { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, HIGH); digitalWrite(motorLF, HIGH); digitalWrite(motorRB, LOW); digitalWrite(motorLB, LOW); } else if (val == 'B') //Backward { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, LOW); digitalWrite(motorLF, LOW); digitalWrite(motorRB, HIGH); digitalWrite(motorLB, HIGH); } else if (val == 'L') //Left { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, LOW); digitalWrite(motorLF, HIGH); digitalWrite(motorRB, LOW); digitalWrite(motorLB, LOW); } else if (val == 'R') //Right { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, LOW); digitalWrite(motorLF, HIGH); digitalWrite(motorRB, LOW); digitalWrite(motorLB, LOW); } else if (val == 'S') //Stop { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, LOW); digitalWrite(motorLF, LOW); digitalWrite(motorRB, LOW); digitalWrite(motorLB, LOW); } else if (val == 'I') //Forward Right { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, LOW); digitalWrite(motorLF, HIGH); digitalWrite(motorRB, LOW); digitalWrite(motorLB, LOW); } else if (val == 'J') //Backward Right { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, LOW); digitalWrite(motorLF, LOW); digitalWrite(motorRB, LOW); digitalWrite(motorLB, HIGH); } else if (val == 'G') //Forward Left { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, HIGH); digitalWrite(motorLF, LOW); digitalWrite(motorRB, LOW); digitalWrite(motorLB, LOW); } else if (val == 'H') //Backward Left { analogWrite(ena, spd); analogWrite(enb, spd); digitalWrite(motorRF, LOW); digitalWrite(motorLF, LOW); digitalWrite(motorRB, HIGH); digitalWrite(motorLB, LOW); } else if (val == '1') { spd = 26; } else if (val == '2') { spd = 51; } else if (val == '3') { spd = 77; } else if (val == '4') { spd = 102; } else if (val == '5') { spd = 128; } else if (val == '6') { spd = 153; } else if (val == '7') { spd = 179; } else if (val == '8') { spd = 204; } else if (val == '9') { spd = 230; } else if (val == 'q') { spd = 255; } else if (val == 'W') //front Light ON { digitalWrite(lightF, HIGH); } else if (val == 'w') //front Light OFF { digitalWrite(lightF, LOW); } else if (val == 'U') //back Light ON { digitalWrite(lightB, HIGH); } else if (val == 'u') //back Light OFF { digitalWrite(lightB, LOW); } else if (val == 'V') //Horn ON { digitalWrite(horn, HIGH); } else if (val == 'v') //Horn OFF { digitalWrite(horn, LOW); } } |
Download the gerber file from pcb section and order from pcbway.
I WANT YOUR PCB.
Appreciate this post. Will try it out.
From any electronics material shops or any nearest big electronics market area.
Sir, from where I could get material for Arduino Bluetooth Controlled Robot Car
From I purchase material at right rate