Two-way bluetooth communication between mBot and Android 2 years ago

Project is a sample implementation of a two-way communication channel between mBot and 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).

Constructing Steps

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

Install MIT AI2 Companion app on your Android phone

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 use the LED matrix to display the received data - if you do not have that, please modify the code accordingly. The program uses the Arduino extension.

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. The code to pair with the mBot should be 0000.

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.

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. 

 

2
  • Project Difficulty Level
    Vantage
  • Required Skills
    Software