Let's Make Robots! | RobotShop

Reusable Android bluetooth bot control app

appblocks.png624.66 KB

This is an app I built to controll many of my robots. I have tried and used many, but never found one I really liked. I tried to make it where it can be resued for many bot's and bot types. It also allows for telemetry and debug data to be received and displayed on the controlling phone or tablet. Just use a .println call to send the text.

This app sends one byte commands via Bluetooth.

Bluetooth robot control application.

This app sends one byte commands via Bluetooth to your robot. 

Ascii byte codes sent for buttons: q (Left Half turn), e (Right Half turn), w (Forward), z (Reverse), a (Left), d (Right), h (Stop), 1 (F1), 2 (F2), etc... The F button codes are ASCII chars as are the the others.   Send the line BUTTONBUZZ to make the device vibrate and BOTBEEP to make the app beep. The App keeps the last 100 messages set. There is also a command to make the app say text sent by your robot - SAYIT~Hello World. The Speak button allows for voice control of your robot. It translates the words "Forward", Reverse, Back, Left, Right, Stop and Halt into the correct button command. Any words that it does not know are sent to the robot with a leading '*' and a trailing '.'   e.g. You say "hello", the app will send "*hello." via the serial bluetooth stream.   

The application was built with the Mit Appinventor system.  It's a Scratch based Android app builder thats quite easy to use and very flexiable. See here for more info.

UPDATE: 09/13/2016 - Added SAYIT command to the app. Allows your robot to send text to the app for it to say.

UPDATE: 04/18/2017 - Added Speech to Text to the app. Allows your robot to get text spoken commands. Example updated.

The app can be downloaded from here and you can also get the source code for it there as well. 

Example usage from an Arduino based bot:

#include <SoftwareSerial.h>

#define stop 'h'
#define forward 'w'
#define reverse 'z'
#define left 'a'
#define right 's'
#define lthalfturn 'q'
#define rthalfturn 'e'
#define SPEED_INC '1'
#define SPEED_DEC '2'
#define CONTINUOUS '3'
#define SPK2TXT '*'

SoftwareSerial sfSerial (3, 4);  // Bluetooth module - RX, TX

void setup ( ) {
   // Using the SoftwareSerial lib to keep the hardware serial free
   // for other uses and programming the controller.
   sfSerial.begin (9600);
   Serial.begin (9600);

void loop ( ) {
   byte command = 0;

   // Process any commands sent from the serial connection
   if (sfSerial.available ( ) > 0) {
      // read the incoming command byte
      command = sfSerial.read ( );
   } else {

   // Look for and stat change commands, or call the motor drive function
   if (command == forward) {
      //bot_go_forward ( );
      sfSerial.println ("FORWARD");
      Serial.println ("FORWARD");
   } else if (command == reverse) {
      //bot_go_reverse ( );
      sfSerial.println ("REVERSE");
      Serial.println ("REVERSE");
   } else if (command == left) {
      //bot_go_left ( );
      sfSerial.println ("LEFT");
      Serial.println ("LEFT");
   } else if (command == right) {
      //bot_go_right ( );
      sfSerial.println ("RIGHT");
      Serial.println ("RIGHT");
   } else if (SPK2TXT) {
      String text_in;
      char char_in;
      while (sfSerial.available ( ) > 0) {
        delay (10);
        char_in = sfSerial.read ( ); 
        if (char_in == '.')
        text_in += char_in;   
      Serial.println (text_in);

   sfSerial.flush ( ); // Make sure any sent data is really sent to the ctrl app.
   delay (125); // Dwell a bit before next interation.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Have you tried it with an actual rover yet?

I am working on a robot to carry to a Con in a few months and added the Speech to text to allow for attendee interaction with the bot.

I wrote it originally for an out doors GPS way point bot, replacing a RC contoller I had on it. I also use it on a 6wheel (Actobotics bogie) I use as a test platform.

It is a work in progress, and I change it for my needs, but it should be good for others.