Tuesday 11 November 2014

Bluetooth Operated Robot

         Here is a simple robotic vehicle that can be operated by using Bluetooth connection. The Bluetooth module that is used here is HC-05 Master/Slave module. The robot can be controlled using both Android smart phones and Computers via a serial terminal.

         For computers we can use Teraterm, Putty, etc and for Android phones we can use Blueterm or a dedicated Robot Control App (Several such apps are available in PlayStore).


Components Required:

      1.      Arduino Compatible Board – GR Sakura
      2.       HC-05 Bluetooth module
            3.       L293D Motor Driver
      4.       DC motors and Wheels
      5.       Battery


Working:

                Connect power supply to the circuit. Open the serial terminal software/app after turning On the Bluetooth – Teraterm/Putty in terms of computer or Blueterm in terms of Android phones. Search for the HC-05 device and pair with it by giving the default password of HC-05 ‘1234’. Below are the control signals,
                                                                8 – Move Forward
                                                                4 – Turn Left
                                                                6 – Turn Right
                                                                2 – Move Back
                                                                5 – Stop


Note – You can change the control signals as you wish by changing the code

Code Structure:

#include 'rxduino.h'
#include 'iodefine_gcc63n.h'
char a;

int main()
{
                Serial.begin(115200,SCI_SCI0P2x);
                delay(1000);
                /* give the pin details here that controls the dc motors via L293D */
while(1)
                {
                                if(Serial.available())
                                {
                                                a=Serial.read();
                                                if(a=='8')
                                                {
                                                                /* give the pin configuration to turn on the dc motors such that the robot moves forward */
             }
                                                if(a=='4')
                                                {
                                                                /* give the pin configuration to turn on the dc motors such that the robot turns left */
            }
                                                if(a=='6')
                                                {
                                                                /* give the pin configuration to turn on the dc motors such that the robot turns right */
            }
                                                if(a=='2')
                                                {
                                                                /* give the pin configuration to turn on the dc motors such that the robot moves backward */
                                                 }
                                                if(a=='5')
                                                {
                                                                /* give the pin configuration to turn off the dc motors such that the robot stops */
                                                }
                                }
                }
}
                                      

Video Demo:



                                                                
For info on L293D - Driving DC motors
For info on HC-05 - Interfacing HC-05