Wednesday, November 12, 2014

Arduino and Android control Bluetooth Robot

This post is about making a simple Android control Arduino Bot

Required Components:

Arduino Uno 
Bluetooth Module
L293D Motor Driver
2x Gear Motor
1x Chasis
A breadboard 
Connecting wires








Arduino Program
_________________________________________________________________________________

#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); //TX, RX respetively
String readdata;

void setup() {
 BT.begin(9600);
 Serial.begin(9600);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);

}
//-----------------------------------------------------------------------// 
void loop() {
  while (BT.available()){  //Check if there is an available byte to read
  delay(10); //Delay added to make thing stable
  char c = BT.read(); //Conduct a serial read
  readdata += c; //build the string- "forward", "reverse", "left" and "right"
  } 
  if (readdata.length() > 0) {
    Serial.println(readdata);

  if(readdata == "forward")
  {
    digitalWrite(3, HIGH);
    digitalWrite (4, HIGH);
    digitalWrite(5,LOW);
    digitalWrite(6,LOW);
    delay(100);
  }

  else if(readdata == "reverse")
  {
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, HIGH);
    digitalWrite(6,HIGH);
    delay(100);
  }

  else if (readdata == "right")
  {
    digitalWrite (3,HIGH);
    digitalWrite (4,LOW);
    digitalWrite (5,LOW);
    digitalWrite (6,LOW);
    delay (100);
   
  }

 else if ( readdata == "left")
 {
   digitalWrite (3, LOW);
   digitalWrite (4, HIGH);
   digitalWrite (5, LOW);
   digitalWrite (6, LOW);
   delay (100);
 }

 else if (readdata == "stop")
 {
   digitalWrite (3, LOW);
   digitalWrite (4, LOW);
   digitalWrite (5, LOW);
   digitalWrite (6, LOW);
   delay (100);
 }

  


readdata="";}} //Reset the variable

_________________________________________________________________________________



check the video to know how to create android app using MIT app inventor


Download Android App from here:Android App


29 comments:

  1. Did you use a bluetooth module? I would like to know which one. I am new to this.

    ReplyDelete
  2. the application is not able to send the string to the bluetooth module from the apk file
    it showing an error message like "broken pipe ERROR 567"

    ReplyDelete
  3. La tecnologia esta representada en todo y cualquier cosa que vemos o utilizamos frecuentemente,Con ejemplo de algunos restaurantes que usan innovadores prototipos llamados
    Localizadores de Meseros son basados en redes inal√°mbricas.

    ReplyDelete
  4. can you give the motors which using the your project link




















    ReplyDelete
  5. can you please tell the type of motors used... and what to do if we want to connect 4 motors to it?... pls help

    ReplyDelete
  6. i tried your code but the msg:
    avrdude: stk500_rec(): programar is not responding
    avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

    What i have to do ?

    ReplyDelete
  7. hi bro help me plz,i want to make accelometer control app for this robot.plz make a tutorial for me.plz plz it's urgent.

    ReplyDelete
  8. hey the bluetooth module needs only 3.3v.here you are using 5v it may fry the module.please reply please....

    ReplyDelete
  9. lo schema del robot e uguale allo skech?

    ReplyDelete
  10. sir we have studied your video to make an android app and we have also implemented.But we want somewhat difference in our app and that is that
    in this app when we click on forward button robot starts moving in forward direction and same for all other directions.But we want that when user click on forward button so until the forward button is clicked robot will move forward but as user stops pressing the button robot gets stop.Kindly help us. We will be very thankful to you.

    ReplyDelete
  11. what is the maximum voltage for the circuit given

    we need the robot to last for 2 hours please reply as fast as possible
    sir.

    ReplyDelete
  12. Hi Sir/ Madam,
    I Like this page. May I can copy this page to translate into VietNames to support about this project?

    ReplyDelete
  13. where can i learn the arduino programming?

    ReplyDelete
  14. nice but can u explain the coding part of transmission and reception of data from bluetooth

    ReplyDelete
  15. can you give me the mit app inventor .aia file so i can make changes please

    ReplyDelete
  16. The serial monitor from the pc doesn't read what I'm sending from the app. And whenever I send a command my robot doesn't do anything at all. A little help here please?

    ReplyDelete
  17. thnx it is really cool.... it was useful

    ReplyDelete