Sensors in Building Automation
MQTT - the language that the Cloud can speak
1. What is MQTT?
2. Major characteristics of MQTT
3. MQTT and Niagara Framework®
MQ Telemetry Transport (MQTT) is a very simple client/server, publisher/subscriber, open and lightweight messaging transfer protocol. What is unique about this protocol, is that it is perfectly suited for IoT needs, because it has been designed for small devices with minimal resource requirements. Thus MQTT can often be seen in Smart Home automation systems alongside cloud services such as AWS, Google Cloud IoT Core, Microsoft Azure IoT, IBM IoT Platform and other cloud market leaders. Another important distinction is that this communication standard allows devices to publish messages that are not previously known or predetermined. ‘Whatever you say, I'm listening’ is true as long as the client subscribed to the related topic. The middleman is a broker which receives and stores the messages so they would be available for interested clients. That gives an advantage in case of not stable communication. There is no need for two clients to be ‘on-line’ at the same time to share information. As long as the message was received by the broker, it would wait for the interested subscriber whenever he would get a connection. Similar principles of work can be seen on Instagram, you don't need to be available 24/7, the posts from the profiles to which you are subscribed are waiting for you on the server.
MQTT Broker is responsible for receiving all the messages, filtering them, registering who is interested in them and redirecting the messages to interested clients. Additionally, as a boss of the protocol, it authenticates and authorizes clients.
Picture 1. Communication Schema in MQTT
Interesting Fact: You are probably using MQTT on a daily basis without even knowing it, that's because Facebook uses MQTT communication for Messenger Chats and on Instagram.
Basically, all Building Management Systems companies support MQTT in their BMS Software. Among them are Tridium's Niagara Framework® (version 4.2 or higher), Johnson Controls Metasys®, Schneider Electric’s EcoStructure™ and Lynxsprings Onyxx®. MQTT is one of those rare protocols which ‘cloud can speak’ and EDGE devices can process. Because of that MQTT is often called one of the best-known protocols for the Internet Of Things in the Building Automation Industry.
To better understand MQTT, it is essential to know the basic building blocks on which this protocol is built.
There are certain messages that MQTT devices use to communicate with the broker and vice versa. The main are the following:
MQTT is a secure protocol. The messages between the client and broker can use SSL/TLS encryption to ensure communication security over a network.
Message Structure in MQTT is designed to have a small footprint. The messages are consist of:
Picture 2. Structure of an MQTT Message
What's interesting is that QoS allows choosing the likelihood of message delivery between client and broker. There are three specified levels:
The implementation of MQTT is available in Niagara Framework® through the driver “Abstract MQTT Driver”. The driver contains three components:
It is possible to add multiple devices to the different brokers (Broker IP Address and Port must be specified) under one network. In each device, it is possible to choose one of three levels of Quality Of Service described previously.
The points under driver are standard type: Boolean, Numeric, String and Enum but with two variations: Publish (if you want to send data to the broker) and Subscribe (if you want to read data from the broker). Each point should contain a specified MQTT Topic.
Important to know that Niagara Framework® has a JSON toolkit that allows it to gather the data available on the station of the controller and allows it to publish that data via MQTT, oBIX, HTTP etc. in a fast and standardized way.
Other articles by this author
Sensors in Building Automation
Importance of Automation Control Panel
Can BMS save the World?