BLUETOOTH BASED ANDROID PHONE/TABLET CONTROLLED ROBOT





#1>RAN1114 : Bluetooth Based Android Phone/Tablet Controlled Robot:

Rhino Robot Control Board is our most powerful, versatile and most easy to use robot control board. This tutorial series is intended for giving the idea of versatility and use of this board in many types of robots.


We also hereby assume that you have gone through Rhino Board Manual, Quick C IDE user manual and Quick C IDE library reference. It’s not necessary for you to understand everything written in those documents but you should have an overview so that you can use them as reference for some part in this document.

One of the main advantages of making Robots using Rhino Board is it allows easy programming and hardware interfacing of external device. For example, in this tutorial you will find that using Pre-programmed libraries for Ultrasonic Distance Sensors and Servos makes the task and programming very easy.

All files required for this tutorial could be downloaded from here : Tutorial




#2>Bluetooth Communication:

To use Bluetooth with Rhino Robot Control Board we need a Bluetooth-UART module which can receive data on Bluetooth from a android device and send it to Rhino board on UART lines.

For this we will use our Bluetooth-UART module, details of the module is available here Bluetooth-UART Module.

For Android we have a application which can be downloaded from here. This application utilizes the Bluetooth on SPP (Serial Port Profile) on phone and sends serial data to Bluetooth device. The Bluetooth device needs to be paired from Bluetooth settings menu. The name of Bluetooth Device is Robokits_Bluetooth and pairing key is 0000. The device connects on 9600 baud rate by default.

Android application needs to be installed into phone. The application is an apk file which could be copied to phone using a USB cable or Wi-Fi and then it could be installed. Once installed, this app will enable to phone to connect Bluetooth Serial device and communicate with it. It will also be able to send robot control commands based on either touch or tilt control selected.


This tutorial covers:

  • Making an Android Phone or Tablet Controlled Robot which is communicating on Bluetooth.
  • Install an application on phone for Bluetooth control of robot.


#3>Required Resources:

Or you can also use following Resources,

  • An Android device with Bluetooth is required. Android version should be greater than 2.2. There might be some compatibility issues, please check android application on your device before going for this project.

  • It’s not necessary to use the same items, you can use any similar items. However some coding may need to be changes as per hardware if it’s different this listed above.



#2.1>Resources used for in this tutorial:


Round-bot – Autonomous / RC
Indoor Robot (Servo is not part of standard package)


Bluetooth UART Module



Jumper Wires (For Connecting Bluetooth
Module to Rhino Board)


Inside view

We have chosen ‘RoundBot’ for this tutorial, as this robot is designed for indoor use and it runs very well on flat surfaces. It comes with battery, motors, wheels and Rhino Board and its very compact compared to other robots and robot chassis. Due to its round shape it can go through indoor items like chairs, tables and other furniture without getting trapped in some corner.

We have chosen Android because it’s most preferable smart phone OS these days and its widely used. Apart from this a phone or tablet based on android already has a touch screen and orientation sensor which we can use to control the robot. We have made our custom application for this tutorial and its available for download here : Tutorial

#3>Objective

The problem statement for this tutorial is to make a robot which could be controlled wirelessly by an Android device via Bluetooth. Android device should send commands depending on either Tilt control or Touch control. The Rhino board on robot should receive the commands and process them properly to maneuver the robot by changing speeds and directions of motors.




#4>Software Installation on Android Device

Software for Android is available here in APK format, its compatible with Android 2.2 and above.

Download : Software

To use this software first you will need to allow ‘Unknown Sources’ from security settings. This setting could be in different menu or format depending upon the Android build. This is to allow an application which is not downloaded from Google Play Store.

Once Unknown Sources option is enabled, either download the APK file directly to your device or copy from
computer to the device by WiFi, USB cable or Bluetooth.

Install the file on Device and launch software after installation. Once software has started you should see values of Roll, Pitch and Yaw changing on screen when you tilt your device in different directions. When you Disable tilt control check box you will see touch control, you can touch anywhere on Green circle and verify that the values are changing. Once this is verified your application should work properly but before that hardware setup should be done on Robot’s side.



#5>Rhino Board and Bluetooth UART Connections




Connection



Rhino Board UART Connector



Bluetooth UART Pin


GND


Pin 5


GND Pin (1)


VCC (+5V)


Pin 4


VCC Pin (2)


RXD


Pin 2


RXD Pin (4)



Use 3 jumper wires to make connections as above. GND and VCC are for UART power and third connection is for data.



#6>Rhino Code


#6.1>Code 1 : Android Controlled Robot Via Bluetooth

  • Open 021 – Bluetooth Based Android Phone Controlled Robot program in sample codes folder.

  • Library used : UART, IO Notations

  • This code uses UART_GETCHAR(); function to take one byte input from UART. Then it matches the input character with if conditions. If the character matches it takes actions accordingly. The loop will wait until a byte is received.

  • If condition checks for W, S, A, D or O characters input if any of them is received specific motor control commands are executed. All processing is done on android software, software calculates Pitch and Roll of device and sends W for forward, S for backward, A for Left turn and D for right turn, if the device is steady it will send O to stop. Same commands are sent for touch controls also.

  • Once this code is flashed and all the connections are checked, close top lid of the robot.
  • Power on robot and you can see an LED blinking on Bluetooth Module.
  • When you pair this device with Android device, LED blinking rate will slow down.
  • After pairing start software on Android device, search for device and connect to Robokits_Bluetooth.
  • Control the robots using either touch or tilt method.

 

You may also like...