Satyavrat Wagle
Published

IoT Dune Buggy - Control it from Anywhere!

Can a guy sitting in Asia control a robot in Europe? Well, now he can! Control your robot wherever in the world you might be!

IntermediateFull instructions provided18 hours15,213
IoT Dune Buggy - Control it from Anywhere!

Things used in this project

Hardware components

Arduino Yun
Arduino Yun
×1
Dual H-Bridge motor drivers L293D
Texas Instruments Dual H-Bridge motor drivers L293D
×1
DC motor (generic)
×2
IR transmitter (generic)
×4
IR receiver (generic)
×2
Temperature Sensor
Temperature Sensor
×1
Photo resistor
Photo resistor
×1
Linear Regulator (7805)
Linear Regulator (7805)
×1
Android device
Android device
×1

Software apps and online services

MIT App Inventor
MIT App Inventor
Dweet.io

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Digital Multimeter

Story

Read more

Schematics

Arduino Yun Buggy Configuration

Use this schematic for a fully loaded Dune Buggy with Obstacle Detection, Temperature and Ambient Light sensing

Code

IoT Dune Buggy - Full Code

Arduino
Use this code for complete execution of the dune buggy along with automatic obstacle detection.
PLEASE NOTE : THIS CODE DOES NOT CONTAIN CODE FOR UPLOAD OF TEMPERATURE AND LIGHT INTENSITY DATA TO CLOUD
#include <Bridge.h>
#include <HttpClient.h>

int ctr=0;
char buff[100];
int x=0;
String devicename = "YOUR DEVICE NAME HERE";

void setup() {
  pinMode(9, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(13, OUTPUT);  
  digitalWrite(13, LOW);
  Bridge.begin(115200);
  digitalWrite(13, HIGH); 

}

void loop() {
  
  int right = analogRead(A1);
  int left = analogRead(A0);
  
  if(right<500 && left<500)
  {
    digitalWrite(13, HIGH);
    back();
    delay(500);
    ttleft(); 
    delay(400);
    digitalWrite(13, LOW);
  }
  
  else if(right>500 && left<500)
  {
    ttright();
  }
  
  else if(right<500 && left>500)
  {
    ttleft();
  }
  else{
    
          HttpClient client;
          client.get("http://dweet.io/get/latest/dweet/for/"+devicename);
          while (client.available()) {
            char c = client.read();
            if(c=='{')
            {
              ctr++;
            }
            if(c=='}')
            {
              ctr--;
            }
            if(ctr==3)
            {
            buff[x]=c;
            x++;
            }
          }
          ctr=0;
          x=0;
          
          String val = String(buff);
          String mid = val.substring(2,6);
          int chk = mid.toInt();
  
          if(chk==0000)
          {
               wait(); 
               digitalWrite(13, HIGH);
          }
          
          if(chk==0001)
          {
               fwd();
               digitalWrite(13, LOW);
          }
          
          if(chk==0002)
          {
               back();
               digitalWrite(13, LOW);
          }
          
          if(chk==0003)
          {
               ttleft();
               delay(360);
               wait();
               digitalWrite(13, LOW);
          }
          
          if(chk==0004)
          {
               ttright();
               delay(360);
               wait();
               digitalWrite(13, LOW);
          }

          
          delay(1000);
  }

}

void fwd()
{
 digitalWrite(9, HIGH);
 digitalWrite(12, LOW); 
 digitalWrite(11, HIGH);
 digitalWrite(10, LOW); 
}

void back()
{
 digitalWrite(9, LOW);
 digitalWrite(12, HIGH); 
 digitalWrite(11, LOW);
 digitalWrite(10, HIGH); 
}

void ttleft()
{
  digitalWrite(9, LOW);   
  digitalWrite(12, HIGH);  
  digitalWrite(11, HIGH);  
  digitalWrite(10, LOW);   
}

void ttright()
{
  digitalWrite(9, HIGH);   
  digitalWrite(12, LOW);  
  digitalWrite(11, LOW);  
  digitalWrite(10, HIGH);   
}

void right()
{
  digitalWrite(9, HIGH);   
  digitalWrite(12, LOW);  
  digitalWrite(11, LOW);  
  digitalWrite(10, LOW);   
}

void left()
{
  digitalWrite(9, LOW);   
  digitalWrite(12, LOW);  
  digitalWrite(11, HIGH);  
  digitalWrite(10, LOW);   
}

void wait()
{
  digitalWrite(9, LOW);   
  digitalWrite(12, LOW);  
  digitalWrite(11, LOW);  
  digitalWrite(10, LOW);   
}

RemoteControl.aia

Java
This is the Android App which is used for controlling the buggy remotely. Please use MIT App Inventor to build it and save it as an APK
No preview (download only).

Credits

Satyavrat Wagle

Satyavrat Wagle

6 projects • 63 followers
I have an active interest in IoT, Wireless Sensor Networks, Single Board Computing Implementations, Embedded Systems, and Robotics.

Comments