Two-way bluetooth communication between mBot and Android

The project is a sample implementation of a two-way communication channel between a Makeblock mBot Blueand an Android app using Bluetooth. Using this example as starting point, you can use the mBot as a sensor and physical extension for the Android phone or expand the mBot capabilities by the phone (e.g. add WLAN or cell phone internet connection).

Steps

1. Register at http://appinventor.mit.edu to access the online Android app inventor

2. Install MIT AI2 Companion app on your Android phone

3. Load bluetest_arduino.sb2 into mBlock, switch to Arduino mode, connect the mBot through USB to your PC and upload the program to the mBot. The sample code uses the LED matrix to display the received data - if you do not have that, please modify the code accordingly.

4. Make sure that the mBot is not connected through Bluetooth to anything (blue LED should be blinking). Pair the mBot to the Android device using the Bluetooth settings on the Android phone.

5. Download the BTArduinoClient2Devices_ahu.zip to your PC, unpack it and import the program into the online app inventor. Connect to the AI2 Companion app and run the app on the smartphone. Use the "Connect to device" button and pick the Makeblock device.

6. Now you should see the timer value received from the mBot in the "Received" field of the Android app. When you enter values in the input fields and press the "Send" buttons, the bytes / characters will be displayed one by one on the LED matrix. The right LED will turn yellow when data is available and blue otherwise. The left LED will just blink to indicate that the program is running.

Categories: technology

education makeblock mbot programming robotics