Ever wanted to build an IoT device, but finding coding difficult? With this project you will be able to build IoT devices sending sensor values without coding! We are bringing to you a new and innovative way to turn your micro:bit into an IoT device, easily programmed with MakeCode blocks, just drag and drop!
You want to connect to Wi-Fi just add the block:
It's that simple!
You can connect to some of the most popular IoT platforms with a single block.
AllThingsTalk,
Ubidots,
… and not mention Microsoft Azure!
You can connect to any IoT platform in general which supports MQTT broker,
In this project we will demonstrate how to connect and send BBC micro:bit temperature values to Microsoft Azure!
Steps1. Hardware Setup2. Setup microbit.makecode3. Setup MS Azure4. Block coding5. Result6. Summary
Hardware Setup- Connect micro:bit with IM01:
- Connect CW01 with IM01 using XC02 connector:
- Insert micro USB type-B cable to IM01 power port
Follow the link to know more about connecting and setting up xChips for XK05 kit.
IMPORTANT NOTE: Do not power the connection/circuit through micro:bit as it will not be able supply enough power to run the CW01 (WiFi is power hungry).
Setup microbit.makecode- Open up microbit.makecode.com
- Create new project:
- Click on Advanced>Extensions:
- Type "xinabox/pxt-CW01" in search bar, then click on pxt-CW01 extension:
- CW01 extension will show up on extension list:
- Login to your Azure portal
- Open Logic app service:
- Select subscription method, and Resource group:
- Name your logic app:
- Select Region radio button and select your location:
- Turn off Log Analytics:
- Click on Review + Create button:
- Design logic app by clicking on Logic app designer:
- Start from blank template:
- Select When HTTP request is received connector:
- Click on "Use sample payload to generate schema"
- Enter sample payload to generate schema:
{"temperature":25}
- Save the app:
- Copy HTTP POST URL and save it removing "https://":
- Put connectToWifi and connectToAzure blocks inside on start block, enter WiFi credentials and Azure HTTP POST URL you saved before:
- Inside forever block put IoTSendValueToAzure block, enter variable name and value:
- Flash the code to microbit
- Power IM01 first - microbit not connected:
- When CW01 shines Strong blue light, then slide microbit into IM01:
- After powering on, the microbit will transmit temperature data to Azure
- To check, click on overview, and click on any latest successful received packet:
- The packet contains received temperature data:
In this project we have demonstrated how to simply connect microbit with MS Azure using XinaBox xChips with easy drag and drop block coding. With XinaBox's wide variety of sensors and actuators you can create advanced AI projects maybe AI farming with just block coding!
Comments