Aniket Mindhe
Created March 20, 2020

Gesture Controlled Robot Using Arduino & Android-App

A simple 2WD-Robot which can be controlled by just tilting your Android-device in desired direction.

IntermediateFull instructions provided2 hours1
Gesture Controlled Robot Using Arduino & Android-App

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
Battery - 18650 - 7800mAh- 3.7V
×1
Battery Holder, 18650 x 2
Battery Holder, 18650 x 2
×1
9V battery (generic)
9V battery (generic)
×1
9V to Barrel Jack Connector
9V to Barrel Jack Connector
×1
BO Motor - Straight - 300rpm
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Ball Caster Wheel
×1
Chasis - Eg. Plastic Box Cover, Acrylic Sheet, Metal Sheet
×1
Toggle Switch, (Off)-On
Toggle Switch, (Off)-On
×1

Software apps and online services

Arduino IDE
Arduino IDE
Gesture Control App

Hand tools and fabrication machines

Tape, Double Sided
Tape, Double Sided
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Gesture Controlled Robot Using Arduino & Android-App

Connect them and get going !

Code

Gesture Controlled Robot Using Arduino & Android-App

C/C++
Download/Copy-Paste and compile+upload it using Arduino IDE.
int x,y,tempX,tempY; // Variables To Store X-Y Coordinates
const int r1=13,r2=12,l1=11,l2=10; // Motor Control Pins
void setup() 
{
  Serial.begin(9600); // Set Baud-Rate At 9600
  pinMode(r1,OUTPUT); // Set Motor Control Pins As O/P
  pinMode(r2,OUTPUT);
  pinMode(l1,OUTPUT);
  pinMode(l2,OUTPUT); 
}
void loop() 
{
 while(Serial.available()>0)
  {
   x= Serial.parseInt(); // Capture X Coordinate
   y= Serial.parseInt(); // Capture Y Coordinate
   tempX = map(x,-100,100,0,200); // Map Value Of X Coordinate
   tempY = map(y,-100,100,0,200); // Map Value Of Y Coordinate
   if(tempX<90)
   {
    if (tempY>90 && tempY<110)
    {
       foward(); // Move Forward
    } 
   }
   
   if(tempX>110)
   {
    if (tempY>90 && tempY<110)
    {
       reverse(); // Move Backward
    } 
   }
   
   if(tempX>90 && tempX<110)
   {
    if (tempY>110)
    {
     left(); // Turn Left
    } 
    else if (tempY<90)
    {
     right() ; // Turn Right
    }
   }

   if (tempX>90 && tempX<110)
   {
    if (tempY>90 && tempY<110)
    {
    brake(); // Stop
   }
   }
  }
}
void foward ()
{
 digitalWrite(r2,HIGH); 
 digitalWrite(r1,LOW);
 digitalWrite(l2,HIGH); 
 digitalWrite(l1,LOW);
}
void reverse()
{
 digitalWrite(r2,LOW); 
 digitalWrite(r1,HIGH);
 digitalWrite(l2,LOW); 
 digitalWrite(l1,HIGH);
}
void right()
{
 digitalWrite(r2,LOW); 
 digitalWrite(r1,HIGH);
 digitalWrite(l2,HIGH); 
 digitalWrite(l1,LOW);
}
void left()
{
 digitalWrite(r2,HIGH); 
 digitalWrite(r1,LOW);
 digitalWrite(l2,LOW); 
 digitalWrite(l1,HIGH);
}
void brake()
{
 digitalWrite(r2,LOW); 
 digitalWrite(r1,LOW);
 digitalWrite(l2,LOW); 
 digitalWrite(l1,LOW);
}

Credits

Aniket Mindhe

Aniket Mindhe

6 projects • 0 followers
Undergrad Electronics Engineering Student at D.J Sanghvi C.O.E.-Mumbai

Comments