×
Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 109748872, Entry date: 08/14/2019
(15)
Rate

FB "LMQTT_Client" for SIMATIC S7-CPU

  • 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 TIA Portal V15.1 (1,1 MB)

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

Last Changes
Subscribe mechanism added for an secure messaging

Archive
In the archive you find the old "LMqtt_Publisher" function blocks for TIA Portal V15 with unencrypted messaging.
 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
https://www.siemens.com/cybersecurity#Ouraspiration.