Thursday, 29 January 2015


Bluetooth Controlled Robot using Android

Hello readers, in this project I will demonstrate the concepts that will help you to build your own Bluetooth controlled robot using your own designed android application. Bluetooth technology is very popular these days and almost all smart phones have this feature. In this work I am designing a robot which will have a Bluetooth module for communication with the smart phone. HC05 is one of the most popular serial Bluetooth module available and it can be directly interfaced with any microcontroller. Here I am using 8051 microcontroller which is interfaced with HC05 bluetooth module and L293D motor driver IC. The block diagram of the project is shown below-

HC05 Bluetooth module


Bluetooth protocol: Bluetooth Specification v2.0+EDR
Frequency: 2.4GHz ISM band
Power supply: +3.3VDC 50mA                                                                             
Modulation: GFSK (Gaussian Frequency Shift Keying)
Emission power: 4dBm, Class 2
Sensitivity: -84dBm at 0.1% BER
Speed: Asynchronous: 2.1Mbps (Max) / 160 kbps Synchronous: 1Mbps/1Mbps
Security: Authentication and encryption
Profiles: Bluetooth serial port
Power supply: +3.3VDC 50mA
Working temperature: -20 +75 Centigrade
Dimension: 26.9mm x 13mm x 2.2 mm

The serial o/p of the Bluetooth module will be received by 8051 microcontroller which has been programmed to receive the data serially. The received data from the Bluetooth module is compared with the predefined data by 8051 microcontroller and if the match is found then the required action will be performed.

If serially ‘1’ is received then the robot will move forward

If serially ‘2’ is received then the robot will move backward

If serially ‘3’ is received then the robot will move towards right

If serially ‘4’ is received then the robot will move towards left

If serially ‘5’ is received then the robot will stop

 L293D Motor Driver IC

It is one of the most widely used dc motor driver IC and is available in 16 pin DIP package. Motor needs high current i/p signal which cannot be provided by microcontroller directly and so in between microcontroller and dc motor a motor driver IC is required for converting a low current control signal into a high current signal which can drive the dc motor. L293D is a dual H bridge IC and it performs the job of current amplification. Two dc motors can be easily driven in any direction using L293D IC. It has two H bridge’s which works independently to control the dc motor and that’s why the name dual H bridge is given to it. It is a known fact that if it is required to change the direction of rotation of dc motor one has to change the direction of flow of current and this can be easily achieved by reversing the polarity of applied voltage. Fig. below shows the H bridge using switches-

Fig. H bridge using switches

The following situations arise-

If switches S1, S4 are closed and S2, S3 are open then the motor will rotate in clock wise direction.

If S2, S3 are closed and S1, S4 are open then the motor will rotate in the anti clockwise direction.

If S2, S4 are closed and S1, S3 are open or vice versa the it will create a direct path b/w power supply and ground leading to short circuit condition and this must be avoided.

If  S1, S2 are closed and S3, S4 are open or vice versa then there will be no difference in potential across the two ends of the motor and so it will not rotate.

The pin diagram of L293D motor driver IC is shown below-

IN1, IN2, IN3, IN4 are connected to microcontroller, motor M1 is connected b/w pin number 3 and 6 and similarly the other motor M2 is connected b/w pin number 11 and 14. EN1 and EN2 are two enable pins for the buffers which are there inside the IC. To enable the buffers EN1 and EN2 are required to be connected to +5V. Vs is motor supply voltage pin and this is required to be connected to the voltage at which motors are required to be operate, if it is required to operate the motors on 12V  then this pin must be connected to the +12V power supply. Pin numbers 4, 5, 12, 13 are connected to Ground. Pin number 16 is Vss and is connected to +5V supply.

In this work IN1 is connected to P2.0, IN2 is connected to P2.1, IN3 is connected to P2.2 and IN4 is connected to P2.3 of the 8051 microcontroller.

Circuit Diagram-


The code for the robot contol is given below-

// define the o/p ports to be connected to L293D
sbit op1=P2^0;
sbit op2=P2^1;
sbit op3=P2^2;
sbit op4=P2^3;
// temp is a variable used here for storing the serially received data byte
unsigned char temp;
//main program begins from here
void main()
// initialization commands for serial communication

// infinite loop starts from this point for serial data reception

while(RI==0); // wait until some data byte is received serially
temp=SBUF;     // store the data byte in the temporary variable
RI=0;                 // clear te RI flag for next data byte reception

// now put comparative statements using if loop

if(temp=='1')  // move the robot forward

if(temp=='2') // move the robot backward

if(temp=='3') // move the robot towards right

if(temp=='4') // move the robot towards left

if(temp=='5') // stop the robot

Android App for controlling the Robot

The App is designed using MIT App Inventor.

The screen shot of the MIT app inventor designer window is shown below-

In MIT app inventors block window the entire logic is designed.

To set up the Bluetooth connection he following blocks are required to be connected-

To send ‘1’ on button 1 click the following blocks are connected-

Similarly one can connect the blocks for the actions that are required to be performed on the click of the remaining buttons.

The app is tested in the emulator as well as on the hardware, the screen shot of the emulator is shown below-


1.The distance within which the robot can be controlled is around 10 meters and this is because of the range 

    limitation of the bluetooth device.

2. The bluetooth of the mobile phone must be in the on condition and mobile phone must be paired up with 

    the HC05 bluetooth module before starting the android app for controlling the robot.

Thats it, Now arrange the required stuff and make your own bluetooth controlled robot using Android...

                                            Thanks for Reading

                                              UMESH DUTTA

No comments:

Post a Comment