Using Bluetooth for Data Science
In the lead up to this chapter we have looked at how the BBC micro:bit can be used to build data gathering tools that enable us to undertake meaningful real-world data science experiments. In the process we have identified a flaw in our capabilities: the micro:bit can measure almost unlimited volumes of data, but saving that data and / or getting it off of the micro:bit and into an environment where we can use it has been challenging.
At the end of Chapter 6 we concluded that wireless technology could provide us with the means to extract data as it is recorded. In this chapter we will look at one of the technologies that is available to use that can deliver this functionality: we’ll see how Bluetooth can help meet this need.
The code used in section 7.6 is provided below:
The full code listing is shown below:
Bluetooth is great, but…
I would like to add that I am an avid user of Bluetooth… right now I have my Bluetooth headset on for conference calls and I am listening to some Talking Heads over Bluetooth speakers. It is a fantastic technology.
But not so much on micro:bit.
Sorry to be the one to say so, but Bluetooth on micro:bit is a bit unreliable.
The issue is not with the Bluetooth protocol (or, for that matter, BLE), or even with micro:bit. Its down to the processing power of the micro:bit and the requirements of BLE: its like trying to fit 20 students into a VW Beetle (or whatever the modern equivalent is).
There are some super workarounds and implementations, but as an entry-level educational device the hoops that a micro:bit has to jump through to get a barely decent implementation of Bluetooth going are OTT and not very accessible for young learners. Most relevant to the book though is that its unreliability on micro:bit (the periodic dropping of pairing) means a loss of data, which is untenable.
But please make up your own mind. In the book we used the most stable implementation we could find at the time; there are plenty of other options and new ones are released frequently, so you might find one that works well for you.