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.


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.


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

void loop()
   if (Serial.available() > 0)
    blue_data = Serial.read();// get incoming byte from bluetooth
          if(blue_data=='F' )//forword
  else if(blue_data=='B' )//backword
  else  if(blue_data=='L' )//left turn
  else  if(blue_data=='R' )// right turn
   else if(blue_data=='S' )// stop


android app:

****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.