This guide will help you install, set up, and use BT Commander. BT Commander is an Android app designed to emulate an ArbotiX Commander. The ArbotiX Commander is an Arduino based hand-held controller, compatible with all ArbotiX-M based InterbotiX Robots.
BT Commander requires that you have a smart phone or tablet with bluetooth running a current version of Android OS (This version of the guide has been tested on Android Version 4.4.2 "KitKat"). You can control any robot that meets the following criteria:
- Has a Bluetooth Module
- Can Communicate at 38400 bps over a UART serial port
- Can read the Commander Data Packet
The ArbotiX-M Robocontroller meets all of these requirements when paired with a bluetooth module such as the Grove Serial Bluetooth V3, and can interpret the commander packet using the Commander library. The ArbotiX-M Robocontroller is used in a majority of InterbotiX Robots, making an entire line of crawlers, arms, and turrets easily compatible with BT Commander. Just load the appropriate firmware on to the Robocontroller, plug in a configured Bluetooth Module to your Robocontroller and you can control the robot!
Note: We recommend using the BT Commander App with a Phone or Tablet with a minimum screen resolution of 360x640.
Complete your Robot's Getting Started Guide
Before you get moving on the control scheme, make sure to go through the Getting started guide to set up and assemble your robot. For your convenience, here is a list of guides for the robots that have pre-written commander packet compatible code. You can ignore references to the XBee and the ArbotiX Commander controller in these guides, and focus on the section regarding setting up the commander compatible firmware on your robot.
Configure the Bluetooth Module
For this guide, we are going to use the Grove Serial Bluetooth V3 module for its stability, ease of operation, and low price point. There is a guide from Seeed Studio that can take you through the initial setup of the Grove Serial Bluetooth V3 here, but everything you need to know to get this module up and running will be covered in the guide below.
There are many bluetooth modules to choose from that will work with this project. If you have a BlueSMiRF Gold, check out this guide for setup details.
|Serial Bluetooth v3.0 Pin||USB FTDI Cable Pin|
Connect your Bluetooth Module to your FTDI USB Cable, plug into your computer. If it is connected correctly, the bluetooth module's light will turn on, flashing green.
Alternatively, you can use a UartSBee interface to reach the same result.
Open your Arduino IDE and select the appropriate COM port.
Open the Serial Monitor.
The Bluetooth Module defaults to
9600 baud over serial, and requires you to use
No line ending to send AT Commands.
The first command we are going to send it will set the baud rate to 38400. Send the line
AT+BAUD6 and it should return "OK+Set:38400"
Having adjusted the Baud rate, we now need to select 38400 baud from the dropdown to continue sending commands to the bluetooth module.
The next command we will give the module is
AT+ROLES, which sets the device in Slave Mode.
Now we will name the module so you can easily identify it when it comes time to connect to it. Send
AT+NAMEyournamehere to the device, replacing "yournamehere" with any alphanumeric name, no special characters, up to 12 characters long.
Finally, we need to set the pin, so that you can securely connect to your device. Do this with the command
AT+PIN1234, replacing "1234" with a 4-digit code that you can easily remember. You should now unplug your bluetooth module from the FTDI cable.
Connecting Bluetooth Module to ArbotiX-M
Now that your ArbotiX-M is programmed and your bluetooth module is configured and ready to go, we need to connect the bluetooth module to the appropriate pins on the ArbotiX-M. Follow the diagram.
|Serial Bluetooth v3.0 Pin||ArbotiX-M Pin|
|VCC||Analog 7 Center Pin|
Note that this project requires that your FTDI pins and Analog 7 be free at the time of operation. An XBee Module cannot be used when the Bluetooth Module is connected to the ArbotiX-M. The Bluetooth module cannot be plugged in while you are programming the ArbotiX-M.
Install APK to Android Device
If you have a QR code reader, you can scan the above QR code and it will take you to the current .APK download of BT Commander. Otherwise, direct your device's browser to this link to download. Install by opening in your device's file manager and following the prompts. You should see the BT Commander Icon in your programs list once it has completed install.
Running the Code
Running the BT Commander is easy and fun! Let's start with the basics.
First, make sure the robot/device you wish to connect with is on, and the bluetooth module is flashing green. On your phone or tablet, open your bluetooth manager and scan for devices.
Select your device, and enter the pin you set earlier.
Your device should now be in the Paired Devices list. You will not have to repeat the pairing process in the future.
Once it is paired, open the BT Commander App on your phone or tablet.
You should be greeted with the Bluetooth Connect screen. Select "Connect to device"
A list of bluetooth devices will appear. Select your bluetooth module from the list.
The app will return to the Bluetooth Connect screen with the words "Connected" in the Link Status. The light on your bluetooth module should now be solid. At the top of the screen, there are currently two controller choices, Basic and Smooth.
The Basic Controller has a Speed Slider and two simple Directional Pads. By selecting a speed and pressing a direction, you can easily control your robot.
The Smooth Controller acts more like the analog joysticks on the ArbotiX Commander, choosing the speed based on how far out from center each joystick is dragged.
When you are finished controlling your robot, just go back to the Bluetooth screen and select Disconnect.
Once you've set up your Commander, there are plenty of things you can do! BT Commander was created in MIT App Inventor 2, and the project is open source. Here are some resources for anyone interested in building upon this program:
- BT-Comander (GitHub)
- BT Commander Project (.aia file for use with MIT App Inventor)
- Packet Explanation and Calculator
The Commander is very much designed to handle the control end of the robotic processes. The behavior that is expressed by the robot on receipt of these packets is determined by the Arduino Commander Code written to the ArbotiX-M. If you would like to change the layout, look, or behavior of the controller in specific, altering the BT Commander code is the way to go. To change the robot's behavior when it receives a commander packet, altering the Arduino Commander Code downloaded in the Wireless Handheld Controller Guide is your ticket to success.