How to use ThingSpeak with micro:bit
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.
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?!