In this tutorial, we're gonna learn how to publish sensor readings from BBC Micro:bit v2 to Qubitro IoT platform through MQTT protocol.
Qubitro is the fastest way to build IoT applications with predictable pricing, developer-friendly features, and scalability you’ll love. You can connect your hardware to Qubitro, collect the data and create data visualization on your own dashboard. For more information about Qubitro you can check on its official site: qubitro.com.
We're gonna use the BBC Micro:bit v2, a pocket-sized microcontroller based on 32 bit Arm Cortex-M4. It's equipped with Bluetooth Low Energy, radio antenna, 5x5 LED matrix, 2 buttons, MEMS microphone, speaker and several sensors like touch sensor, light, accelerometer, magnetometer and temperature sensor. For more information about BBC Micro:bit v2 you can check on its official site: microbit.org.
Step 1. Create Qubitro ProjectSignup or login to Qubitro Portalthen create a new project. Click New Project button, add project name & description then click Create Project button.
Then create a new device inside your project. Choose your device connectivity method, in this case MQTT. Then enter device details from name, description, brand, model and location.
After that you'll get your credentials (host, port, username, password & clientId) to connect to Qubitro MQTT broker. Please note these values because we'll use them on our code later. You can check these values on device Settings menu. Your username & clientId are your Qubitro Device ID and your password is your Qubitro Device Token.
Go to Microsoft Makecode editor and create a new project. Install ESP8266 extension: click gear icon, choose Extensions, search for ESP8266 and install the one which name is iot-environment-kit, an ESP8266 extension by Elecfreaks.
Using block programming, arrange the following block codes:
Download its hex file, then insert it into the Micro:bit v2. Once done, Micro:bit will display heart icon on its 5x5 LED matrix, connect to the WiFi and publish data to Qubitro every 5 seconds.
On Qubitro device Data tab you'll see the data stream from your Micro:bit. You can create data visualization on Analytics tab or create your own centralized Dashboard on Monitoring section.
Comments