In my last blog post, we discussed the use of the Publish-Subscribe design pattern. Near the end of that post we introduced MQTT, and in this blog post we shall go more in depth on MQTT. The motivation in exploring and learning about MQTT is that it is a standard used for IoT applications which addresses several concerns around the emerging IoT space; lack of standards, security, and privacy. Much of what is presented here about the standard can also be found across a variety of other websites including Wikipedia and the MQTT homepage, the latter of which is a wonderful resource for exploring the standard in depth.
MQTT stands for MQ Telemetry Transport and is a lightweight publish-subscribe protocol that allows one to publish and receive notifications as a client. With this setup, one can establish communication channels among a network of devices. Additionally, the specification has been designed for low-bandwidth, unreliable, and/or high-latency networks which makes it ideal for IoT applications. The most recent MQTT standard at the time of this blog post is v3.1.1. By having a standard that industries can coalesce around, it opens the doors of application development to a larger audience. To provide a hypothetical example, consider the significance of manipulating your home energy use on a system that leverages IoT across a spectrum of devices. Let’s assume you have a smart dishwasher, clothes washer, and hot water heater connected to your network, but they are all made by different manufacturers. If there is no standard protocol, they cannot communicate with each other, but if there is a standard, MQTT in this case, they may be able to communicate key data between devices. Now the power of your smart devices is increased exponentially!
Now when you setup your clothes washer and dish washer and leave for the day, they both communicate with the hot water heater to determine when there is refreshed hot water after your family went through their morning shower routine. The clothes washer kicks off first and communicates this to the dishwasher so that they do not both drain the hot water heater too quickly. When the clothes washer has completed its use of water it notifies the dishwasher. The dishwasher messages the hot water heater and is notified that there is not adequate hot water remaining. It waits until it is notified by the hot water heater that it has refreshed to kick off its task. To amplify the significance, imagine if the power company could message through their power meter to your home network and let you know when they are below peak demand and offer you a lower rate on your power usage later that morning. The possibilities are only limited by the imagination of those making day-to-day activities more efficient. A necessary element needed was a standard communication protocol to make it happen, and MQTT provides part of the infrastructure to make that possible.
Other concerns around IoT are security and privacy. While having a device monitor personal data (health, fitness, etc.) may be wonderful, the makers of such wearables will need to offer some level of privacy and security to the user of such devices so that information may be kept confidential. MQTT v3.1 and beyond begin to address some of these concerns by allowing a user name and password to be sent with MQTT packets. Encryption across a network where MQTT packets are being sent can be handled with SSL, though using SSL in this manner will add network overhead. As always there is a tradeoff between security, privacy, and speed. Though one can add encryption to the data sent and received, this is not explicitly built into the protocol at this time. There is ongoing discussion within the IoT community about how to best address the encryption concerns, but given the maturing process of this protocol it may be sometime before consensus is reached.
Have an IoT idea in mind that you want to leverage MQTT and what it can offer? Contact us to make sure your application is a success!