Introduction: Android Aplication for Robot Control Using HC-05 and Arduino ( Android Studio )

Hello everyone, this time I will show you how to control robot using your phone, please follow this instruction carefully. Actually, this project is still under development.

Step 1: What We Need for Robot

Before we go to android application, we need to prepare the robot,

1. HC-05 (Bluetooth Module)

2. Arduino Nano (Control)

3. L293 (Driver Motor)

4. 2 motorDC include wheel

5. Battery

Step 2: Circuit HC-05

HC-05 Bluetooth Connection:

Arduino => HC-05

5V => VCC

GND => GND

7 => TXD

8 => RXD

We are not using port tx rx arduino, so we can check bluetooth data in Serial Monitor.

Step 3: Motor Driver

L293 Connection:

PWM Left = 11

DIR1 Left = 13

DIR2 Left = 2

PWM Rigt = 3

DIR1 Right = 9

DIR2 Right = 4

Step 4: Software

1. Arduino IDE

2. Android Studio

Arduino IDE for programming arduino and Android studio for android.

Step 5: Programming Robot

Declaration or give a name for each pin:

const byte PWMKI = 11;

const byte DIR1KI = 13;

const byte DIR2KI = 2;

const byte PWMKA = 3;

const byte DIR1KA = 9;

const byte DIR2KA = 4;

setup program, set output arduino pin for out motor driver:

pinMode(PWMKI,OUTPUT);

pinMode(DIR1KI,OUTPUT);

pinMode(DIR2KI,OUTPUT);

pinMode(PWMKA,OUTPUT);

pinMode(DIR1KA,OUTPUT);

pinMode(DIR2KA,OUTPUT);

Klik New tab, give name motor.ino:

When DIR1 and DIR2 have diferent logic motor run. just using digitalWrite (digital pin,HIGH/LOW) for outpur DIR and analogWrite(analog pin,0-255) for output PWM.

In motor.ino have program cekMotor to check your motor drive, uncomment cekMotor() and comment play() to check motor drive then upload program, the program is: Forward => Backward => Turn Right => Turn Left. If the robot don't do it, so check your hardware and cable connection.

Klik New tab, give name BT.ino:

In BT.ino have two program:

1. cekBluetooth ( to check bluetooth data in Serial Monitor )

2. play ( to play robot using phone )

*Be carefull to open file program, open bluetooth_robot.ino don't open motor.ino and BT.ino.

*Some comment is use Indonesia lenguage.

Step 6: Programming Application

We are using android studio, for tutorial how to programmning bluetooth I get it from

http://www.codeproject.com/Articles/814814/Android-Connectivity

and

https://www.instructables.com/id/Android-Bluetooth-...

but the different is my program using timer for transfer data,

Sorry for attachment program, this have some program not use, and the design is simple not for all size screen because this still under development.

Step 7: Install Aplication

To Install aplication

1. Open Semarobo2 in Android Studio

2. run android studio to build.apk.

3. copy file ..\AndroidStudioProjects\SemarBluetooth2\app\build\outputs\apk\app-debug.apk to your phone.

4. Install aplication to your phone. ( Setting your phone to allow install aplication )

5. Click Semarobo logo.

6. Press Bluetooth ON.

7. My Bluetooth HC-05 is default setting, so choose HC-05 or your bluetooth.

8. Insert Bluetooth password.

9. Play.

If you have something to discuss, please email me at semarobo@gmail.com.

Phone Contest

Participated in the
Phone Contest