Page 20 - AutomationNotebook-Issue43-flip
P. 20

Cover Story
Cover Story
Does Your PLC Talk JSON?
The newest PLCs can communicate directly with internet websites, creating new automation possibilities.
The July 2019 issue of Control Engineering magazine featured a cover story describing how modern industrial controllers are now able to interact directly with internet resources. Titled Benefits of Connecting a PLC to the Internet, this article shows how users can enhance their automation systems to obtain live data directly from the internet. The following sections are adapted from that story.
By Eric Witcher, AutomationDirect
Programmable logic controllers (PLCs) have long been the preferred technology for reliably and quickly executing the control logic necessary
for performing industrial automation. PLCs originally worked just with their local hardwired input/output (I/O) connections, and eventually gained networking capabilities so they could communicate with human-machine interfaces (HMIs) or other
smart devices.
But even more is possible. End users are
familiar with the wealth of information available from various websites, viewable using browsers or dedicated apps. What if there was a way for PLCs to connect to the internet and obtain this type of helpful data? The latest generation of AutomationDirect Do-more PLCs (BRX PLCs) includes the PLC instructions and features to accomplish this task.
For example, irrigation, cooling tower, and HVAC applications could use the current and forecasted precipitation, humidity, and temperature conditions found online to fine-tune operation without needing operator interaction. A solar installation could determine the suns azimuth
and altitude for any known location and time. Information obtained from the internet may not be necessary for live control but could help operators in other ways, such as an HMI displaying live commodity prices.
Many useful websites already provide a programmatic way for users to obtain raw data. This is called an application programming interface (API). PLCs with the right instructions can be configured to
communicate with these kinds of internet resources using the API definition. The following PLC tools make this possible:
• Instructions for accessing hypertext transfer protocol (HTTP)
• Instructions for handling and parsing JavaScript object notation (JSON)
Using these instructions, PLCs can initiate HTTP communications with various websites and receive JSON data from them. The received JSON data must then be parsed to extract the desired information.
Browser Basics
Most people have used a web browser to navigate the internet. They are familiar with typing a website name into the browser address bar, sometimes preceded by “http://” (or “https://” for a secure site). A website address is formally known as uniform resource locator (URL), and this points to a specific domain and webpage. The HTTP protocol defines how applications can communicate over the world wide web (www). Specifically, HTTP describes how messages are formatted, transmitted, and handled.
When a user types a URL into a browser, an HTTP request is generated to the target web server, and the corresponding HTTP response is used to populate the browser display. Both HTTP requests and responses are lightweight text files, which are easy for software to create and parse.
Go to Article
Editor's Note
New Product Focus
- Headless C-more Remote HMI without attached display
- Continuous Flexing Profinet Cable
- ProductivityOpen Arduino-compatible Controller
- Hammond Industrial Enclosures
Tech Thread
Productivity®Open - Maker In, Industrial Out
Business Notes
Cover Story
Does Your PLC Talk JSON?
What's New
User Solutions
Roller Coaster Overhaul
Student Spotlight
Industrial Automation with a Mission
Break Room
Brain Teasers
continued >>
Cover Story www.automationnotebook.com | Issue 43


































































































   18   19   20   21   22