MakerPros: You probably started life programming PLCs

By Jeremy S. Cook

Freelance Tech Journalist / Technical Writer, Engineering Consultant

Jeremy Cook Consulting

March 22, 2016

MakerPros: You probably started life programming PLCs

In 2004, I graduated with a mechanical engineering degree, and, like most of my classmates, knew a bit of programming, mostly using BASIC and MATLAB....

In 2004, I graduated with a mechanical engineering degree, and, like most of my classmates, knew a bit of programming, mostly using BASIC and MATLAB. If I hadn’t done a co-op (three-semester internship) at a manufacturing plant, however, I wouldn’t have heard of a programmable logic controller (PLC). These devices, though unknown to many in the high-tech world, control a staggering amount of factory automation equipment, from small single-station machines to large robotic production lines that (usually) require little interaction from their human tenders.

If you’ve never worked with a PLC, these devices, in their simplest form, are like an Arduino board, where sending power to an input allows it to power an output. Their range of uses, however, extends much further than this. With the correct expansion cards (plugged in like a PC card), these devices can communicate with hundreds of inputs or outputs, use Ethernet and other protocols for communication, and work with countless other devices. They can collect data and display it using a touchscreen (aka, a human-machine interface, or HMI), control industrial robots, and even use vision systems to gather data about parts a machine is making or the world around them.

This might seem simple enough to someone well-versed in using an Arduino, or even a Raspberry Pi’s GPIO pins, but there’s one huge difference, something called “ladder logic.” If you were to put a “normal” computer programmer (if there is such a thing) in front of the programming software for a PLC, he or she would likely be confused, as there are no lines of text, just horizontal lines with strange symbols on them stretched between two vertical lines. Yes, this is a computer program, but likely not familiar to a traditional computer programmer.

A PLC, instead of running line after line of code, “scans” the ladder, executing each rung based on symbols on that rung. A rung may have two or (many) more inputs that need to be made to execute the output, which might be a relay, pneumatic cylinder, or instruction to another device on the right side of the rung. Different rungs can interact with each other via internal contacts or latches, which could be thought of as relays, or virtual inputs, if represented in the real world. Add in special instructions for communications, math, robotic control, or any number of other functions, and you have a very powerful controller for industrial automation.

Although this method of program execution may at first seem strange and unnecessary to those not in that world, PLCs do have several important advantages. First, the rungs (code) can, in theory, be read by an electrician (or even a mechanical engineer). If you treat the left ladder as positive voltage and the right as ground, the code can be read as a circuit. Second, PLCs last for a long, long time. It’s very common to see them in service for 20 years or more, and, as they were invented in the late ‘60s, I would guess there are some still in service that were manufactured 40 years ago. Inputs and outputs may have to be replaced, but it’s uncommon for the processor to die unless an engineer or electrician makes a mistake involving “magic smoke.”

Many devices/systems are designed with PLC-controlled machinery. Though you may never interact with one in person, it’s almost certain that between the car you drive, the computer you use, or even the food you eat, one of these reliable systems has affected your life in some way. And yes, I have smoked at least one PLC during my time as a manufacturing engineer.

Jeremy Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can follow his exploits on Twitter, @JeremySCook.

Jeremy Cook, Engineering Consultant

Jeremy Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can follow him on Twitter, or see his electromechanical exploits on the Jeremy S. Cook YouTube Channel!

More from Jeremy

Categories
Software & OS