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


28 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. can you give the motors which using the your project link




















    ReplyDelete
  4. 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
  5. 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
  6. 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
  7. hey the bluetooth module needs only 3.3v.here you are using 5v it may fry the module.please reply please....

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

    ReplyDelete
  9. 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
  10. 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
  11. Hi Sir/ Madam,
    I Like this page. May I can copy this page to translate into VietNames to support about this project?

    ReplyDelete
  12. where can i learn the arduino programming?

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

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

    ReplyDelete
  15. 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
  16. thnx it is really cool.... it was useful

    ReplyDelete