Introduction: Very Simple to Create Arduino Bluetooth Spy Robot With Android RemoteControl App

Picture of Very Simple to Create Arduino Bluetooth Spy Robot With Android RemoteControl App

In this project you will see how simple mixture of different technologies and third-party apps allows to create a rather complex toy.

The robot does two things:

1. Arduino based spy robot moves according to commands delivered from Android RemoteControl app via bluetooth.

2. The robot transmits video via wifi throught a third party directly to RemoteControl Android app, which is very convenient since you manage the robot and see what is going on in one single Android app

But the key advantage is how simple it is to create such a spy robot

Step 1: Platform and Wirering

Picture of Platform and Wirering

The project iinludes:

1. Standard Turtle platform (with build-in battery module)
2. HC-06 Bluetooth module
3. Arduino Mega ADK (but any other Arduino is fine)
4. Motor shield to manage motors up to 2A
5. Android phone (on the second photo) which should be mounted in front of the robot. It serves as a camera
6. Android phone/tablet which will be used as a remote control using self-developed RemoteControl app

The project involves two flows of data: commands which manage the robot come from an Android app via bluetooth connection, which is established using HC-06, while video comes through a wifi connection

The project uses third-party IP Webcam app, which is installed on the phone. The video is tranferred to a RemoteControll app which is developed by myself using App Inventor. The RemoteControll app is installed on another Android device like phone or tablet. The RemoteControl app both receives video stream and send commands via bluetooth

Step 2: Arduino Code

#define CON_MOTOR1 0
#define CON_MOTOR2 0

// Motor shield uses four pins - 4, 5, 6, 7 to manage the motors

// 4 and 7 — for direction, 5 and 6 — for speed

#define SPEED_1 5
#define DIR_1 4
#define SPEED_2 6
#define DIR_2 7

// Shortcuts for possible robot movements

#define FORWARD 0
#define BACKWARD 1
#define LEFT 2
#define RIGHT 3

// Variable for bluetooth buffer

int RX_buff;

/* * This function is used to manage actual movements */

void go (int newDirection, int speed) {


boolean motorDirection_1, motorDirection_2;
switch ( newDirection ) {
case FORWARD: motorDirection_1 = true; motorDirection_2 = true; break;
case BACKWARD: motorDirection_1 = false; motorDirection_2 = false; break;
case LEFT: motorDirection_1 = true; motorDirection_2 = false; break;
case RIGHT: motorDirection_1 = false; motorDirection_2 = true; break;
}

// In case of motor set-up mistakes just change the numbers

motorDirection_1 = CON_MOTOR1 ^ motorDirection_1;
motorDirection_2 = CON_MOTOR2 ^ motorDirection_2;

// Let's move!

analogWrite(SPEED_1, speed);
analogWrite(SPEED_2, speed);
digitalWrite(DIR_1, motorDirection_1);
digitalWrite(DIR_2, motorDirection_2);
}

void setup() {

Serial.begin(9600);

// Sets pins 4, 5, 6, 7 to output mode

for(int i = 4; i <8; i++)
pinMode(i, OUTPUT);

delay(5000);

}

void loop() {

// Reading bluetooth data

RX_buff = Serial.read();

// Responding to bluetooth data

if (RX_buff == 1) {


go(FORWARD, 125);
delay(1000);
}

if (RX_buff == 2){
go(LEFT, 80);

delay(1500);
}

if (RX_buff == 4){
go(BACKWARD, 70);

delay(1500);
}

if (RX_buff == 3){

go(RIGHT, 80);
delay(1500);
}

// Stop,if necessary

if (RX_buff == 5 || RX_buff == 0){
analogWrite(SPEED_1, 0);
analogWrite(SPEED_2, 0);
}

}

Step 3: RemoteControl App - App Inventor Scheme

Picture of RemoteControl App - App Inventor Scheme

1. The principal element is BluetkothClient.Send1ByteNumber, which sends integer numbers to Arduino via bluetooth. When received by Arduino, those integer numbers are converted to motor commands.

2.The interface of the RemoteControl app is very simple - just four buttons for the relevant FORWARD, LEFT, RIGHT and BACK movements as well as STOP button.

3. The RemoteControl app also uses WebViewer component, which is used as recepient of the wifi video stream from the Android phone mounted on the robot. Again, the video is streamed by a thied party app (IP Webcam), which is installed on the Android phone. The advantage of IP Webcam is that it sreatms video directly to a web browser, which in RemoteControl app is replaced by WebViewer component. So, the video is streamed directly to your robot management app!

Comments

빈언 (author)2016-07-02

how to initiate ip webcam inside app inventor 2? I am stuck creating them

mubarkm (author)빈언2017-06-01

me also , if u found a solution sen me at mubark750@gmail.com

hudson.james.5052 (author)2015-02-02

And please provide the block diagram too

the block diagram is in step 3. unfortunately, I cannot reveal the program, since it is generated by AppInventor

Codes for MIT APP INVENTOR 2, for the Spy Camera

bbogdanmircea (author)2016-08-19

Amazing robot, this is exactly what I was thinking to do too !

Only 2 questions :

1. Do you think it is possible to command also the Robot by Wifi in the following way :

Remote App sends command via Wi-Fi to Robot Phone and Robot Phone send to Arduino bia bluetooth ? This would make the range of the robot much bigger and maybe it could be controller from bigger distance . Or even via 4G !

2. For your current setup, would it be possible to attach the phone to a servo arm and also control that by BT so you can also move the camera up down ?

App For Tradies (author)2016-01-18

Nice concept, and good guide.

hudson.james.5052 (author)2015-02-02

Can you please provide the app which is used in controlling the robot.

MsSweetSatisfaction (author)2014-11-08

Welcome to instructables! You robot looks awesome, you'll have to update us on the information he recovers. You should think about entering this into our First Time Authors Challenge.

About This Instructable

8,361views

44favorites

License:

More by Konstantin Kalushev:Very simple anti-zombie wireless alarmVery simple to create Arduino bluetooth spy robot with Android RemoteControl app
Add instructable to: