How to use ThingSpeak with micro:bit

What is ThingSpeak?

ThingSpeak is an IoT analytics platform service that allows one to collect, visualize and analyze live data streams in the cloud. It provides instant visualizations of data from your micro:bit posted via the MuseLab micro:bit Booster. The MuseLab micro:bit Booster and the ThingSpeak platform often work together for prototyping and proof of concept IoT systems that require analytics.

Below are the steps required to start using your micro:bit with ThingSpeak.

What is ThingSpeak?

ThingSpeak is an IoT analytics platform service that allows one to collect, visualize and analyze live data streams in the cloud. It provides instant visualizations of data from your micro:bit posted via the MuseLab micro:bit Booster. The MuseLab micro:bit Booster and the ThingSpeak platform often work together for prototyping and proof of concept IoT systems that require analytics.

Below are the steps required to start using your micro:bit with ThingSpeak.

Step 1. As always, we first set up the network connection on the MuseLab WiFi micro:bit Booster. If you have already done so, please continue with “Step 2”, otherwise click the below link and follow the instructions.

How to connect micro:bit to the internet

Step 2. Next, we will have to create an account on the ThingSpeak platform.

Go to ThingSpeak at https://thingspeak.com and signup.

Step 3. After signing in, Click “New Channel”.

Step 4. Now we have to define the name for our new channel and the name of the data we want to submit. We can set up to 4 different fields to receive values.

Step 5. To submit data to the ThingSpeak cloud and assign them to a specific field, we have to go to the “Data Import/Export” section and copy our API Key link.

By taking a closer look at the API link, we will see that we are submitting an “update event”, followed by the API Key (api_key=”************”) and data with the value of “Zero” assigned to field1.

Step 6. Whether or we have set up everything correctly, we can test by pasting our API link directly into the web browser address bar and trigger the data update event. New data should be shown in our ThingSpeak chart view.

Step 7. Now it’s finally time to equip our micro:bit with the new features. The MuseLab IoT package, available in the micro:bit PXT editor, offers predefined blocks for ThingSpeak. Just copy the API Key (NOT the link from before!) from the ThingSpeak website and paste it into the block.

Use a string block to enter your API key.

Step 8. Whenever the code block is executed,  we will see a notification about the progress on the display of the MuseLab micro:bit Booster. Likewise, we will see our chart on the ThingSpeak platform updating.

Here is an easy challenge: have a guess what the below code block is doing?!

  • It will continuously upload the temperature value every 15 seconds.

Please enjoy analyzing your data on  ThingSpeak!