Programmable logic controller – PLC

Photo of author

By Jackson Taylor

Home » Hardware » Programmable logic controller – PLC

As an Amazon Associate we earn from qualifying purchases.

A programmable logic controller (PLC) is a rugged, dedicated computer built to control machines and industrial processes. It reads signals from switches and sensors, runs a stored program, and switches outputs such as motors, valves and lamps on or off. PLCs are used wherever a process has to run the same way, reliably, for a long time.

This guide explains what a PLC does, how it is programmed with ladder logic, and how you can learn PLC programming at low cost using common microcontrollers.

What is a PLC?

A PLC is an industrial controller designed for factory floors and control panels rather than offices. Unlike a general-purpose PC, it is made to run one control program continuously, respond to inputs quickly and predictably, and keep working in electrically noisy environments.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

Before PLCs, many machines were controlled by panels full of relays wired together. Changing how the machine behaved meant rewiring. A PLC replaces much of that wiring with a program, so the behaviour can be changed by editing software instead.

Main parts of a PLC

  • Power supply: converts the incoming supply to the voltages the controller needs.
  • CPU (processor): stores and runs the program and makes the control decisions.
  • Input modules: accept signals from push buttons, limit switches, proximity sensors and similar devices.
  • Output modules: drive relays, contactors, solenoid valves, indicator lamps and other loads.
  • Programming interface: a port used to load and monitor the program from a computer.

How a PLC works

A PLC repeats the same cycle again and again, often called the scan cycle:

  1. Read inputs: the current state of every input is recorded.
  2. Run the program: the logic is evaluated using those input states.
  3. Update outputs: the results are sent to the output terminals.

Because this loop repeats very quickly, the machine appears to respond instantly to a button press or a sensor change.

Ladder logic: the language behind most PLCs

The most widely used way to program a PLC is ladder logic. It is based on the working of relays and looks like an electrical schematic: two vertical power rails with horizontal rungs between them. Each rung has input conditions on the left and an output on the right.

See also
HIGH VOLTAGE BUCK CONVERTER USING ARDUINO (275V DC TO 165V DC)

The basic elements are:

  • Normally open contact: passes power when its input is on.
  • Normally closed contact: passes power when its input is off.
  • Coil: the output that turns on when the rung has a complete path.
  • Timers and counters: add delays and count events.

Contacts in series behave like AND logic, and contacts in parallel behave like OR logic. A common first exercise is the start/stop circuit with a latch (seal-in) contact, which keeps a motor running after the start button is released.

Ladder is not the only option. The IEC 61131-3 standard also defines function block diagram, structured text, instruction list and sequential function chart. Ladder is still the best starting point for anyone with an electrical or relay background.

Where PLCs are used

  • Assembly lines and packaging machines
  • Conveyor systems and material handling
  • Pumping, water treatment and similar process plants
  • Lifts, gates and building automation
  • Motor control and pneumatic or hydraulic machinery

To see a small working example of this kind of control, look at the DC motor and pneumatic system project on this site, which shows a PLC driving a motor and pneumatic actuators.

PLC and SCADA

A PLC controls the machine, but operators usually need to see what is happening. SCADA (supervisory control and data acquisition) software runs on a computer, displays the state of the process, records data and lets operators send commands to the PLCs. Our page on PLC and SCADA covers how the two fit together.

Learning PLC programming at low cost

Commercial PLC hardware and software can be expensive for students and hobbyists. A cheaper way to learn the ideas is to run ladder logic on a common microcontroller. A PLC built around an ATMEL or PIC chip lets you study PLC and SCADA concepts without buying industrial hardware.

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works

The setup used here is:

See also
PLC-LADDER LOGIC-ATMEGA8

Worked examples are available for both chips. Start with the ATmega8 ladder logic examples or the PIC16F877A ladder logic examples, or use the original example pages directly:

Keep in mind that a microcontroller board is a learning tool. It teaches ladder logic and control thinking, but it does not have the isolation, protection and certification of an industrial PLC, so it should not be used to control dangerous equipment.

If you need training on this setup, please contact us.

Coming soon

We plan to add example programs for Allen-Bradley PLCs:

  • Allen-Bradley 1000 series examples
  • Allen-Bradley 1100 series examples
  • Allen-Bradley 1200 series examples

Frequently asked questions

What does PLC stand for?

PLC stands for programmable logic controller. It is an industrial computer that controls machines by running a stored program.

Which language is used to program a PLC?

Ladder logic is the most common. It is modelled on relay circuits. Other languages such as structured text and function block diagram are also used.

What is the difference between a PLC and a microcontroller?

A microcontroller is a general chip you build your own circuit around. A PLC is a complete industrial product with protected inputs and outputs, standard programming tools and a design meant for harsh conditions.

Can I learn PLC programming without buying a PLC?

Yes. You can practise ladder logic with a free editor such as LDMicro and a low-cost ATmega8 or PIC16F877A board, then move to a commercial PLC once you know the basics.

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works