micro:bit Workshop Level 5
- micro:bit Wi-Fi Extension
- Applications with Cloud Platform ThingSpeak
- Applications with Web-based Service Platform IFTTT
Introduction to Web-based Service Platform IFTTT
- IFTTT stands for IF This Then That
- "This" represents the event trigger
- "That" represents the follow-up action
Examples of IFTTT
Here follows two examples of IFTTT.
Prerequisite to using IFTTT on micro:bit
There are a few things to do before you can use IFTTT with your micro:bit.
Register for IFTTT Account
Log-in your IFTTT account with your email.
Add Package for micro:bit MakeCode
Search for "MuseLab" in MakeCode Add Package screen.
Extend Wi-Fi for micro:bit
Prepare the MuseLab WiFi IoT Robotic Shield Kit for accessing the web-based services on IFTTT.
Hands-on: Temperature Alert on IFTTT
In this section, you will learn the following.
- Upload your sensor data through micro:bit
- Send email to the user along with sensor data
Setup for IFTTT - Webhooks Activation
Webhooks act as a event trigger in this hands-on project. More on this topic when you setup the applet.
- Head to Webhooks homepage.
- Press the "Connect" button.
Before
After
Setup for IFTTT - Applets
An applet is the combination of a "Trigger" and an "Action."
Applet=Trigger+Action
Procedures in My Applets
Press the "My Applets" tab at the top. On the My Applets homepage, press the "New Applet" button.
My Applets Homepage
Procedures in New Applet Step 1
- Press the "+this" button.
- Focus on the "Search services" textbox.
- Enter "Webhooks" and select "Webhooks" service.
New Applet Step 1 Procedure 1
New Applet Step 1 Procedure 2
New Applet Step 1 Procedure 3
Procedures in New Applet Step 2
- Select the "Receive a web request" option.
- Focus on the "Event Name" text box.
- Enter "temperature_alert_cold" as the event name.
New Applet Step 2 Procedure 1
New Applet Step 2 Procedure 2
New Applet Step 2 Procedure 3
Procedures in New Applet Step 3
- Press the "+that" button.
- Select "Email" service.
New Applet Step 3 Procedure 1
New Applet Step 3 Procedure 2
Procedures in New Applet Step 4
Select the "Send me an email" opton.
New Applet Step 4
Procedures in New Applet Step 5
Press the "Create action" button.
New Applet Step 5
Procedures in New Applet Step 6
- Modify your applet description.
- Press the "Finish" button.
New Applet Step 6 Procedure 1
New Applet Step 6 Procedure 2
Setup for IFTTT - Webhooks Functionality Test
In Webhooks service, everyone has a unique identification key. Let's retrieve the key and put it in our micro:bit.
Procedures in Webhooks
- Head to "Webhooks" homepage. Press the "Documentation" button.
- Focus on the "{event}" textbox.
- Enter "temperature_alert_cold" as the event name.
- Focus on the textbox after the "value1" JSON property.
- Enter "12" as the parameter.
- Press the "Test It" button. If the applet was setup correctly, you should receive an email.
- Copy the 43-character key for later use.
Webhooks Homepage
Webhooks Documentation Before
Webhooks Documentation After
Expected Result
A email should be sent to you with the temperature reading included in the body. The reading should be shown as the first value of "Extra Data."
Setup for micro:bit - MakeCode
Let's create our micro:bit program.
Procedures in Webhooks
- Search "MuseLab" in the MakeCode "Add Package" screen.
- Add the MuseLab "wifi-shield" package.
- With the additional programming blocks in the "MuseIoT" tab, create the program as shown in the picture.
- Replace the IFTTT key with your Webhooks key accordingly, and enter the event name used in this project "temperature_alert_cold" with value1 set as the temperature.
Webhooks Documentation After
Contact Us and Stay Tuned for More Workshops
Stay tuned to this website for future events! Contact us if you are interested in the items we discussed in the previous workshops.