Nowadays, there have a lot of Android apps that can be used as a bluetooth controller to your microcontroller project. For example you can used Arduino BT Joystick to control your mobile robot, or IORelay Bluetooth Relay to control relays on your board, or BlueTerm to monitor data from your project and many more. So in this tutorial, we will show you how to connect Android Bluetooth apps to your microcontroller by using BlueBee module. We will use Arduino BT Joystick as Android Bluetooth apps and trace the data from this apps.
Set Rx and Tx jumper to USB on Xbee Shield. Connect USB cable to Arduino and your laptop/PC.
1. Enable bluetooth on your Android phone and pair to BlueBee. BlueBee default PIN number is 1234.
2. Install Arduino BT Joystick and open it. Go to Settings.
3. Select Define the send delay.
4. Set to 2 seconds or 2000 miliseconds. Then hit Save.
5. Open Arduino IDE, select your Arduino board and COM port number, and open the terminal. Set baudrate to 9600.
6. Now you can connect to the BlueBee, touch CONNECT button and select BlueBee.
7. Once the connection is succeed, there wil be set of data display on your Arduino Terminal. This set of data will repeatedly sent to your BlueBee every 2 seconds (Define the send delay). Since the data can be displayed on Arduino Terminal with 9600 baudrate, for sure this is a UART data. However, what is those data represent?
#b=0# (Update 31 July 2015)
From the data above, there have 4 segment (seperated by #).
1. b=0 : This is button pressed, 0 means no button being pressed. To know what number represent the button, you can go to Settings – Define button values.
2. x=1 : Accelerometer x axis. Value range from -9 to 9. Available in Pro mode only 3. y=0 : Accelerometer y axis. Value range from -9 to 9. Available in Pro mode only 4. z=9 : Accelerometer z axis. Value range from 0 to 10. Available in Pro mode only
By default, this is the number assign for every button.
Now you already know the data (for this apps), so you can program your Arduino/any microcontroller based on that data. If you use Arduino + Xbee Shield + BlueBee, please set the Rx and Tx to D0 and D1 (for hardware Serial).
*You may need to change the Define the send delay to get a better response.
**Developer/owner for this apps may change the data in future, so you need to verify it first.
***Same method you can apply for other Android Bluetooth apps.