Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Pushing Data from S7-1200 to Cloud


Published on

Presenter - Boris Cherkasskiy

The industry-wide demand to collect and present machine statistical and performance data is continually growing. While it’s possible to IoT-enable a machine with the use of an Intelligent Gateway or by utilizing an MES system, it might be cost-prohibitive for a small machine.

This session will present a solution that allows you to push data from an S7-1200 PLC directly to the cloud via standard MQTT protocol. Attendees will gain a quick path to Industry 4.0 using standard IoT protocol to connect a custom machine (or a cell/line) to an existing and fast-growing IoT infrastructure.

Published in: Engineering
  • Be the first to comment

Pushing Data from S7-1200 to Cloud

  1. 1. Pushing Data from S7-1200 to Cloud Automation Summit Boca Raton, FL, June 26-28, 2017
  2. 2. DMC Overview Established in 1996, DMC serves customers worldwide from offices in Chicago, Boston, Denver, Houston, New York, and St. Louis employees & growing 120+
  3. 3. Siemens Expertise 31 Siemens Certified Engineers
  4. 4. DMC Customers
  5. 5. Automotive Chemical & Food Processing Consumer Goods Defense Contracting Energy & Utilities Food & Beverage Packaging Pharmaceutical Printing & Textiles Semiconductor Special Machinery Telecommunications Test & Measurement Industries Served
  6. 6. Presenter Info • M.S. in Systems Engineering – Chelyabinsk State University (Russia) • With DMC since 2004 • Siemens Certified Professional • Embedded system experience Boris Cherkasskiy Principal Engineer (Denver)
  7. 7. Agenda • Project overview. Have this problem been solved before? • Communication options between PLC and IoT • Communication protocol implementation on PLC side • Overview of visualization platforms
  8. 8. • Goal: Report machine status to easy-accessible dashboard • Not an issue if you have SCADA/MES • Challenging for machine-level control system • Cost effective approach Project Overview
  9. 9. • Chart recorder (my personal favorite) • SCADA/MES system • OTS data collection options • Custom data collection solutions Classic Approach
  10. 10. • Utilize well-developed visualization platforms already available for IoT application • Minimize intermediate hardware/software • Use familiar technology (PLC) • Inexpensive/free to operate Proposed Solution Cloud-based visualization
  11. 11. • Simple to set up, no “programing” required* • Nearly real-time updates • Web interface • Mobile application Benefits of the Solution
  12. 12. • Another cool term? • Any device object connected to the Internet? • Can one thing talk to another thing? Sure thing! • It seems to be mostly used for dashboard-style applications • Multiple web-enabled visualization options Short Overview of IoT
  13. 13. • Target machine-level application • Easy to use, familiar to automation engineers • Supports variety of industrial protocols o ProfiNet o Modbus o ProfiBus • Unclear how to make it communicate to the existing IoT infrastructure Siemens S7-1200 Overview PLC protocols IoT protocols?
  14. 14. • On hardware level it could be anything, from custom audio (including Morse code!) to Ethernet, WiFi, etc. • Data protocols, could be anything too: IoT Protocols Overview Protocol Notes Custom protocols Application-specific, non-standard REST (Representational State Transfer) HTTP (Hypertext Transfer Protocol) Websocket (Part of HTML5) SOAP (Simple Object Access Protocol) Heavy to implement, requires extensive computing power/resources to create and parse human-readbe data (strings) MQTT and MQTT-SN Much simpler/lightweight protocol
  15. 15. • Works on to of the TCP/IP protocol (PLC-friendly) • Event-driven protocol • Publisher/subscriber architecture • Flexible message delivery/acknowledge mechanism (QoS) MQTT Protocol Overview Publisher Broker Subscriber Subscriber Subscriber Topic Topic Stat/Temp or Bottle_temp
  16. 16. MQTT Protocol. QoS Publisher Broker Subscriber Subscriber Subscriber Topic Topicat least once * QoS 2 is not supported by some platforms discussed later Stat/Temp or Bottle_temp
  17. 17. • Very simple protocol (the whole spec is ~50 pages) • Binary protocol o Low bandwidth o Small memory footprint • Widely accepted in IoT world • Supported by IBM/Facebook/Amazon/Microsoft/etc. • Lets implement MQTT on the PLC! Is MQTT Suitable for PLC/IoT Communication?
  18. 18. Simplicity of the protocol has some downsides: MQTT Downsides Issues Mitigation Data type is not defined as part of the protocol Vendor defines data formats. Just follow their rules No encryption implemented as part of the protocol Could run over SSL (requires Secure Sockets Layer)  But, SSL is not implemented on the PLC side  Login information transmitted as clear text Key/token is transmitted instead of the actual password There is no server identity verification Implemented as one way communication only. Predefined response size, harder to craft malicious packets All of the above Run your own local MQTT broker. Bridge local MQTT broker to the Internet via secured channel (MQTT over SSL, VPN, etc.)
  19. 19. • Could address security concerns • Easy to run your own broker (broker is pretty simple application) • Local MQTT Broker could bridge messages to another Broker • Example: Run Your Own MQTT Broker
  20. 20. Protocol Implementation on the PLC Side fcMQTT_string or fcMQTT_dint dbMQTT_Queue fbMQTT PLC NETWORK MQTT Broker (local or cloud) Overall Architecture Example is available here:
  21. 21. Protocol Implementation on the PLC Side PLC example
  22. 22. Demo Unit
  23. 23. Cloud-based broker is usually included with visualization platform. • Multiple Android-based dashboards. Probably the simplest option. • Adafruit – Targets DIY/makers community. Very simple to use. Still in “alpha” limited mode. • IBM Watson – Very capable, flexible platform. Not trivial for outsiders. • Microsoft – Probably pretty advanced. But… Data Visualization
  24. 24. There is one issue with it: Unencrypted MQTT is not allowed by default • Flexible IoT protocol gateway • Standard (unencrypted) MQTT implementation is actually one of the examples • Programming required – Partially defeats the ideal of “simple” solution • Probably worth future investigation/discussion Data Visualization – Microsoft Azure IoT Hub Where to find it:
  25. 25. • Very simple platform • May be a bit limited for advanced stuff • Only few things to configure: o Key is auto-generated o Feeds = topics o Dashboard through GUI o Still in “alpha” mode Data Visualization - Adafruit Where to find it:
  26. 26. Data Visualization - Adafruit Configuring/Viewing Feeds (topics)
  27. 27. Data visualization - Adafruit Configuring/Viewing Dashboard
  28. 28. • Advanced platform. May be a bit confusing to configure. • Example mapping IBM Watson fields to the MQTT topic. o MQTT topic: iot-2/evt/status/fmt/json o MQTT message example: {"d":{"OEE":66}} • Seems to be still work-in-progress with a few bugs here and there (selecting property in the card) Data Visualization – IBM Watson Where to find it:
  29. 29. Data Visualization – IBM Watson Configuring/Viewing Dashboard
  30. 30. Data Visualization – Android (MQTT Dash) Very easy to configure, but limited Where to find it: search “MQTT Dash” in Google Play
  31. 31. Questions?
  32. 32. Appendix PLC Implementation Details
  33. 33. Description of FCs • Only 2 blocks/data types implemented so far o DINT – Integer o String – Universal/everything else • Value may need special formatting (IBM) Protocol Implementation on the PLC Side fcMQTT_string sInTopic iInQoS sInValueFormat sInValue fcMQTT_dint sInTopic iInQoS sInValueFormat diInValue
  34. 34. Format String explanation • sInValueFormat is empty string – pass Value parameter as is • sInValueFormat is not empty – find and replace <<value>> in the format string with actual value and pass it to the queue Example: sInValueFormat: {"d":{"Message":”<<value>>”}} sInValue: “Hello world” String sent to the MQTT Broker: {"d":{"Message":”Hello world”}} Protocol Implementation on the PLC Side
  35. 35. Overview of fbMQTT input parameters • iInQueueSize – how many elements in the dbMQTT_Queue datablock • sInClientID – some services (IBM) requires specific Client ID • sInUserName – user name (usually, “use- token-auth” for IBM) • sInPassword – password/key/token • bInCleanSession – not very important for publishing. Set to 1 in most cases • bInResetError – Reset bit/push button/etc. Protocol Implementation on the PLC Side fbMQTT iInQueueSize sInClientID sInUserName sInPassword bInCleanSession bInResetError
  36. 36. End Presentation Track: Maintenance & Operations Connect Event ID Session #10.5