Project Report On Bluetooth Controlled Robot Car
Project Report On Bluetooth Controlled Robot Car
Project Report On Bluetooth Controlled Robot Car
on
(Session 2017-2018)
1) Abstract 1
2)Bluetooth Technology 2
3)Analysis 4
4)Design 5
5) Implementation 12
6) Conclusion 15
7) References 15
8) Source Code 16
Abstract
A remote control vehicle is defined as any mobile device that is controlled by a means that
does not restrict its motion with an origin external to the device. This is often a radio control
device, cable between control and vehicle or an infrared or Bluetooth controller. A remote
control vehicle(Also known as RCV) is always controlled by a human and takes no positive
action autonomously. It is vital that a vehicle should be capable of proceeding accurately to a
target area; maneuvering within that area to fulfill its mission and returning equally
accurately and safely to base.
In this project we are using Bluetooth wireless technology to control our robot car which is a
very simple communication system. The remote in this project is an android device which has
Bluetooth feature built in. The user has to install an application on his/her mobile and turn on
the Bluetooth in the mobile phone. User can perform various actions like moving Forward,
Backward, move Left and move right using commands that are sent from the android mobile.
The Bluetooth is a serial communication medium through which we can connect two devices
wirelessly. Here we have used a Bluetooth module in our robot car which gets connected to
the phone‘s Bluetooth, that allows us to communicate and allows to take command over it.
The task of controlling the car is done by the Arduino UNO which houses the micro-
controller ATMEGA32. Arduino has played a major role in the robotic section and has made
it easier to convert digital and analog signal to physical movements. The project is Bluetooth
based because it gives us wider range of control and more efficiency. It also gives us the
advantage of changing the remote anytime, meaning that we can use any android devices
including phones, tablets, computers. Physical barriers like walls, doors, etc. do not effect in
controlling the car.
(1)
Bluetooth Technology
2) It also provides agreement at the next level up, where products have to agree on
when bits are sent, how many will be sent at a time and how the parties in a
conversation can be sure that the message received is the same as the message sent.
The master coordinates communication throughout the Piconet. It can send data to any of its
slaves and request data from them as well. Slaves are only allowed to transmit to and receive
from their master. They can’t talk to other slaves in the Piconet.
(3)
Analysis
The working of our remote controlled vehicle can be understood easily by observing the
block diagram shown below:
Here, the whole system is divided into four principal blocks viz Bluetooth block,
microcontroller block, and the motor driver block.
The Bluetooth block comprises of the Bluetooth module present in the mobile phone used
along with the Bluetooth module used in our robot car. The mobile phone consists of an
application that provides us an interface to send ASCII characters via Bluetooth which is
then received by the Bluetooth module on the robot car.
The microcontroller then receives the data from the Bluetooth module and then manipulates
the data received into series of digital outputs which run the motor driver section. The data
rate of communication is set to 9600 bauds per second. Two BO motors which run at 60 RPM
are used.
(4)
Design
The Arduino Uno microcontroller board(Fig.3) is based on the ATmega328P. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz
quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains
everything needed to support the microcontroller. It can be powered by simply connecting to
a computer with a USB cable or with a AC-to-DC adapter or battery to get started.
We have used Arduino because it is an open source device which can be programmed
through any operating system like Windows, Mac, Linux, etc. The language used is
understandable and easy. Changing of program is also very easy. Various shields and
modules that are easily connected to Arduino are available for various purpose like, if we
want to connect the Arduino to a network then a Wi-Fi shield is available. For controlling the
motor a motor shield is available, and for this project a Bluetooth module is used.
2)HC 05: HC‐05 module(Fig.4) is an easy to use Bluetooth SPP (Serial Port Protocol)
module, designed for transparent wireless serial connection setup. The HC-05 Bluetooth
Module can be used in a Master or Slave configuration, making it a great solution for
wireless communication. This serial port Bluetooth module is fully qualified Bluetooth
V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio
transceiver and baseband. It uses CSR Bluecore 04‐External single chip Bluetooth system
with CMOS technology and with AFH (Adaptive Frequency Hopping Feature).
(5)
Fig.3. Arduino Uno Fig.4. HC05 Bluetooth module
(6)
The HC-05 Bluetooth Module has 6 pins. They are as follows:
1)Enable: When enable is pulled low, the module is disabled which means the module will
not turn on and it fails to communicate.
4) Txd & Rxd: These two pins acts as an UART interface for communication
5) State: It acts as a status indicator. When the module is not connected to / paired with any
other Bluetooth device, signal goes Low. At this low state, the led flashes continuously which
denotes that the module is not paired with other device. When this module is connected
to/paired with any other Bluetooth device, the signal goes High. At this high state, the led
blinks with a constant delay say for example 2s delay which indicates that the module is
paired.
6) Button Switch: This is used to switch the module into AT command mode. To enable AT
command mode, press the button switch for a second. With the help of AT commands, the
user can change the parameters of this module but only when the module is not paired with
any other BT device. If the module is connected to any other Bluetooth device, it starts to
communicate with that device and fails to work in AT command mode.
3)L293D motor driver: L293D is a typical Motor driver IC which allows DC motor to drive
on either direction. L293D is a 16-pin IC which can control a set of two DC motors
simultaneously in any direction. It means that you can control two DC motors with a single
L293D IC.
In a single L293D chip there are two H-Bridge circuit inside the IC which can rotate two dc
motor independently. Due its size it is very much used in robotic application for controlling
DC motors. Given below is the pin diagram of a L293D motor controller.
(7)
There are two Enable pins on l293d. Pin 1 and pin 9. For driving the motor with left H-bridge
you need to enable pin 1 to high. And for right H-Bridge you need to make the pin 9 to high.
If anyone of the either pin1 or pin9 goes low then the motor in the corresponding section will
suspend working. It’s like a switch. Pin no 2, 7, 9 and 11 are used as logic inputs and 4, 5, 12
and 13 are ground.
4) Motors:
the motors used are geared L-shaped battery operated dc motors. Gears reduce the speed of
the vehicle but increase its torque. This is known as gear reduction. Gear Ratio of motors
used is 150:1 and run at 60RPM. The setup assembly helps in increasing the torque and
reducing the motor speed.
Software:
Motor driver Logic: The motor driver IC used to control the motors is given the following
logic inputs through arduino board:
µC Output L293D Forward Reverse Left Right Axis1 Axis2
input
12 2 LOW HIGH LOW LOW HIGH LOW
11 7 HIGH LOW LOW HIGH LOW HIGH
9 15 LOW HIGH LOW LOW LOW HIGH
10 10 HIGH LOW HIGH LOW HIGH LOW
Table.1
(8)
Programs written using Arduino Software (IDE) are called sketches. These sketches are
written in the text editor and are saved with the file extension .ino. The editor has features for
cutting/pasting and for searching/replacing text. The message area gives feedback while
saving and exporting and also displays errors. The console displays text output by the
Arduino Software (IDE), including complete error messages and other information. The
bottom right hand corner of the window displays the configured board and serial port. The
toolbar buttons allow you to verify and upload programs, create, open, and save sketches, and
open the serial monitor.
Verify:
Checks your code for errors compiling it.
Upload:
Compiles your code and uploads it to the configured board.
New:
Creates a new sketch.
Open:
Presents a menu of all the sketches in your sketchbook. Clicking one will open it
within the current window overwriting its content.
Save:
Saves your sketch.
Serial Monitor:
Opens the serial monitor.
Additional commands are found within the five menus: File, Edit, Sketch, Tools, Help. The
menus are context sensitive, which means only those items relevant to the work currently
being carried out are available.
Mobile app: Here we have used Arduino Bluetooth controller application(Fig.7). It provides
a Nintendo joystick style interface which is highly convenient for controlling robot cars
(9)
and similar projects that utilize Bluetooth as their communication Technology. The buttons
can be assigned ASCII Characters that can be sent with the button pressed.
In the figure shown above, the values assigned to the different buttons on the joystick
interface are shown. When a button is pressed the respective ASCII character assigned to the
button is sent by the mobile phone via Bluetooth.
Arduino sketch:
We have used hardware serial in this project in order to set up communication between the
Bluetooth module and Arduino board. The ASCII characters received by the Bluetooth
module are fed to the Arduino board using Serial communication. In the sketch the received
data can be used with the help of Serial.read() function. Data received from Serial.read() is
assigned to a variable which is then used to be compared with different values in series of if
loops. The if loops then call different functions that are used to drive the vehicle Forward,
Backward, Left or Right. the following is the flow chart of our arduino sketch.
(10)
Fig.8. Sketch Flowchart
(11)
Implementation:
The project is implemented on beadboard and the breadboard itself is used as the chassis for
the robot car as shown in Fig.11. The Bluetooth module HC05 is connected to the Arduino
board through simple single strand wires. The transmission pin of the Bluetooth module is
connected to the receiver pin of Arduino and the receiver pin of the Bluetooth module is
connected to the transmission pin of the Arduino. The Digital output pins 9, 10, 11 and 12 of
Arduino board are connected to the pins 4, 10, 7 and 2 of the L298N motor driver IC
respectively.
Two rechargeable batteries as supply is used which is connected to motor driver and Arduino
respectively. When the circuit is energized, we will have to first pair the android phone with
the Bluetooth module through the phones Bluetooth setting. The default password of the
Bluetooth module will be 1234. Once the phone gets paired open the application "Bluetooth
Remote Controller" which we can downloaded from Google play store. After connecting the
mobile to HC05, four options will appear on the application-Controller mode, Switch mode,
Dimmer mode and Terminal mode. We have to select the Controller mode from it. The
controller mode will provide us a joystick interface. We will send ASCII values from the
application to the Bluetooth module. As the user presses any control buttons, the controller
will run programs move forward, backward, right, left, depending on the data sent by the
mobile and the car moves likewise. The Arduino also stores the program in its memory so it
does not require re uploading of Program. The IN1, IN2, IN3 and IN4 are the inputs for the
motor driver that receives command from the Arduino for the two motors respectively. The
motor driver should be grounded with the Arduino ground pin(GND). The motor driver
requires minimum of 6v and above to run, any voltage below 6v the motor remains off.The
RXD pin of the Bluetooth module is for receiving commands from the Android devices and
sends to Arduino through this pin and the TXD is for transmitting or sending datesor
information‘s It is supplied with a 5v dc source from the arduino 5v pin. The main part of the
above circuit diagram is arduino UNO. The power supply section is very Important. It should
provide constant voltage to the devices for successful working of the project.
(12)
Fig.10. Schematic diagram of Bluetooth controlled car
(13)
Fig.11 Breadboard layout of Bluetooth controlled robot car
(14)
Expenditure
The Arduino is an open source device that has been the brain for numerous projects. The
Arduino has everything that is required by the user which includes its inbuilt converter, i/o
pins etc. With the combination of Arduino, and the Bluetooth Shield we can control over
many other things, like home Lightings, air conditioner and many more through our cell
phones. The Arduino can also contribute at large for the Smart Home system. By doing this
Project we found out a lot about the Arduino, and how it has made us easier to convert digital
signals into physical movements. One more advantage of Arduino is that once a program is
burned we don‘t need to worry about the program getting erased as long as it is not RESET.
Arduino has also over all other microcontroller because of its efficiency and user friendly
property.
(15)
References
Books:
2) 30 Arduino Projects for the Evil Genius™ Simon Monk, McGraw-Hill Companies Inc
1) https://www.instructables.com/
2) https://circuitdigest.com/
3) https://nptel.ac.in/
(16)
Source code
char str[2],i;
void axis()
{
digitalWrite(m11, LOW);
digitalWrite(m12, HIGH);
digitalWrite(m21, HIGH);
digitalWrite(m22, LOW);
}
void axis2()
{
digitalWrite(m11, HIGH);
digitalWrite(m12, LOW);
digitalWrite(m21, LOW);
digitalWrite(m22, HIGH);
}
void forward()
{
digitalWrite(m11, HIGH);
digitalWrite(m12, LOW);
digitalWrite(m21, HIGH);
digitalWrite(m22, LOW);
}
void backward()
{
digitalWrite(m11, LOW);
digitalWrite(m12, HIGH);
digitalWrite(m21, LOW);
digitalWrite(m22, HIGH);
}
void left()
{
digitalWrite(m11, LOW);
digitalWrite(m12, LOW);
delay(100);
digitalWrite(m21, HIGH);
digitalWrite(m22, LOW);
}
void right()
{
digitalWrite(m11, HIGH);
(17)
digitalWrite(m12, LOW);
delay(100);
digitalWrite(m21, LOW);
digitalWrite(m22, LOW);
}
void Stop()
{
digitalWrite(m11, LOW);
digitalWrite(m12, LOW);
digitalWrite(m21, LOW);
digitalWrite(m22, LOW);
}
void setup()
{
Serial.begin(9600);
pinMode(m11, OUTPUT);
pinMode(m12, OUTPUT);
pinMode(m21, OUTPUT);
pinMode(m22, OUTPUT);
}
void loop()
{
while(Serial.available())
{
char ch=Serial.read();
str[i++]=ch;
if(str[i-1]=='1')
{
Serial.println("Forward");
forward();
i=0;
}
else if(str[i-1]=='2')
{
Serial.println("Left");
right();
i=0;
}
else if(str[i-1]=='3')
{
Serial.println("Right");
left();
i=0;
}
else if(str[i-1]=='4')
{
Serial.println("Backward");
(18)
backward();
i=0;
}
else if(str[i-1]=='5')
{
Serial.println("Stop");
Stop();
i=0;
}
else if(str[i-1]=='6')
{
Serial.println("axis");
axis();
i=0;
}
else if(str[i-1]=='7')
{
Serial.println("axis2");
axis2();
i=0;
}
delay(100);
}
}
(19)