Humble Arduino As PLC

On the surface, a programmable logic controller (PLC) might seem like nothing more than a generic microcontroller, perhaps outfitted to operate in industrial settings with things like high temperatures or harsh vibrations. While this is true to some extent, PLCs also have an international standard for their architecture and programming languages. This standard is maintained by the International Electrotechnical Commission, making it so that any device built under these specifications will be recognizable to control engineers and maintenance personnel worldwide. And, if you use this standard when working with certain Arduinos, this common platform can become a standard-compliant PLC as well.

The IDE itself supports programming ladder diagrams, functional block diagrams, and other programming systems covered under the IEC 61131-3 standard. Not only that, it allows the combination of these types of PLC programming with Arduino sketches. The system offers many of the perks of PLC programming alongside the familiar Arduino platform, and supports a number of protocols as well including CANOpen, Modbus RTU, and Modbus TCP. It can also be used for monitoring a PLC system, essentially adding IoT capabilities to existing systems, enabling continuous monitoring, debugging, and program updates.

While not every Arduino is a great platform to build a PLC around, there are a few available for those looking for a system a little less proprietary and a little more user-friendly than typical PLC systems tend to be. There’s a reason that PLCs are built around an international standard and generally have certain hardware in mind to run it, though, and this comparison of a Raspberry Pi with an off-the-shelf PLC goes into detail about why certain components aren’t good choices for PLCs.

Jared Holladay

The Safest Model Roller Coaster

[Jared Holladay] is a computer engineering student at the University of Cincinnati and a life-long roller coaster fanatic. A lot of people look at roller coasters as an exciting example of physics, like potential energy versus kinetic energy or inertia, and rightly so. [Jared] looks at them and wonders about the controls. Video also below and there is a feature-length explanation with more details. Some Hackaday readers and writers can identify the components, so we think his coaster model belongs here.

Like many folks in this field, he’s built K’nex models to get a handle on construction. He’s toured STEM shows with the tracks and undoubtedly wowed kids, adults, and physics teachers, but since he can speak to the programming, he is a triple threat. Now, he’s growing out of the toy construction plastic and moving into 3D printed parts with needle-fine tolerances.

His latest base is extruded aluminum, like what you’d want in a rigid CNC or printer. In addition to the industrial-grade surface, Rockwell Automation sent him a safety programmable logic controller, PLC, and a touchscreen HMI. Our fellows in the industry tell us those are far beyond the price scope of regular hobbyists. But fear not; your Arduino clones will suffice until you get your first grant.

The point of all the ruggedized hardware, aside from authenticity, is to implement safety features the same way you would in the industry. The redundant PLC connects to inductive prox sensors to check train speed and location. Other moving parts, like friction brakes, have sensors to report if there is a jam. After all, it’s no good if you can’t stop a train full of people. There are hundreds of things that can go wrong. Just ask [Jared] because he programmed on-screen indicators for all of them and classified them to let an operator know if they can keep the ride moving or if they need to call maintenance.

Not all homemade coasters are scale models, and some of the traditional ones have more than meets the eye.

Continue reading “The Safest Model Roller Coaster”

Evaluating Raspberry Pi As A Programmable Logic Controller

It should be no surprise to many that one can use a Raspbery Pi SBC as an industrial controller, but is it any good at that? That was the question which [Dough Reneker] and [William Shaffer] built a test rig to see how a Raspberry Pi performs in head to head tests. They compared a Python-based control loop on a Raspberry Pi 3B against an C0-12DD1E-2-D AutomationDirect CLICK Programmable Logic Controller (PLC) using a simple water heating example.

A major snag with using the Raspberry Pi as a PLC is the lack of industrial I/O capacity. This requires additional hardware, in this case adding a four-channel ADC board as well as a custom board to condition the signals. The Raspberry Pi looks for 0-3 V inputs where industrial control applications are usually in the -10 to 10 V range and often use a 4-20 mA current loop.

Using a PLC leverages so-called ladder logic, where each action depends on conditions. With each update scan, the PLC ensures that all input conditions are translated into the appropriate output conditions in real-time. It’s only job is to monitor the process at hand and it does this very well.

Here the flexibility and generic nature of the Raspberry Pi running Linux was a disadvantage. Unlike the PLC, the lack of a hard real-time OS means you can’t guarantee the Pi will be as responsive to changing inputs.

The behavior of the two systems showed that while both did the task they were programmed for, the Raspberry Pi was decidedly more erratic. Although one could program around a lot of these issues (presumably using Linux in stripped-down, soft real-time configuration with interrupt-driven native code), the effort needed to make a Raspberry Pi system suitable for an industrial environment shows why single-board computers haven’t seen adoption as replacements for PLCs.

Continue reading “Evaluating Raspberry Pi As A Programmable Logic Controller”

OpenPLC Is Ready For Hacking

It’s been nearly four years since we covered [Thiago]’s OpenPLC project. He never stopped working on it, and now it’s in a highly polished state.

If you read our initial coverage of this project, it would be easy to assume that he just wanted to control some halloween decorations. He is actually a PhD student at the University of Alabama in Huntsville. His research topic is SCADA (aka Industrial Control Systems) cyber security. His goal was to find vulnerabilities in PLCs and, hopefully, fix them. However, no PLC manufacturer releases their source code, and he was having trouble getting a deep understanding of something so closed.

So, since no one was going to open their code and hardware for him he simply made his own. OpenPLC can be programmed in all 5 IEC 61131-3 languages: ST, IL, LADDER, FBD and SFC. On top of that, it lowers the barrier of entry to developing this kind of industrial hardware by being compatible with all the favorites Arduino, Raspberry Pi, Windows, Linux, etc.

“The OpenPLC is the first fully functional standardized open source PLC. We believe that opening the black-box of a PLC will create opportunities for people to study its concepts, create new technologies and share resources.”

OpenPLC, For Industrial Automation To Halloween Displays

Stepping out onto just about any factory floor you’ll find complex automatons building anything and everything imaginable. These machines need to be controlled somehow and before the age of computers these manufacturing robots were controlled with relays wired together to produce a multitude of actions. Relays, no matter how reliable and bulletproof the are, can’t be programmed without rewiring the entire machine. Now, factories have programmable logic controllers to take care of their automation tasks.

[Thiago] built his own programmable logic controller and released it as open hardware.Included in the OpenPLC are four 24V inputs, four 24V outputs (two with PWM), 0-10V analog inputs, and USB, SPI, and I2C for programming and expansion.

If you’re building anything from an industrial machine in your garage, or simply want really awesome Halloween (or Christmas) decorations, the OpenPLC can take care of driving all the solenoids, motors, and actuators needed. With the extendable I2C and SPI busses, it’s possible to add a plethora of sensors to bring a project to life.

The OpenPLC is based on an ATMega328 and is compatible with Arduino code. There are a few extension boards for digital and analog IO, as well as Ethernet.