What is a PLC?

If you’re considering a career in Industrial Automation, you are probably starting to hear a lot about PLC’s. If you haven’t worked with PLC’s before, they might seem a bit mysterious. I hope to shed some light on the topic for you below.

What exactly is a PLC? A PLC, or Programmable Logic Controller, is a computer that is used for processing inputs and setting outputs. When I say “computer” in this context, I don’t mean what we typically think of when someone says “computer” – although a PC can function as a PLC with the right software.

A PLC is (typically) a computer in the more general sense – it is a microprocessor that is connected either directly or via an industrial network to some inputs and outputs, and it is programmed to evaluate the inputs and set the outputs in such a way that it facilitates the execution of some process. In other words, it is a processor, similar to the one in your computer, that adheres on a very basic level to the “IPO Model“: it accepts inputs, performs processing, and sets outputs.

Huh?

Try to think of it this way – a factory is, in a sense, a giant machine that takes in a lot of parts and turns those parts into some product or family of products. Within the factory, there are some number of automated production lines, with each line performing some process on the parts.

Some lines may have robots that move parts around so that other robots can weld parts together. Some lines may have stations where operators use special equipment to install fasteners at each station before the part moves to the next station. Some lines may simply convey parts to another area of the facility. In any of these cases, think of individual automation lines as large machines themselves; they perform some custom function within the factory to contribute to the assembly of the final product. Generally, they turn some combination of parts into a larger sub-assembly.

PLC’s are the brains of these machines, much like your car’s ECM is its brain. In fact, in many regards, an ECM is to a car as a PLC is to an automation line in a factory – an ECM is, effectively, a PLC for your car.

  • An ECM accepts inputs from the vehicle, such as:
    • Crankshaft position
    • Oxygen sensor feedback
    • Intake airflow
  • The ECM then performs calculations using the input data, to provide appropriate outputs:
    • Injector duty cycle
    • Throttle control
    • Valve control
An Engine Control Module, or ECM, from a Volvo.
Vroom, vroom. Image credit.

I guess the list above is most relatable if you have a bit of automotive knowledge. Here’s another comparison that might be more broadly intuitive:

  • A home automation hub accepts inputs from sensors in your home, such as:
    • Motion sensors
    • Smart buttons
    • Voice input
  • The home automation hub processes those inputs in accordance with how you have it set up, and then provides appropriate outputs:
    • Turning lights on and off
    • Playing music
    • Closing the garage door

While both comparisons are reasonable, there is one manner in which both examples are significantly different from PLC’s:

ECM’s and home automation hubs come pre-programmed from the manufacturer. Their programming is pre-determined and, while there may be features that you can set up or configure at the user level, the code that the processors are executing is generally not editable.

PLC’s, on the other hand, are blank slates – they are putty in your hands, so to speak, for you to program however you need, in order to control your automated processes.

What do you need to have to be able to program a PLC?

In order for a PLC to do the incredible job of controlling equipment, you must provide it with the programming instructions, or “logic”, that brings your process to life. As a broad statement, you will need the following to connect to and program a PLC:

  • The PLC, with its power supply and any necessary accessories
  • A PC or programming terminal with the PLC vendor’s software
  • A means of communication between the terminal and PLC

Varieties of PLC’s

PLC’s come in all shapes and flavors, from this $259 (when this was written) Electrodepot PLC to this $3,800 Siemens PLC – which is the refurbished price, by the way. This Siemens NCU is just one example of a high-end PLC – as far as pricing for the cream of the crop, $3,800 is nowhere near the upper bound.

There are many, many categories in which PLC’s can differ, but here are some noteworthy parameters:

  • Physical type (stand-alone, modular, or rack-mounted)
    • What are the PLC’s capabilities for expansion?
    • What types of accessories are available in this PLC’s product family?
  • Number of inputs and outputs accepted
    • How many terminals does the PLC have to which you can connect wiring for sensors, motors, etc.?
  • Protocols supported
    • Does the PLC only accept “discrete” (wired) I/O?
    • Does the PLC support advanced fieldbus protocols like DeviceNet, Profibus, or Ethernet/IP?

PLC Software

Vendor-specific software is an important consideration when choosing a PLC platform, if for no other reason than differences in price:

  • Some vendors include their PLC software at no additional cost
  • Allen Bradley/Rockwell Automation PLC’s, on the other hand, require licensing to use their software – to the tune of thousands of dollars for an annual license
An example of ladder logic depicted within RSLogix 5000, PLC programming software for Rockwell Automation equipment.
Rockwell Automation’s RSLogix 5000

Communicating with the PLC

Just as there are many different types of PLC’s, communicating with the PLC can mean many different things depending on what PLC you’re using:

  • Some PLC’s have programming ports that you can hook up to via a USB cable
  • Some require proprietary (read: expensive) programming cords that are vendor-specific
  • Many modern PLC’s can be programmed via an industrial network; like your router at home, you can connect to the PLC over Ethernet cabling.

What language is used for PLC programming?

Trick question? There are multiple languages (some you might say are more “interfaces” than languages) that are used for PLC programming, but the most common is “ladder logic”, the technical nomenclature for which is actually “Ladder Diagram”. Two other common PLC programming methods are Function Block (or Function Block Diagram) and Structured Text.

Ladder Logic

Ladder logic (shown in the image above) is the most common PLC programming method. Ladder logic is highly visual, and shows the truth of each instruction via visual indicators on the programming interface. Once you learn the meaning of a small group of instructions, you’ll be able to start reading and understanding simple bits of ladder logic.

The “ladder” in ladder logic comes from the appearance of the visual interface. Reminiscent of relay systems, ladder logic shows “energized” vertical bars on the left and right side of the screen, with each line of logic represented as a literal horizontal line – or “rung” – extending between the two vertical bars. Multiple “rungs” on the screen are visually similar to a ladder, hence the name.

Despite the high-level, visually simple nature of ladder logic, modern interfaces are extremely powerful and permit essentially any function of the PLC to be leveraged.

An example of ladder logic shown in RSLogix 5000, PLC programming software for Rockwell Automation PLC's.
Ladder logic. Instructions that are true are highlighted green. If enough true instructions on a rung form a path from the left of the screen to the right, the output on the right side of the rung will be turned on by the PLC.

Function Block Diagram

Function Block Diagram, or Function Block, is another visually representative programming interface. With function block, instructions are laid out like landmarks on a map, with inputs and outputs from each instruction branching out like roads to connect to other instructions. Function block can help to visualize a process and its inputs and outputs.

Many of the basic building blocks of ladder logic are available when using function block. These basic functions include comparative operators (equal to, greater than, etc.), counters (increment or decrement a count whenever X occurs), timers, and many more.

Like many ladder logic interfaces, you can develop your own instructions in function block. Creating custom functions allows you to reuse logic when applicable to multiple devices or programming contexts.

An example of Function Block logic.
A small example of Function Block. Image Credit.

Structured Text

A third method of PLC programming is Structured Text. For those familiar with computer programming, structured text will seem very familiar. Similar to high-level programming languages such as BASIC, structured text allows the user to write code to control the PLC.

In the PLC world, it’s important to consider how much trouble it will be for other people to deal with your logic when something isn’t working. Because structured text is less visual than either ladder logic or function block, it may not be as readily accessible to technicians who don’t have experience with the type of computer programming of which structured text is reminiscent.

No logic is immune from future debug when the equipment fails. As such, you want your PLC programming to be easy for others to read and understand. For this reason, I prefer a more visual interface than that offered by structured text, if only to make my logic accessible to a larger portion of the people who might have to debug it.

How can I learn more about PLC’s?

Three ideas come to mind for how you can start learning more about PLC programming:

  1. Attend formal training for PLC programming
    • Colleges offer degree programs such as Industrial Automation and Mechatronics that provide formal training in PLC programming
    • Certain skilled trades apprenticeships (including many electrician apprenticeships) will also require formal study of PLC programming
  2. Find PLC programmers in your network, on LinkedIn, or in other forums who may be willing to tell you a bit about the industry and what to expect
  3. Buy your own PLC and start experimenting to build your skills
    1. Get yourself an Arduino starter kit for $35 (when this was written) and start building projects that will help you understand the Input, Process, Output Model
      • Arduino is not technically considered a PLC, but, basically, it’s an entry-level PLC
      • One drawback with Arduino is that you won’t be using ladder logic; it’s programmed with C
      • Many of the other experiences with Arduino will be identical or directly analogous to PLC programming
        • You will set up inputs such as sensors and switches
        • You will write logic that will handle or take action based on the inputs
        • Your logic will set outputs to turn on lights, activate motors, etc.
      • Another nice thing about this kit is that it comes with a slew of sensors, lights, resistors, etc., and a project guide
    2. If you have the money, fork over the dough for something like the Electro Depot ($349) or EZRack ($399) PLC starter kits
      • These kits will provide a very realistic experience, using their vendor-specific software to program in ladder logic
      • Both of these kits have simulation functions, allowing you to experiment with your logic without needing a ton of extra equipment
An Arduino Uno, a programmable controller used for prototyping and learning more about programming controls.
(aftermarket) Arduino Uno

I hope the information above will help you in understanding some of the basics regarding PLC’s. Where are you at in your own journey? Are you considering a career in industrial automation or specifically as a PLC programmer? Let me know in the comments.

Thanks for reading! Let me know if you have any questions or if there’s a topic on which you’d like more information.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.