Since its conception the BBC micro:bit has flirted with Wi-Fi - some of the early concepts even included Wi-Fi on the board. In the end they went with BlueTooth, which is an amazing feature that has served micro:bit and the community with distinction.
But its not Wi-Fi.
Over the years there have been attempts to emulate IoT on the micro:bit, and there are a few products that offer a Wi-Fi based IoT solution. But they are typically expensive, a bit hacky and not well supported or aimed at educators.
All that is about to change!
Right now the "BBC micro:bit IoT Starter Kit by XinaBox" is storming its way towards the market (you can already buy the components listed in this project separately). I declare an interest - I am helping to develop this product, a fact I am very proud of!
This little project is a simple demo of how the basic hardware can get you onto an IoT cloud with minimal hassle and minimal outlay of $$. For this project I have connected to HiveMQ because they offer a free service we can use without registering. It is possible to connect to other services, and some of the commented code will help you... I'll update this project with guidelines for other IoT platforms some time.
What you are seeing here is the tip of the iceberg: we have a very exciting roadmap, and the consumer version will be a LOT simpler (e.g. the CW01 will come pre-flashed with the necessary code, we are developing blocks for MakeCode and we'll have a smart array of learning materials to go with it).
To get this project to work you will need to work through each of the instruction sheets in turn (they print nicely on an A4 if the browser view is too zoomed in). There are 6 altogether, and it is best to work through them in this order:
- 1 = Flashing the CW01
- 2 = Flashing the micro:bit
- 3 = Assembling the IoT Starter Kit
- 4 = Setting up an IoT Service
Once you've worked through these, check out these:
- 5 = Pulling it all together (1)
- 6 = Pulling it all together (2)
The steps described here worked for me and I am an IoT beginner at best. I did run into a few stumbling blocks - I've tried to detail these in the instruction sheets, and in some cases in the bullets below. If you encounter any difficulties and these don't help please get in touch.
- Get the Wi-Fi name and password spot on in the Python code! And bear in mind, some Wi-Fi networks have extra security that might block you.
- Put a slash at end of the Connect / Add New Topic / Topic prompt in the Hive dashboard setup. Thanks again Bjarke ;) Hive is very sensitive to /s.
- I cut down the delays that Bjarke had put in the Python code (that you flash onto the micro:bit). "5000ms delay - nah - I'm not waiting that long!.". Some of the delays NEED to be there, some probably not. But, when you are setting it up initially leave them be. Takes Wi-Fi a bit of time to do stuff sometimes, apparently!
- Getting the orientation of the hardware components right is important (I plugged my micro:bit in upside down!). See the instruction sheet titled "Pulling it all Together (1)" for a pic of what an xCircuit should look like and what to look for to ensure your components are oriented correctly.
- Power. Wi-Fi is hungry. I used a power-bar to power both the CW01 and the micro:bit and it worked fine. It also worked off of USB when the IP01 was plugged in directly. If that doesn't work try plug a battery into the micro:bit and plug your IP01 into a USB power source. The XinaBox range has some options here too. Look out for our LoRaWAN equivalent soon :)
- The xFlasher is a useful tool to help you see what is going on with the CW01 - it reports status in real time. Start xFlasher up, then plug in your IP01, then click on the big SERIAL button. You should get live status updates from the CW01 which will help diagnose any problems.
- Woah - the data is crazy and why am I receiving weird messages??? Bear in mind the service I've used here is free - and that anyone who uses the code EXACTLY as provided will connect to the SAME service. So no sending naughty 5x5 pics or rude messages over the default channel please ;)
And remember - this is a beta. 75% of the hassle will be removed for the commercial Educators version.
… Wi-Fi based IoT on micto:bit with XinaBox.