This article is contributed. See the original author and article here.
What it can’t do is connect to the internet. At least not directly…
I recently put together a ‘smart garden ornament’ project as part of our JulyOT month of IoT – the idea being to add sensors to bird boxes, gnomes and other such garden ornaments and bring this sensor data together in an on-line dashboard using IoT Central. This project is designed for families or schools to work on together, gathering data from your neighborhood or school. These sensors would be powered by BBC micro:bits and coded using blocks. The problem came with getting this data to the cloud.
My solution to this took advantage of two things – the radio and the USB connection. The micro:bit has a radio that can broadcast data to other micro:bits in the vicinity (the range in clear air is about 70m). It also has a USB port that can not only be used for power and programming, but you can also send data along it.
This means I can connect a micro:bit to a device with an internet connection (such as a Raspberry Pi) via USB and send messages from the micro:bit to the Pi. The Pi then listens on the serial port for the messages, then sends them on to IoT Central. This forms my central ‘Hub’.
My sensor micro:bits then need to send radio messages with the data they want to send to the cloud, these are detected by the ‘Hub’ micro:bit, routed through the Pi and send to IoT Central.
There is a size limit on radio messages of 19 characters. This meant I had to send encoded messages – using things like a single character for the telemetry type (e.g. ‘t’ for temperature) and a single character for the device ID. The Pi then decodes these to the actual values and sends them on.
You can read more on how I did this, see the code and learn how to build this yourself by checking out the project on GitHub:
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.