Posted on

Arduino Bot Android Remote Control II

FRLIDM5HR0ARVE8.MEDIUM

When I bought my Complubot one year ago, I didn’t thought how fun I could be, I’ve practice with follow line vehicle, brush car, but when I read I read the article on instructables related to bluethooth rc, I began to think it would be fun to mix, android and arduino programs. First I thought to order a hc-06 interface, it took a few days to come because I have not much time, I installed and made operational tests with my PC. To try to compile and install the program from the android sdk I take more time. As I was anxious, tried a Google Play application, easy to install and use.

Step 1: Mounting and connecting

As shown on the picture, the robot uses servo modified for use in continuous movement. HC-06 is connected to +5 V, gnd, pin 0 from Arduino to HC-06 Tx and pin 1 from Arduino to HC-06 Rx, note that when sending program to Arduino disconnect HC-06 due it used same serial port.

FCR1BBUHR0ARVC0.MEDIUM FMZ606QHR0ARWEY.LARGE FI99CISHR0ARVDI.MEDIUM

Step 2: Programming

/*
Arduino driver for Android app remote control.
This sketch listens to instructions on the Serial port
then activates motors as required
Then sends back confirmation to the app
*/
#include 
#define derechoParada 72
#define izquierdoParada 73
#define derechoAdelante 10
#define izquierdoAdelante 100
#define derechoAtras 90
#define izquierdoAtras 50

Servo derecho;
Servo izquierdo;

void setup() {

derecho.attach(10);
izquierdo.attach(11);
derecho.write(derechoParada);
izquierdo.write(izquierdoParada);
Serial.begin(9600);
}

void loop() {

// see if there's incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
int incomingByte = Serial.read();

// action depending on the instruction
// as well as sending a confirmation back to the app
switch (incomingByte) {
  case 'F':
    derecho.write(derechoAdelante);
    izquierdo.write(izquierdoAdelante);
    Serial.println("Going forward");
    delay(100);
  break;
case 'R':
derecho.write(derechoParada);
izquierdo.write(izquierdoAdelante);
delay(100);
break;
case 'L':
derecho.write(derechoAdelante);
izquierdo.write(izquierdoParada);
Serial.println("Turning left");
delay(100);
break;
case 'B':
derecho.write(derechoAtras);
izquierdo.write(izquierdoAtras);
Serial.println("Going backwards");
delay(100);
break;
case 'S':
derecho.write(derechoParada);
izquierdo.write(izquierdoParada);
Serial.println("Stopping");
delay(100);
break;
default:
// if nothing matches, do nothing
break;
}
}
}

Step 3: Install Arduino Bluetooth Controller from Google Play

FINVTYYHR0ARVEE.MEDIUM

All application settings and commands are permanently stored and can be accessed and modified any time according to your needs .

Step 4: Final comments

The application have some adds when finish using it but it is not a problem.

FFB15OEHR0ARY31.MEDIUM

Complubot is a robot school in Alcala de Henares (Madrid) where children learn to program and a lot of things related to Arduino bot. I could get the 3D printed robot, thanks to them

Source: http://www.instructables.com/id/Arduino-bot-Android-remote-control-II/?ALLSTEPS