Blog 2 - MQTT - John O'Mahony
This blog will focus on my experience with MQTT over the past couple weeks as well as some background info on the technology that I researched.
What is MQTT?
MQTT or Message Queueing Telemetry Transport is an OASIS standard messaging protocol, OASIS standing for Organisation for the Advancement of Structured Information Standards which is an international non-profit body that publishes open standards for various areas of computing. MQTT is designed as a publish/subscribe messaging transport, which from my understanding means senders and receivers are decoupled from each other. So for instance a publisher sends a message with a topic which is like a path such as schools/inputs in our case, but won't know if or when it's received. The broker routes all messages and subscribers tell the broker which topic they're interested in.
MQTT is used in a wide array of industries from telecommunications to oil and gas where it originated in 1999 where it was used to monitor oil pipelines.
Today, some of the specific applications of MQTT include smart home devices such as Amazon Alexa communicating with lights and thermostats, and in healthcare with medical devices that stream patient data like heartrate to hospital systems.
First Experience with MQTT
For our introduction to working with MQTT, Jason set up a master/broker with beebotte and a few slaves that he ran javascript code on which he provided to us so we could look through it and modify it ourselves on microbit.
The device served as a gateway bridge between the slaves and the internet allowing us to use the IoT MQTT Panel app on our phones to mess with them.
From here we modified the slave code to each use a different input/output number (mine was 4). This allowed us all to operate on our on boards individually. The code sent a message to the beebotte when it was rotated and also kept an LED on whenever the board was on. I set up the dash on the app with the details Jason gave us and messed around with it a bit by setting up a dial to measure analogue input, a slider to that output the number it landed on in the LEDs and a graph to display the lads input/output as well as my own.
This concluded our session and during the next one we had to figure out how to send an email to ourselves after the board hit a rotate threshold. I spent this session looking into IFTTT webhooks and Node red but unfortunately was not able to make sense of any of it.
After this I missed the next 2 sessions because I was sick. I should have reached out to one of the lad's and asked them about what I missed and we discussed this in the next session. It was suggested and agreed upon that in the session after that one we would have a Node Red group session in order to figure it out and get everyone up to speed with it which I am very grateful for, especially George who set up a lab for us and guided us through it.
In this lab I ran Node Red on a docker container (which I initially had some issues with but that was just me not having enough storage) and used it to send an email to myself which would be the foundation of sending an email to myself after the board has reached a rotation threshold.
Node-RED is a coding tool for visual programming made by IBM for use in IoT. It uses a web browser flow editor and in my opinion is much easier to work with and less daunting than the likes of python scripts for a task like this.
My Node-RED components only really consisted of an injection which contained the message I wanted to send to my email and would act as the trigger, and the email node, which contained the email address as well as the app password that I setup.
The first email is from myself, and the other 20 something are from Matteo who used my email with his nodes.
Reflection
These last few sessions were really helpful and interesting as I've never worked with stuff like this before. Trying to figure out the Node-RED stuff myself was a bit daunting and I felt bad for having not really contributed after that session but the talk we had and George's lab got me back on track and I'm thankful for that, and I hope I can help the lads in the same way if they ever need it, which has bolstered my motivation.
Comments
Post a Comment