Saturday, November 8, 2014

Arduino and Android Direction control 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 readdirection;

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
  readdirection += c; //build the string- "forward", "reverse", "left" and "right"
  } 
  if (readdirection.length() > 0) {
    Serial.println(readdirection);

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

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

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

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

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

  


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

_________________________________________________________________________________


Download the Android App From here: Android App

This robot work same as the voice control robot, you can refer to  link below for more details




4 comments:

  1. Hi
    can i use this app to control ARDUINO UNO based robot which uses continuous rotational servo motors
    thanks

    ReplyDelete
  2. can you share app inventor accelerometer tutorial

    ReplyDelete
  3. can you share app inventor accelerometer tutorial

    ReplyDelete
  4. Is there any video to teach how to make the app above?

    ReplyDelete