Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

“The Journey of an Excellent Engineer in Three Stages”

1. Basic Stage: Siemens PLC technology.

2. Intermediate Stage: Siemens TIA Portal and C# advanced language technology.

3. Advanced Stage: Standardized programming methods for PLCs.

The Path of Standardization!

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

Yesterday, I invited excellent engineers to share insights on four major industrial communication protocols. A group member organized his MQTT data acquisition project and shared it with me, which I am sharing with everyone because the collaboration of cloud, edge, and terminal is the trend in technological development!

Invitation for excellent engineers to share (1): Comparison of four major industrial communication protocols

I. System Configuration

1. Project Requirements

To collect sewage flow data from a certain location and upload it to the municipal cloud platform once every hour.

2. Software and Hardware Used

1) Siemens S7-1200 Smart.

2) Fanless Touch Screen (must have 4G network capability).

3) Cloud Server (Node-RED installed on the cloud server to read MQTT data and send it to the municipal platform).

II. MQTT Configuration of the Fanless Touch Screen

MQTT configuration for sending data, note the topic name lynw001/

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data PlatformData Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

III. Node-RED Development on the Cloud Server

1. Complete Workflow of Node-RED

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

2. Node-RED Reading Data from the Fanless Touch Screen

1) Node-RED connects to MQTT to obtain data, ensuring the topic name is consistent: lynw001/

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

2) Store MQTT data in Node-RED’s global variables for easy calculations.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

3) Trigger upload to the cloud platform at the third minute of every hour; the uploaded flow data is the cumulative total from the previous hour.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

4) Retrieve the timestamp from the previous hour.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

3. Node-RED Writing Data to the Municipal Platform

1) Use JSON data format to log in to the cloud platform and obtain a token.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data PlatformData Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

==200 Token obtained successfully;

!=200 Token acquisition failed, wait 1 minute and return to the previous step to obtain the token again.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

2) Store the token in a global variable.

Open Postman software to use the interface URL provided by the municipal cloud platform and log in with username and password to view the token data structure.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data PlatformData Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

3) The data format needs to be confirmed with the municipal platform management personnel.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

4) Combine the reported data.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

5) The request URL is the interface URL provided by the cloud platform.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

6) Determine if the request was successful; if not, wait 1 minute and return to the previous step.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

IV. Display Effect on the Municipal Platform

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

Conclusion: The collaboration of cloud, edge, and terminal is the trend in technological development!

Walk with the “Excellent Ones”!

Make technical learning simpler!

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

Learning methods for standardized PLC: a process from chaos to insight and understanding.

Technical methods for standardized PLC: what technical points are included in standardization? How are the relationships between technical points?

Video explanation of the technical route for standardized PLC: S88 standard, technical architecture, and continuous iteration.

Discussion group on TIA Portal: two groups discussing C# and SCL languages, finally clarifying the application of SCL language.

The value of group communication: real feedback from friends in the Siemens elite group over 6 years.

Book club agreement: release of three major supporting resources for TIA Portal PLC books.

Join the TIA Portal friends group and meet excellent engineers.

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

Teacher Rui’s books (available for purchase on JD and Dangdang)

Data Acquisition Project via MQTT: From Siemens PLC to Node-RED Cloud Server to Municipal Data Platform

Leave a Comment