Mqtt Stands for Message Queuing Telemetry Transport. Mqtt is based on the old ICQ messenger and works on top of TCP/IP network protocol. Because it uses a simple protocol the data transmitted is kept relatively small and this makes the Mqtt protocol well suited for fast, low bandwidth, communications and provides very small overhead on the network.
The Mqtt broker handles the flow of messages to and from multiple devices by using a subscribe and publish system. Basically only the devices or clients that are interested in a particular topic, that the message belongs to, will receive this message or be able to send a message.
When a message is published from a device it is assigned to a topic. All other devices that are subscribed to the same topic will be able to view that data. So the data could be a simple text value for example the temperature from a temperature sensor. Hence the data will be published to the topic, passed to the broker who will distribute it to all the interested devices/clients.
To sum it up “Publish” is to send data, and “Subscribe” is to receive the data.
The first version of the Mqtt protocol was developed by Andy Stanford who was a clerk at IBM, along with Arlen Nipper who worked at Cirrus in 1999. Since then it has grown as each version of the protocol has been expanded on and improved to what we have today.
With our modern micro controllers we have today that contain wifi connect-ability, this makes the Mqtt protocol perfect for many IOT(Internet Of Things) projects, hence fantastic to incorporate into a home automation environment.
- Publish – To send a message from a device to the broker
- Subscribe – To receive a message from the broker
- Topic – Separated by slashes: “/” and are case sensitive, specifies where to publish (send), or subscribe (receive) the data to/from.
- Message – Is the piece of data that gets sent to, or retrieved from the broker, for example: “27” is the message that is sent from the temperature sensor to the broker, representing 27 ^C.
- Broker – The software responsible for receiving and sending the messages to the correct devices.
- Mosquitto – An open source Mqtt broker that can be installed on Linux, Raspberry Pi and Pi zero, Mac, Windows.
Mosquitto can be downloaded from here