Tuesday, 13 May 2014

Bluetooth controlled robot using ARDUINO

This article helps you to make a robot that can be controlled from your android powered mobile through Bluetooth.



 HC-05:

This Bluetooth module works on SPP (serial port profile). It establishes a serial communication(UART) between your android mobile and microcontroller.

This module works in two modes:
1) AT mode
2)COM mode

AT mode:

In AT mode you can directly connect the module to your computer hyper terminal or any other serial gate way through DB9 serial port through MAX232 circuit (or you can use any USB to UART gateways like FT232and configure through AT commands. set the baud rate "38400"
some example commands:

AT    <enter>   it gives the response OK continuously so press <enter> again to stop

AT+NAME?  <enter> it displays the name of Bluetooth module

AT+NAME=new_name  <enter> changes module name to "new_name"

AT+PSWD?  <enter> displays password to enter while pairing with this device

AT+PSWD=4321 changes the password to 4321 ( only 4 digit number is accepted as password )

for more info regarding AT commands refer to the data sheet.

COM mode:
this is the mode that to be set when interfacing with a microcontroller through UART.

In this project i'm using an Arduino MEGA 2560 and a Bluetooth shield from Robogenesis

To drive the DC motors i'm using L293D.

CIRCUIT DIAGRAM:



arduino code:

//---------------------------------------------------
//--------------- code starts-------------------------
//---------------------------------------------------
unsigned char blue_data;
void setup()
{
  Serial.begin(9600);// set up serial communications with 9600 baud rate

  pinMode(7, OUTPUT);//motor 1a
  pinMode(6, OUTPUT);//motor 1b
  pinMode(5, OUTPUT);//motor 2a
  pinMode(4, OUTPUT);//motor 2b
digitalWrite(7,LOW);
digitalWrite(6,LOW);
digitalWrite(5,LOW);
digitalWrite(4,LOW);
}

void loop()
{
   if (Serial.available() > 0)
  {
    blue_data = Serial.read();// get incoming byte from bluetooth
          if(blue_data=='F' )//forword
           {
            digitalWrite(7,HIGH);digitalWrite(6,LOW);digitalWrite(5,HIGH);digitalWrite(4,LOW);
           }
  else if(blue_data=='B' )//backword
           {
            digitalWrite(7,LOW);digitalWrite(6,HIGH);digitalWrite(5,LOW);digitalWrite(4,HIGH);
           }
  else  if(blue_data=='L' )//left turn
           {
            digitalWrite(7,LOW);digitalWrite(6,HIGH);digitalWrite(5,HIGH);digitalWrite(4,LOW);
           }
  else  if(blue_data=='R' )// right turn
           {
            digitalWrite(7,HIGH);digitalWrite(6,LOW);digitalWrite(5,LOW);digitalWrite(4,HIGH);
           }
   else if(blue_data=='S' )// stop
           {
             digitalWrite(7,LOW);digitalWrite(6,LOW);digitalWrite(5,LOW);digitalWrite(4,LOW);
           }
   
  }

}

android app:

Description
****This application is designed to be used with a MODIFIED RC car. You have to replace the car's stock control circuit with a micro controller. This involves programming. The application will not work with a brand new, out of the box RC car. Please visit the website before you download the application.
The application allows you to control an Arduino based RC car over Bluetooth. This is done using a Bluetooth enabled Android phone. Visit this sitehttps://sites.google.com/site/bluetoothrccar/ for the Arduino code and control circuit. The app lets you control the car with either buttons or the phone's accelerometer. A slider bar allows you to control your car's velocity if the car's control circuit has this feature. There are also two buttons for front and back lights. A flashing light lets you know when the phone is connected to the car, and arrows light up letting you know the car's driving direction.



WORKING VIDEO


3 comments:

Radhey Singh said...
This comment has been removed by a blog administrator.
Keyser Soze said...

where can i get that app

VAMSI DANDA said...

Play store

Post a Comment