Blog 3 - MQTT / IFTTT

 

Introduction

MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol widely used in IoT (Internet of Things) applications. It enables devices to communicate with each other efficiently, making it perfect for scenarios where bandwidth or power is limited. MQTT works on a publish-subscribe model, where devices (publishers) send messages to a broker, which then distributes them to interested devices (subscribers). This approach is excellent for building responsive, real-time systems.

I recently experimented with setting up MQTT on a micro:bit using Beebotte as the broker and a CloudBoard to link multiple micro:bits together. My goal was to have these devices communicate seamlessly while sending and receiving JSON payloads. I also wanted to use the IoT MQTT Panel App to interact with the micro:bits, including controlling them with a slider and receiving data in real-time.



Connecting Multiple Micro:bits with CloudBoard


I used a CloudBoard to connect multiple micro:bits. This setup allowed them to communicate, ensuring that when one micro:bit received a slider value, it could broadcast it to the others. This could be perfect for creating synchronized displays, where each micro:bit shows the same number in real-time.

By setting up one Micro:bit as the master and the rest as slaves, I could monitor the entire network on the IoT MQTT Panel App.

Using IoT MQTT Panel App for Control

The IoT MQTT Panel App made it easy to monitor the micro:bits remotely.. It allowed me to create a slider linked to the input topic on Beebotte. With this setup, moving the slider on my phone instantly updated the number displayed on the master micro:bit

The app also let me monitor data sent from the micro:bits, such as their roll angles. 

As well as setting up MQTT we were also asked to come up with an idea for what we could use MQTT and IFTTT for. My idea would be to have a classroom map display on your phone, which, using motion sensors can display which classrooms are available to sit and study or do some work in. A good example of where to use this is the IT building as it can be tedious to search every floor before finding an available room.




IFTTT

IFTTT (If This Then That) is an automation platform that connects different apps, devices, and services to perform specific actions based on triggers.

Using IFTTT Through a Micro:Bit


The following lab we experimented with IFTTT and used webhooks sent via the Micro:Bit. I first had to set up an applet on the IFTTT website which is triggered by a webhook and sends me an email. The overall setup is quite easy and straightforward. All that is required is setting up an applet and acquiring the trigger name and your key in order to send a http post request containing the data relevant to the trigger.



The code on the microbit uses the MicroIOT extension as well as a Cloud board which allows me to connect to the internet and post data to the IFTTT service through a HTTP POST request. I used this to send data based on the pitch angle of the Micro:Bit which is included in the email. Once this angle is bigger than 100, the webhook is triggered and an email is sent



The 


Comments

Popular posts from this blog

Blog 2 - HRV Demo

Week 1: HRV Review

Blog 5 - FFT & HRV