MQTT Protocol
Introduction
MQTT stands for "Message Query Telemetry Transport". It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks. The design principles are to minimise network bandwidth and device resource requirements whilst also attempting to ensure reliability and some degree of assurance of delivery. These principles also turn out to make the protocol ideal of the emerging “machine-to-machine” (M2M) or “Internet of Things” world of connected devices, and for mobile applications where bandwidth and battery power are at a premium.
MQTT is supported directly inside the IoT Builder product, making it easy to set up multi-device systems and manage communications between them.
What can you do with it ?
There are two main things you can do with MQTT and Proteus.
1) You can send a command to control an output.

MQTT command from Raspberry Pi tells Arduino client how to control the light.
Here, your mobile device connects with the Raspberry Pi via wi-fi and loads the virtual front panel. It then transmits a command intended for the arduino appliance via the remote user interface. This command is sent to the cloud MQTT server. The Arduino device will receive the command when it wakes up and checks in with the MQTT server and the firmware on the Arduino will interpret and execute the command.
The presence of the MQTT server in the cloud means that the Arduino can sleep for a user determined time and then wake up periodically to receive and execute commands.
2) You can read and publish data from a sensor.

Read data from a sensor appliance and publish to the virtual front panel.
In this case the sensor data is periodically sent to the MQTT cloud server. The Raspberry Pi reads this data, interprets in and displays it on the virtual front panel which is viewable on your connected mobile device.
In both cases the MQTT protocol is used as a bridge between the appliance (arduino) and control unit (raspberry pi). Using a broker in the cloud is not essential but means that the appliance can sleep for long periods of time which saves power.
Basic Concepts
In order to work with MQTT you'll need to first understand a few basic concepts which are explained in brief below. You can also find a wealth of resources on the internet with more detailed information.
See Also:
Publish/Subscribe
A device may publish messages to the other devices in the system and a device may subscribe to a particular topic to receive messages published to that topic. So if Device1 wants to send a command to Device2 it must publish a message to an agreed topic that Device2 has subscribed to.
Messages
Messages are simply information exchanged between your devices. They can consist of either commands or data.
Topics
Topics are the named 'postbox' for messages. They are how a device registers interest in receiving incoming messages and how a device specifies where it want to publish messages. Topics are represented by case sensitive strings with a forward slash '/' to indicate the topic level.
Broker
The broker is responsible for three jobs:
- Receiving all the messages.
- Filtering the messages.
- Publishing the messages to all subscribed clients.
QoS
QoS stands for Quality of Service. It determines how the message is sent. This comes in three forms:
QoS 0: At most once delivery. Receiver does not send a response. Sender does not retry and therefore will delete the message locally once it has been sent. The message arrives at the receiver once or not at all.
QoS 1: At least once delivery. Receiver acknowledges the PUBLISH packet using the PUBACK packet.
QoS 2: Exactly one delivery. Neither loss nor packet duplication is acceptable. This QoS level adds protocol overhead and specifies many rules for both sender and receiver. Packets PUBREC, PUBREL and PUBCOMP are involved instead of PUBACK used in QoS 1.
Mosquitto Broker
Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers. The installation and setup of the Mosquitto MQTT broker is a required step before you can start designing MQTT systems in Proteus. Fortunately, the process is fairly simple and is covered in some detail in the topic linked below.
See Also:
Multi-Appliance Systems
It's very common with MQTT systems to have more than one appliance. For example, you might have a raspberry Pi control unit and then one or more arduino sensor units reporting data back to the control unit. In version 8.11 this can only be simulation by having one copy of Proteus open for each appliance. All copies of Proteus would then need to have their simulations running at the same time and be using the same broker to communicate.
We are currently working on a multi-board system whereby more than one appliance can be simulated inside a single copy of Proteus. This will mean that the entire system (rPi, arduino, etc.) can be exercised within one running Proteus simulation. We expect this work to be completed and released with the launch of Proteus v8.12