All this Bluetooth data stuff is good if you want to plot the data or add control from your phone. But what if you want to store the data long term, or add remote control from around the world?
It's not too hard! We can use Adafruit IO to create graphs and dashboards. And, best of all, its free just like the Bluefruit app!
Before continuing, set yourself up with an Adafruit IO account
We won't cover all the details of Adafruit IO here, so check out the guides we have already written for that good stuff!
We'll want a 'place' for our temperature, so create a new feed called temp
Install the Adafruit helper library and friends
Open up the BLE die temp demo
This will read the temperature on the chip itself. It's not precise at all but it does go up when it gets hotter and down when it gets cooler, so its a good place to start and you don't need any additional hardware
Note that this sketch takes 50 readings and averages it, then waits 5000 ms (5 seconds) between data reports. That's because Adafruit IO is limited in how much data you can upload and store, so we will take it a little slowly.
Upload the sketch and open the serial monitor so you can verify the temperature data there:
Connect to the microbit over your device using Adafruit Bluefruit Connect as covered in the previous projects, and select UART mode. You should see data slowly coming in
You can also plot the data. Note that the data is really not very precise or accurate. But if you heat up the nRF51 with a lamp, the temperature will slowly rise up:
Now go back to UART mode and click the MQTT button in the top right:
Note that the MQTT server and port will be prefilled for Adafruit IO.
Skip down and enter in your Adafruit IO Username and API Key (even though it says Password, use the long alphanumeric API key)
Then take that and put it here like so:
Finally enter in the feed name which is username/f/tempbit into the UART RX Publish entry. (There's currently a bug where you have to have something in the Subscribe so we put the same feed in there):
Then click Connect at the top:
Wait a few minutes and go visit your Adafruit IO Feeds page, you should see the data start to stream in!