Remote Control via Bluetooth using Smartphone

Remote Control via Bluetooth using Smartphone

This guide is about how to control the MOTION:BIT Pro through Bluetooth using your smartphone with example code and some troubleshooting tips.
We will show you 2 apps that is designed for Bluetooth Connections on micro:bit devices:

  1. micro:bit gamepad
  2. EV-micro:bit

Add the Bluetooth extension

1. Select “Extensions” from “Category Drawer” or under the “More…” icon.

2. Search “bluetooth” and select to add the extension to your MakeCode Editor.
The “Bluetooth” extension cannot coexist with “Radio” / “Neopixel”, so select “Remove extension(s) and add bluetooth” from this pop out window.

You will get something like this:

Bluetooth Gamepad Setup and micro:bit sample code

A. micro:bit gamepad

1. Turn on Bluetooth on your smartphone and go to https://microbit-gamepad.embeddedlog.com/#. You may also install the app.
Then you will get to this gamepad:

2. Select “Hex” and it will show a sample code to connect your micro:bit to this gamepad.

Select “Settings” and it will show the UART message of each button for your micro:bit to read or write the data via bluetooth.

3. In your MakeCode Editor, edit and modify the sample code from “Hex” or create a new project to this:
Note: “bl_data” is a variable created under “Variables”.

Note: You may replace the “show icon” or “show string” block with any other blocks that you want.
Before you flash the code to your micro:bit, make sure that you have turned on the “No Pairing Required” under “Project Settings”.

3. Flash this code to your micro:bit and turn on the MOTION:BIT.
4. At the micro:bit bluetooth gamepad page, select “BBC micro:bit” and pair it with your micro:bit.
Note: Make sure your device (smartphone/laptop/tab) Bluetooth is turned on.

On your micro:bit, you will get a “smiley face” if your device is successfully paired with your micro:bit.

5. Try to press any of the buttons and observe the changes on your micro:bit LED matrix.


B. EV-micro:bit

1. Go to your MakeCode Editor and create a new project. After adding the “Bluetooth” extension, add the following blocks to your code.

Note: You may replace the “show icon” or “show string” block with any other blocks that you want.
Before you flash the code to your micro:bit, make sure that you have turned on the “No Pairing Required” under “Project Settings”.

2. Flash this code to your micro:bit and turn on the MOTION:BIT.
3. On your smartphone or Tab, Download the “EV-micro:bit” app from Playstore (Android).
Note: This app is not found in the Apple App Store.
4. Turn on Bluetooth on your smartphone and open the “EV-micro:bit” app. Select the “BBC micro:bit” device to connect or pair. Once it's connected, the app will direct you to the gamepad.

5. Try to press any of the buttons and observe the changes on your micro:bit LED matrix.


Troubleshooting tips:

  • “BBC micro:bit” is not detected

Solution 1:

Always make sure that you have turned on the “No Pairing Required” under “Project Settings” before you flash the code to your micro:bit.

Solution 2 : 
If your smartphone/tab/laptop didn't show “BBC micro:bit” as one of the available devices to be paired with even after you have turn on the Bluetooth connection, you may try these steps:
Note: This often happens when I am using the “EV-micro:bit” app but not on the “micro:bit gamepad”.

1. Close the app that you are using on your smartphone while Bluetooth is still turned on. (This is a must)
2. Go to your Bluetooth settings and we will pair the micro:bit manually from there.
3. Look for the “BBC micro:bit” device:
Note: You might not get those labels exactly the same in your smartphone.

  • If it appears under “Available Devices” or “Rarely used devices”, it means that your smartphone/tab is yet to be paired with the micro:bit.
    Select the “BBC micro:bit” and “Pair”

  • If it appears under “Saved” condition, it means that your smartphone/tab has successfully paired with the micro:bit in the previous attempt. But for some reason the app couldn’t detect this connection.
    Select the “BBC micro:bit” and “Unpair” it or “Forget” the device.
    Then look for “BBC micro:bit” under “Available Devices” or “Rarely used devices” and “Pair” it again.

4. Open your app again, the app (for example: EV-micro:bit) should be able to detect the micro:bit or it will direct you to the gamepad immediately.

 

  • Connected but the buttons are not responding

Most probably this will have something to do with your code. You might need to check on either of this 2 items:

1. Bluetooth on data received and Bluetooth uart read until

2. Uppercase or Lowercase on bluetooth data

 

Hope you are having fun building projects with MOTION:BIT.

You may continue to read through the tutorials on other key features of this board or trying out some of the project guides.

Hardware Components