How to use BLE to remote control the micro:bit car?

How to use BLE to remote control the micro:bit car?

Introduction

Let's combine micro:bit board, an unused Android phone, and ELECFREAKS micro:bit Nezha 48 IN 1 Inventor's Kit to create a car that can be remotely controlled via WiFi and observe the car's surroundings in real-time via the camera. In this case, we will use two applications, the eWeLink APP and the eWeLink camera APP.

eWeLink camera APP can be connected to micro:bit board via Bluetooth. eWeLink APP controls the eWeLink camera APP remotely via WiFi.

 

Equipment Required

Mobile phone *2

ELECFREAKS micro:bit Nezha 48 IN 1 Inventor's Kit *1

 

Applications

eWeLink app

eWeLink camera app

 

Structure Construction

Use the building blocks to build a car.

 

Building Steps

 

MakeCode Programming

Step 1

In the code drawer of MakeCode click on "Extensions".

 

In order to program the Nezha Breakout Board, we need to add an expansion library. Type "Nezha" in the dialog box and click on search, then click on download this library.

 

In order to use the eWeLink camera app to send data to micro:bit, we need to add an extension library. In the dialog box type "  https://github.com/elecfreaks/pxt-eWeLink  " and click on search and click on download this code library.

 

Note: If you get a prompt saying that some code libraries will be removed for incompatibility reasons, you can either follow the prompt and continue, or create a new project in the project menu bar.

 

Step 2

Write the program as shown.

 

Programming link: 

https://makecode.microbit.org/_b0u5Mr4p8TaX

https://makecode.microbit.org/77837-12492-28670-90905

 

Step 3

Download and install the eWeLink APP on your usual phone.

Download and install the eWeLink camera APP on your spare phone.

Open the eWeLink APP and eWeLink camera APP separately, create an account and log in to the same account on both apps.

 

Once logged in, the eWeLink APP will detect that the eWeLink camera APP is online, click on the device to complete the link, then click on the Pan-Tilt button at the bottom of the interface to bring up the joystick, through which we can remotely control the car's trajectory in the process.

 

Set up the Bluetooth connection in the eWeLink camera APP, power up micro:bit, and connect it to the phone via Bluetooth.

Click Settings to enter the settings screen.

 

Click on Pair with Bluetooth Accessory to pair with the Bluetooth connection.

 

Click on the BBC micro:bit for Bluetooth connection.

 

It is important to note here that the Bluetooth connection is different between the micro:bit V1 and micro:bit V2.

After the micro:bit V2 has been downloaded and powered on, the Bluetooth connection password is displayed on the LED matrix.

After the micro:bit V1 has been downloaded and powered on, you need to press the A and B buttons at the same time and then press the reset button, after which the Bluetooth connection password will be displayed on the LED matrix.

After a successful Bluetooth connection:

 

Once connected place the spare phone on the trolley to start the experience.

 

Video Display

 

Conclusion

You can use the eWeLink app to remotely control the direction of travel of the trolley and to observe the surroundings via the camera.