No kidding. Raspberry Pi, Arduino and other


[PDF]No kidding. Raspberry Pi, Arduino and other...

5 downloads 202 Views 716KB Size

?

Seriously

No kidding. Raspberry Pi, Arduino and other computers on open-source silicon boards are on the way for do-it-yourself monitoring—and even control. by Jim Montague

34 • SEPTEMBER 2017

www.controlglobal.com

CONNECT AND CONTROL

DON'T stop us if you've heard this one. "One co-op student this summer was looking for the Raspberry Pi he was using to set up an HVAC damping system, and asked the 25 people at our daily huddle," says Sandra Buffett, P.Eng., founder and CEO at Jordan Engineering Inc. (www.jrdneng.com), a CSIA-member system integrator in Niagara, Ontario. "After the huddle, one guy asked, 'What's this pie everyone's talking about?' " (Cue drum-and-cymbal.) Ba-dum, chhh! While unfamiliar terms are quickly cleared up, learning new concepts and technologies usually takes longer. Even those inthe-know at Jordan aren't all Raspberry Pi experts yet. "We began learning about it when one of our chemical compounding clients put one on the back of a wall-mounted TV monitor with an Ethernet jack and WiFi to display alarms and notifications on their plant floor," says Buffett. "This let them go from a typical LED display scrolling text, upgrade to more graphics, colors and maybe dashboards, and gain those capabilities with less expense." Buffett reports some of Jordan's engineers bought a couple of Raspberry Pi kits and adapters two years ago, started playing with one, and gave the other away at one of its annual automation workshops. "We're very relationship-based, and we partner with our clients for a long time," explains Buffett. "We've been holding our workshops for the past 14 years. They usually include staff presentations and project demos, and give everyone a chance to sit down and swap useful information. This past May, we did workshops in three cities for the first time, and gave away Raspberry Pi's to 150 clients with help from Schneider Electric Canada (www.schneider-electric.com), which has been a partner for 18 years." During the workshops, Schneider Electric conducted a lab for attendees to explore Raspberry Pi. "To open their minds to its possibilities, groups at each table came up with different ideas about how to use Raspberry Pi, such as monitoring the weather, energy prices, interest rates and inventory costs, which could empower their operators by helping them make better decisions on the best times to make their products," adds Buffett. "Our co-op student completed the design of his demo project to dampen the HVAC system in a two-story house, and deliver more heat to the lower floors in winter and more cooling to upper floors in summer. "We're not using Raspberry Pi on plant floors or for critical or safety controls. It's best for monitoring and non-critical functions right now, and making small improvements you couldn't do otherwise. Many users like us have little applications that used to be prohibitively expensive to monitor and control. Well, now we can do them. We don't think of Raspberry Pi as taking away from PLCs and DCSs because it can also do monitoring and provide alerts to them." www.controlglobal.com

Long time to overnight success New names and learning curves aside, almost everyone had to know this was coming. The moment analog signals and data began to be sliced and diced into strings of digital snapshots 40 years ago, the eventual emergence of computing with open-source software on generic silicon boards for monitoring and control was inevitable. Likewise, just as other wiring and devices become more commoditized and as software becomes more open-source, some process engineers, system integrators and developers are asking why they have to pay several thousand dollars for controllers with only $40-50 worth of hardware inside. This is coaxing embedded computing boards out of the shadows, and enabling devel-

"Many users have little applications that used to be prohibitively expensive to monitor and control. Well, now we can do them. We don't think of Raspberry Pi as taking away from PLCs and DCSs because it can also do monitoring and provide alerts to them." opers to begin freeing them from proprietary configurations and formats—often at the request of their end users, as was the case at Jordan Engineering. So, while it can seem like Raspberry Pi, Arduino and similar devices came out of nowhere, these boards have a long history in the computing field. "The typical PLC today can cost $5,000-$7,000 and can help run a whole plant on one server with its I/O connections to field devices via its dedicated backplane, but the computing power inside that PLC is typically only worth about $100," says Abhijit Jog, vice president of projects at Panacea Technologies Inc. (www.panaceatech.com), a CSIA-member system integrator in Montgomeryville, Pa. "Now, Raspberry Pi and similar computers are popular, but they've existed since microcontrollers first become available in the early 1980s when PLCs and many types of proprietary machine controls emerged. In fact, I did my B.S.S.E. project at KLS Gogte Institute of Technology [www.git.edu] in India by designing a basic board, and developing a two-axis control program for positioning a drilling device. "For a long time, it was just easier to use standard controls from large, individual suppliers, but lately all I/O is distributed and connected to PLCs via Ethernet, so there's more flexibility and no reason to keep brains in one box because they can be in a server on a rack or in the cloud. What's been lacking is a server-based machine that runs PLC-style software in a deterministic way, but Dell [www. dell.com] and other manufacturers have standardized servers that just need the right software to run like a PLC, and Codesys has come out with scalable control software that's very flexible, so we'll get there sooner or later." Codesys (www.codesys.com) is a development environment for programming PLCs using the IEC 61131-3 standard. It recently launched an adapted control runtime system, SEPTEMBER 2017 • 35

CONNECT AND CONTROL

ARDUINO PUMPS UP FLOW Figure 1: Partners Doug Reneker and Peter Welander have deployed an open-source Arduino Uno board and Adafruit shield expansion board to start and control a simple process loop that includes a 3051SFP Rosemount flowmeter, Fisher Gen2 easy-Drive electric actuator, Everbuilt sump pump and Rhino 24 V, 4 A power supply, PVC pipe and a large water bucket. The project overcame several electrical signal differences and interface/display issues, which enabled the Arduino to manage the industrial components. Source: Peter Welander

illumination for our newly developed control system, which could have required thousands of dollars worth of software. However, our intern, Terry Orchard, used a Raspberry Pi 3 running Linux software programmed with Python language to manage I/O, a camera, the video feed, software library and RESTful application program interface (API), and completed the prototype proof-of-concept in four days for less than $100." Jaroslav Sobota, head of customer success and control system engineer at Czech Republic-based Rex Controls (www.rexcontrols.com), adds, "We've been considering using Raspberry Pi for monitoring and control ever since it was introduced to the market, but we got serious about it when model B+ was released in 2014. Our answer is a clear 'yes' that Raspberry Pi is a perfect platform for programmable data loggers, data bridges or communication gateways. Especially in this era of the Industrial Internet of Things (IIoT) and Industrie 4.0, the Raspberry Pi definitely has a place in the world of PLCs, PACs and IPCs. However, one must understand that using Raspberry Pi in industrial environments might be a bit tricky, mainly because of its uncommon 5 VDC power supply and microUSB power supply connector. It also does not have any standard industrial interface like RS-485 or 24 V-tolerant inputs."

Board basics for process

Raspberry Pi SL, which contains a Codesys control application for all Raspberry Pi devices, including its compute module and extension modules, Raspberry PiFace Digital, Raspberry Pi Camera and several devices/breakouts with SPI, I²C or one-wire communication interface. Benson Hougland, vice president of marketing and product strategy at Opto 22 (www.opto22.com), adds that, "The notion of massive I/O systems homerunned to a central PLC or DCS is dated 36 • SEPTEMBER 2017

thinking. Today, I/O termination and conditioning is occurring remotely or at the network edge. Now, users can run a Raspberry Pi on edge devices for remote I/O at very low cost. Plus, moving process and plant data through a $35 Raspberry Pi or other single-board computer proves that IIoT can work without having to use a $5,000 PLC. In fact, our engineering vice president, Ken Johnson, challenged his team to prototype a vision system to test and confirm LED

While it might initially seem foolish to attempt monitoring, let alone process control, using a generic computer board, Doug Reneker, just-retired senior manager at broadband access supplier ARRIS Technology (www.arris.com) and technical writer Peter Welander recently collaborated on a demonstration project that employed a cigarette pack-sized Arduino Uno board, an Adafruit shield stacked on top to help with the display, one sensor and one actuator to start a pump, and a flowmeter to measure water flow. "There are a lot of maker boards available like Raspberry Pi, Arduino and Beagle Bones, but we decided Arduino would be easiest because of the simple environwww.controlglobal.com

Your Global Automation Partner

ment that its code runs in," says Reneker. "We programmed a start-up routine written in C called 'setup()' that gets executed once at the beginning, and a second routine called 'loop()' that's called repeatedly once ‘setup()’ has completed. Nothing else goes on. Next, we used an algorithm to read the sensor in 'loop,' calculate the difference with a setpoint, apply proportional and integral terms, adjust both in about 100 milliseconds, and create a control report." This simple setup includes a 3051SFP Rosemount flowmeter borrowed from Emerson Automation Solutions (www.emerson. com), Fisher Gen2 easy-Drive electric actuator that works with the Arduino board, Everbuilt sump pump and Rhino 24 V, 4 A power supply, PVC pipe and a large water bucket (Figure 1). This is a very basic process control application, of course, but Reneker reports there were several complications in arranging the industrial controls to work with the $20 open-source board. "Industrial controls require 4-20 mA current loop, but Arduino senses 0 to 5 volts for analog input, and drives 500 Hz pulse-width modulation for analog output," explained Reneker. "While the programming may be easy, pulse width modulation (PWM) at 500 Hz doesn't look at all like a current loop." Reneker adds that he and Welander also added a BRX PLC from Automationdirect (www.automationdirect.com) in the project's second phase to manage the display and HMI on their water pump system. While the PLC didn't interact with the Arduino, they were able to compare implementing each. "With Arduino, we had to write the software for the setup() and loop() functions, build its circuit and LCD display, bracket with potentiometers, add other hardware, secure the flowmeter, and hook up the PLC for the display," says Reneker. "With the PLC, it's more for the all-encompassing factors of an application. I programmed it with a laptop and the supplier's software, and it already had PID instructions inside. However, if you're not a skilled automation person, you'll need to find someone to program in ladder logic, and set up alarms, communications and other functions." www.controlglobal.com

Because of the added programming and configuration effort that Arduino requires, Reneker adds it's important for potential users to answer three questions before trying to design and build it into an application: • What are the actual functions that need to be performed? For example, is flow being monitored, or does it need to be controlled? • How will it verify that its functions are performed? Is a display enough, or is some kind of external supervision needed? • Once monitoring and/or control tasks are automated, what kind of data acquisition and archiving is needed? "Arduino's memory is limited, but you can add infrastructure and communications to it—even a cell phone adapter," adds Reneker. "We couldn't find a current loop interface, but there are so many makers involved that's it like browsing the items at a flea market. You just need to determine how you're going to use it, and learn what's standard for that function. "Arduino is ubiquitous, and that's what makes it attractive. Arduino, Raspberry Pi and the other boards have huge communities of users you can turn to for advice. Many kids even have a good idea how to use it. So when we write code, we know what to expect. We can see the voltage on a pin, and provide inputs and timing. The entry level for understanding Arduino is low and the process is gentle. You can get in and run with it, and build on pieces around if for all kinds of tasks. "However, you may also have to decide if you're buying into some added problems. Do you have to consider safety requirements and certifications? Do you have the right electrical isolation? There are many dilemmas like this to settle. How much do you want to build and program yourself? How many features and capabilities do you want to buy? You just have to decide how much of the wheel you want to reinvent." [For more coverage of Reneker and Welander's project, read "Arduino vs. PLC for industrial control" at www.controldesign. com/articles/2017/arduino-vs-plc-for-industrial-control. A video about it is at www.controlglobal.com/articles/2017/arduino.]

Not suitable for repairing flimsy connectors (or your reputation).

Rugged, reliable industrial automation products from Turck are built to perform in the toughest conditions, and our engineered solutions are customized to meet your application challenges. Cheap knock-offs can’t compare. Turck works!

Overmolded Deutsch Connectors Designed for longevity in demanding environments where shock, vibration, cold, moisture and oils can affect performance.

Call 1-800-544-7769 or visit info.turck.us/connectivity SEPTEMBER 2017 • 37

CONNECT AND CONTROL

Ethernet parallels computing future Before approaching board-level, open-source computing, some potential users are examining other technologies that developed along similar lines, and found that Ethernet's evolution was instructive. At first, Ethernet was only in office and physical plant systems, but not on the plant floor because it wasn't deterministic or rugged enough. However, a few users began snaking Cat 5 cables over to a production line or process application to "just gather one signal or value." In a few years, Ethernet was everywhere on the plant floor, and boardlevel computers are likely going to do the same. "In the mid-1980s, I recognized that Ethernet wasn't deterministic, but I played with it and used it for some data acquisition tasks," says Rick Caldwell, president of SCADAware (www.

Config

Application – Adaption on Sercos

EasySlave API

Parameter

EasySlave Stack

EasySlave FPGA

Peripheral API

HW – Peripheral Module

SHIELDING THE BOARD Figure 2: Sercos International and Steinbeis EST report their EasySlave Sercos III slave protoyping kit uses an Arduino board as a rapid prototype platform. It has a shield expansion board with Sercos EasySlave FPGA, peripheral components and open-source software to create prototypical Sercos application from which corresponding Sercos III devices are derived and implemented. Source: Sercos International and Steinbeis EST

38 • SEPTEMBER 2017

SCADAware.com) a CSIA-member system integrator in Normal, Ill. "Because Ethernet communicates by speaking, listening for collisions, and speaking again if there were any, we didn’t consider it for control. Later, Ethernet switching hubs (switches) allowed communications on Ethernet to be more practical in industry since each port was a separate collision domain. This allowed each device to be on its own collision domain, minimizing data collisions. This is still not deterministic, but it is fast and reliable. In the early 1990s, someone came up with Ethernet-based I/O and we connected each I/O block to a separate port on the Ethernet switch. I was the rebel back then, but now our engineers are asking if they can try to use Raspberry Pi or similar boards in our status lights and wireless sounders, and I have to be the conservative one that asks if their I/O is sufficiently isolated." Caldwell adds when SCADAware developed its StatusLight line of Andon stack lights to work with its StatusWatch OEE reporting software in 2008, it bought $250 ARM boards with proprietary field programmable gate arrays (FPGA). "One reason our engineers favor trying Raspberry Pi is because it has hundreds of megabytes of RAM, video and an ARM processor for just $3060. It just lacks the hardened I/O, temperature specs and vibration specs that we need." Despite these limits, SCADAware's engineers continue to experiment with their boards, and build small monitoring systems. "Our first Pi project was a production line monitor. We combined a Pi and a photo eye to count parts and read a digital signal from the VFD to determine when the line was running," says Kevin Garman, project engineer at SCADAware. "Experimentation with new technologies is much easier in a monitoring role because it’s not likely to cause downtime. I think the Raspberry Pi is a great choice because it’s very accessible, it’s cheap, and it has a good track record. That said, it would be nice to have onboard hardened I/O and industrial temperature ratings." The Raspberry Pi requires a second board to handle I/O. Who should design and add the fasteners to connect these two boards and other support structures for board-level devices? Caldwell says the board's manufacturer should do it, but Brian Teagarden, senior engineer at SCADAware, says the board's buyers should determine how to protect it for their particular application. "Sometines we're talking about small quantities of boards being used by small shops, and the broad availability of these inexpensive boards means we're able to easily swap them out for different manufacturers or newer models as the need arises," says Teagarden. "These boards are fun to work on and there's a lot of exciting software available, and it helps that there's a large user base out there. If you're going to use a board like a Raspberry Pi, you have to test it for your own environment, and make certain it's good enough." Garman adds, "I think we're currently undecided about advertising our use of Raspberry Pi-type boards. It seems that it could be an issue for some customers, while it might be a selling point for others." www.controlglobal.com

CONNECT AND CONTROL

Your Global Automation Partner

Panacea's Jog reports that one way to approach Raspberry Pi and its counterparts is to use them as thin-client HMIs combined with monitors and keyboards. "Most of our projects use VMware [www.vmware.com] for the computing infrastructure, while using flexible HMIs," he explains. "We've executed projects to replace old, unsupported PanelView HMIs with iPads, which doesn't require us to remove the old displays. We put a QR code on the old panel, the iPad takes a picture of it, and the right display comes up on the tablet. We could also use desktop monitors as HMIs by putting a Raspberry Pi on the back, and making a remote desktop connection through it, while the actual software and application could be elsewhere. People coming into industry have consumer technology-driven expectations—they want to drive things with their phones and tablet PCs. They're asking questions like why can't they acknowledge an alarm with a text? That's why we focus on new technology. "Previously, we had individual engineering computers to work on projects, but they were often security headaches because they could be infected with USB sticks and were used to access the Internet. Now, we have virtual engineering stations running in private clouds to execute client projects, but we use Raspberry Pis to access protected environments that only allow selected access. This is less costly than individual workstations, and it's more secure because files are automatically saved to the cloud, and there's no connection to the outside Internet."

Protection, accessories essential Because Arduino, Raspberry Pi and the other ARM-based devices are basically naked computing hardware that used to be embedded until they escaped from their dedicated enclosures, their first task is to "get some clothes on" that can protect them. Because they're mainly raw computing capability, they typically need stack-on boards, clip-on accessories, support software and other tools that can help them cooperate with the applications that need their computing power. Each board format seems to have a different name for these accessories, such as shields, hats, capes and others. www.controlglobal.com

"Single-board computers like Raspberry Pi are a ton of fun, but they're fragile, and their Pi hats can burn up," says Ben Orchard, application engineer at Opto 22. "This is why Opto 22 decided to build an interface from a Raspberry Pi to industrial I/O, which play beautifully in edge devices using Linux software and RESTful API format for designing network applications and communicating with controls and software libraries." Opto 22's Hougland adds, "To make our solutions work with boards like Raspberry Pi, we introduced our Digital I/O Carrier Board last year, which comes in a starter kit and includes a digital I/O rack, four digital I/O modules and Raspberry Pi carrier board. A standard 40-pin header is also provided for accessing unused GPIO pins on the Pi. We're also providing alternative industry protocols, such as a RESTful API to exchange web data via HTTP and JavaScript Object Notation (JSON) data-interchange format. Plus, we're working with NodeRED [https://nodered.org] drag-and-drop, graphical tool and the Python programming language [www.python.org]." Node-RED is a flow-based programming tool for stitching together hardware devices, APIs and online services. Its browser-based editor makes it easy to "wire together" flows using a range of nodes in its palette that can be deployed to its runtime in one click. [For an educational blog post, "How to Build a Raspberry Pi with Node-Red and Industrial GPIO" by Benson Hougland, visit http://blog.opto22.com/optoblog/how-tobuild-a-raspberry-pi-with-node-red-andindustrial-gpio] Rex's Sobota adds, "An add-on board is a must. It should allow using a 24 VDC power supply or better yet a 10-30 VDC power supply range. This is enough for Ethernet-based solutions, such as reading data from a PLC via Modbus TCP and pushing it to a database or cloud service. An added Ethernet port is handy, and it can be easily provided with an USB Ethernet adapter." Sobota adds that an RS-485 port is also a good idea. "Some consider this interface

We’ve got a cable for that.

Our Reelfast™ bulk cable program inventories more than 5.5 million meters of cable for countless industrial and process automation applications. You’ll get precisely the cable you want in exactly the length you need. Custom design available.

Call 1-800-544-7769 or visit turck.us/bulkcable SEPTEMBER 2017 • 39

CONNECT AND CONTROL

obsolete, but I believe it will be available at the plant-floor for at least another decade. It's especially important for using the Raspberry Pi as an Ethernet interface for older PLCs and devices that don't have an Ethernet port. A Raspberry Pi with RS-485 port is invaluable for integrating older systems into ERP/BMS systems." Similarly, Sercos International (www.sercos.org) and Steinbeis Embedded Systems Technologies (EST) GmbH (www.steinbeis-est. de) report their EasySlave Sercos III slave protoyping kit uses an Arduino board as a rapid prototype platform, shield expansion board with Sercos EasySlave FPGA, peripheral components and opensource software to create a prototypical Sercos application from which corresponding Sercos III devices are derived (Figure 2). "Sercos EasySlave kit for Arduino offers the chance to connect applications to Sercos via a simple API without major development," says Christian Hayer, managing director at Steinbeis EST. "Combining with the numerous shields available from other manufacturers lets users perform diverse realizations of their applications.”

Play to find opportunities While "testing" might sound more acceptable than "playing" to many engineers and other technical professionals evaluating open-source, board-level computers, several system integrator report that play is exactly the right idea because it allows potential users to see where these devices might be useful in their applications. Jordan Engineering's Buffett agrees that the best way to understand how Raspberry Pi or other generic computers work and can be applied is to simply play with them. "Innovations come from this play, so carve out some time to just use them and learn their capabilities," suggested Buffett. "Later, when you're back on the plant floor or in a meeting, something will click when an opportunity comes up, and you'll recognize where Raspberry Pi can be applied. For instance, when

NEW AZBIL SMART ESD DEVICE FOR SAFETY INSTRUMENTED SYSTEMS Azbil's Smart ESD Device 700 series (700SIS) acts as the interface for an emergency shutdown valve in a safety Instrumented system. Compliant with the IEC61508 international standard for functional safety, the 700SIS has been certified for applications that require SIL 3 according to IEC 61508. Its partial stroke test (PST) function for online diagnosis of emergency shutdown valves helps to maintain and improve the safety integrity level while reducing the cost of operation and plant design. Advanced integration using HART communication is also possible. Azbil, www.azbil.com/products/bi/iap/products/ hfbs/index.html

40 • SEPTEMBER 2017

we introduced desktop PCs running Wonderware InTouch software to a paper mill about 23-24 years ago, its staff hadn't used a mouse before, and they were very timid. So we taught them to play solitaire to gain mouse skills, and built a game with on-screen buttons, sliders, trends and numbers. This let them see what was possible with the PC, which let them visualize how they could use it to better control their process. The same is possible with Raspberry Pi today." Rex's Sobota also advises potential users to not wait. "Go for it! Don't think about the Raspberry Pi as a standalone device, but as a CPU module to build upon," he concludes. "There are already add-on boards available, ranging from prototyping platforms like RasPiBox Open+ to robust platforms like Monarco Hat. I mean it, give it a try! Raspberry Pi opens new possibilities, it gives you the freedom to build your own solutions tailored to your factory and processes with minimal budget. It gives you the freedom to decide whether to use it only in proof-of-concept stages of projects or continue using it 24/7 at floor level. Or throw it away after a few attempts if you find out it's not your cup of tea. Also, don't be afraid of Linux! There are software packages, such as Rex Control System, which allow you to program the Raspberry Pi from your desktop PC so your interaction with Linux is minimized. "On the other hand, always think twice about the consequences. What environment will the device operate in? Operating temperature and vibrations are known to be the most critical. What happens when the Raspberry Pi fails? Not having real-time data on displays at floor level can hurt but certainly not as much as stopping the whole production line. If necessary, will it be possible to switch to another hardware platform without starting software development from scratch? Those are the types of questions you should be asking. In short, Raspberry Pi gives you freedom, but keep in mind that freedom comes with responsibilities."

Innovation is inevitable So where are all these open-source, board-level computers going? With their cheap-as-dirt prices and ever-increasing power and speed, anywhere their users want to apply them. Their presence is already multiplying in the hobbyist and consumer sectors, which likely guarantees their growth on the plant floor, too. Panacea's Jog adds, "Some of our engineers are active in Raspberry Pi and similar maker communities, and we see it filtering into the automation industry. Suppliers can't sell a $5,000 device when a $100 one is available. The first company that comes up with a virtual controller running on a standard server will disrupt the current business model and do a lot of business. "However, this also means the job of process control engineer is no longer just about controlling valves and loops. When you're managing networks, servers and cloud, you need to know a lot more. Twenty years ago, control engineers tuned loops, which got a little simpler with auto-tuning software. As we transitioned to PLCs, programming them was valued more than traditional tuning skills. What's going on now is just another transition, and we can make it through this one, too." www.controlglobal.com