Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 109748872, Entry date: 03/24/2020


  • Entry
  • Associated product(s)
The “Message Queue Telemetry Transport” is a simple protocol on TCP/IP level. It is suitable for messaging between devices with minimum functionality and for transmission via unreliable networks.

With the function block from the "LMQTT_Client" library, the MQTT protocol is implemented into a SIMATIC S7-1500 and SIMATIC S7-1200.

Lean and fast: MQTT
The “Message Queue Telemetry Transport” is a simply structured binary Publish/ Subscribe protocol on TCP/IP level. It is suitable for messaging between devices with minimum functionality and for transmission via unreliable networks with low bandwith and high latency. With these characteristics, MQTT plays a vital role for the IoT and in M2M communication.

Application-related implementation
The "LMQTT_Client" library provides you with one function block each for the S7-1500 CPU and S7-1200 CPU. The “LMQTT_Client” function block integrates the MQTT client function and allows you to transmit MQTT messages to a broker (publisher role) and to create subscriptions (subscriber role). In this, the communication can be secured via a TLS connection. You can reach the broker with a static ip address or a qualified domain name.
The following picture shows the secure mqtt-messaging with a SIMATIC S7-1500.

Fig. 1
Advantages of MQTT
The MQTT protocol stands out with the following characteristics:
  • Light-weight protocol with low transport overhead

  • Minimum requirement for network bandwith thanks to push mechanism

  • Function for re-connecting after disconnection

  • Re-sending messages after disconnection

  • Mechanism for notifying interested parties after an unpredicted disconnection of a client

  • Simple use and implementation thanks to a small set of commands

  • Quality of Service (QoS level) with different reliability levels for the message delivery

  • Optional encryption of messages via SSL/TLS

  • Authentification of publishers and subscribers via user name and password

Documentation and project example for an secure messaging (S7-1500, S7-1200)
  Documentation (1,9 MB)
 Registrierung notwendig  "LMQTT_Client" library for STEP 7 V15.1 (1,9 MB)
 Registrierung notwendig  "LMQTT_Client" library for STEP 7 V16 (2,7 MB)
 Registrierung notwendig  Project for STEP 7 V16 (5,4 MB)

Using MQTT with a qualified domain name is only possible with SIMATIC S7-1500.

ast Changes
Subscribe mechanism added for an secure messaging

In the archive you find the old "LMqtt_Publisher" function blocks for TIA Portal V15 with unencrypted messaging. These can also be used with SIMATIC S7-300 CPUs.
 Registrierung notwendig  Archiv.zip (21,8 MB)

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.