Ladder Logic Examples and PLC Programming Examples
I will start this article by making a confession:
When I develop a PLC program, I steal other people’s ladder logic.
I am stealing ladder logic examples for inspiration and solutions to my PLC programs.
From time to time you will be facing the same problem, when you do PLC programming with ladder logic. By looking at examples of ladder logic programs, you will be able to find a solution to your problem very fast. You may even find a smarter solution in the ladder logic examples than your own solution.
There are several reasons to use examples of PLC ladder logic. You can skip those and go straight to the PLC program examples:
Why Use PLC Ladder Logic Examples?
The reason I use ladder logic examples is one of the big advantages of code. In this case the PLC programming language ladder logic. You can reuse chunks of a PLC program in your own PLC program. You can “copy and paste” lines of ladder logic symbols from one PLC program to another PLC program. By doing so, you will shorten the development time of a project. So that you don’t have to invent everything from the very bottom each time you are developing a new PLC program. That is why I often make use of PLC program examples.
I wrote another article where I included examples of PLC analog input and output programming. If you want to learn ladder logic from the beginning, you should check out my ladder logic tutorial or maybe even start learning from an online PLC training course.
Learn from PLC Programming Examples
Another reason to make use of ladder logic examples is, that you can learn from them. Let’s say you have a specific functionality, you want to implement in your ladder logic. The first thing you naturally would do, is to think about it for yourself. Try to design the ladder logic by yourself.
But even though you come to a solution, there might be a smarter way to make that piece of ladder logic. When you look at a ladder logic example it may look different from your ladder logic. This is due to the fact that every function you want to implement in your PLC program, there are many different solutions.
Ladder logic examples can be hard to find, though. Especially because the names of the ladder logic examples often are confusing and even misguiding. A ladder logic example of a trafic light can, as an example, vary a lot.
One other thing that causes good PLC ladder logic examples to be so hard to find, is that ladder logic often is brand specific. Many PLC ladder logic program examples are available for download, and you will have to install the PLC programming software to view the example ladder.
Another brand specific issue is the names for the instructions and functions. For example in the Siemens S7-1200 and other PLC’s from Siemens the latching function is referred to as the set/reset function. While that function, in Allen Bradley PLCs, are the called latch/unlatch function. You can start exploring the latch/unlatch function already now with RSLogix Micro Starter Lite from Allen Bradley.
Collecting the Best PLC Programming Examples
For those reasons I have made this collection of PLC ladder logic examples. I have divided all the ladder examples into categories, so you can find them with ease. The first examples are general ladder logic examples. These examples can be used in almost every ladder logic PLC program.
If you need a simple function implemented in your ladder logic, you can use the general examples. General ladder logic examples can almost always be copied into your own ladder diagrams. The only thing you need to edit, is the names and the symbols for the bit logic instructions.
At last you will find real-world PLC ladder logic examples. This is a collection of PLC programs from the real-world, where simulations, videos or photos are a part of the example. Real-world PLC examples from a factory or a traffic light can be very useful, when you are searching for inspiration. These examples can rarely be copied to fit your own project, but you can use chunks and ideas from the real-world examples.
Do you have your own PLC ladder logic examples, even better than these?
I will gladly put your PLC ladder logic example on this site. In that way, we can all benefit from this list of the best examples of PLC ladder logic.
Ladder Logic Examples and Example PLC Programs
Click on the type of PLC program example you want to see, or scroll down to see the all:
- Simple Ladder Logic Program Examples
- Ladder Logic Examples with Timers
- Ladder Diagram for Motor Control
- PLC Program Examples From The Real World
Simple Ladder Logic Program Examples
Ladder diagram examples and solutions to simple PLC logic functions. These are all basic PLC functions implemented in ladder logic.
Simple Start/Stop Ladder Logic Relay
This is how the ladder diagram looks for a simple start/stop function. The function can be used to start and stop anything like a motor start/stop.
In this ladder logic example, there are two inputs.
- “Start button” or PLC input I0.0.
- “Stop button” or PLC input I0.1.
The start button will activate the relay, or ladder logic relay M10.0. When the start button is released, the relay will still be activated, because of the latch in ladder rung 2. This latching will be broken when the stop button is activated.
You might wonder why the stop button in this example is normally open. And the reason for that, is that you should use normally closed as stop button, to avoid dangerous situations under failure.
Here is what the PLC program example looks like:
Single Push Button On/Off Ladder Logic
This function is also called push on push off logic sometimes even flip-flop or toggle function. It is the same function as the on/off button on your computer or mobile phone. When you push the button the first time, the output will be activated. Now, when you push the button for the second time, the output will deactivate and turn off. The single push button has two functions: on and off.
Push on push off logic can be done in several ways. It can be done by using ladder logic and boolean logic instructions or it can be done with a counter. It can even be done with PLC rising edge and falling edge triggers or with shift registers.
Here is the example using boolean logic instructions only (complicated version):
This example is from the PLC, Scada, DCS blog. The blog has a lot of very useful information about PLC programming and especially ladder logic. Take a look at the blog and see the many ladder logic examples.
But… there is a faster way to make the same toggle function with a single push button:
The example is from Mayur Haldankar’s blog about PLC programming and DSP (digital signal processing). He even has examples of DSP programs written in C++.
In his example, he uses 3 (4) rungs only to make the toggle function of a push button (simple version):
Ladder Logic Examples with Timers
PLC program examples with timers in ladder logic. Generally speaking, you have three types of timers available in ladder logic. The on-delay timer, the off-delay timer and the retentive timer.
PLC Program Example with On Delay Timer
The first type of timer in ladder logic is the on delay timer. Its name comes from the fact, that the on delay timer delays its output from the on signal.
As soon as the on delay timer gets a signal at the input, the timer starts to count down. When the preset time is up, the output of the on delay timer will turn on. If the input is turned off before the count down finish, the time will reset.
On delay timers in ladder logic can look different depending on the PLC programming software. But common for all of them are the following:
- Enable Output (EN)
- Done Output (DN)
- Preset Time Value
The enable output (EN) is the first output and it is on when the timer is energized. So, as long as the input is true or on, the enable output will be true.
Second output is the done output (DN). This output in an on delay timer is only on, when the timer has counted down the preset time.
Look at this great video for more info about the on delay timer. The software used is the free RSLogic Micro Starter Lite from Allen Bradley.
PLC Program Example with Off Delay Timer
The off delay timer works just like the on delay timer with one exception.
Instead of starting the count down from the signal at the input turns on, the off delay timer starts to count down from the signal turning off at the input signal.
The example below is from Sakshat Virtual Labs. In the example, ladder logic is used to visualize the values of the three bits in an off delay timer. These three bits are from Allen Bradley PLCs, but other brands has similar bits.
- Enable bit (EN) – On when the timer is energized (input is on)
- Done bit (DN) – On when the timer is done counting down
- Timer timing bit (TT) – On when the timer is counting
Cooling Example With Off Delay Timer
Another example with the use of the off delay timer in ladder logic is in heating. When you are heating something, you often have some sort of cooling too. A good example of that is a heating oven. The oven is heated by an electrical heater, and in the side there are ventilation motors to cool the oven after use.
Here is a simplification of how the cooling PLC program should work:
- HEATING ON:
Heating element and cooling fans turn on.
- HEATING OFF:
Heating element off and off delay timer starts counting down.
- TIMER DONE:
Cooling fans turn off.
The electrical heater and the cooling fans should turn on simultaneously. Why the cooling fans has to turn on too, is to circulate the hot air and spread the heat.
Since both the fans and the heater has to start at the same time, the two outputs should work simultaneously. But keep in mind, that the cooling fans has to run for some time, after the heater is turned off.
This is the exact function of an off delay timer, and the ladder logic example looks like this:
PLC Program Example with Retentive Timer
Retentive timers are just like on delay and off delay timers, but with one crucial exception.
The time only pauses if the input is turned off before the count down is finished. When the input is turned on again, the timer continues counting down from where the time was paused.
The word retentive even means to retain, and that is what retentive timers do. They retain the time they have counted when the input is off.
If you’re still not sure, check out this video of a functioning retentive timer in ladder logic:
KronoTech has published a very informative PLC program example. With the use of a retentive timer to control a motor with an automatic lubrication system, they have made a great practical example.
More About Timers In PLC Programming Examples
Feel free to watch this video for more information about PLC timers in ladder logic. The video illustrates some great examples and the basics of PLC timers. The PLC programming software used is RSLogix 500.
Ladder Diagram for Motor Control
Motor control can be done with a PLC program. In fact, the PLC is a common choice for controlling AC motors. Here are some examples of ladder diagrams for motor control.
Star Delta PLC Ladder Diagram
One of the most common ways to start an AC motor is by first starting the motor in star connection. When the motor speed is sufficient, the connection is switched to delta. This is due to the high current AC motors use when starting.
Star/delta motor control can be done in several ways. To switch between the star and the delta relay, a timer is used. The ladder logic for a star/delta motor control is quite simple, and that is one of the advantages of using a PLC for motor control.
Another great example of how to use a PLC for star/delta start of an AC motor is example #5 in the PDF file below. It includes a lot explination and a lot of great power and control circuit diagrams. Example #5 is on page 30.
Ladder Diagram for DOL Direct On Line Motor Starter
Still commonly used in many factories the DOL or direct on line motor starter is another way of starting AC motors. The DOL is made of a contactor (usually 3-phase contactor), an overload relay like the thermal relay, and some connections in between.
Controlling the DOL motor starter with a PLC program is simple. This video below shows an example of how to control a DOL with a PLC program. In the example the PLC Zelio from Schneider Electric is used. But any PLC with digital inputs and outputs can be used, even the mini PLC Siemens S7-200 or the later Siemens S7-1200. Sometimes you might have to use a smaller relay between the PLC output and the coil of the contactor. Make sure you always check the ratings of the PLC outputs you are using.
PLC Program Examples From The Real World
These next PLC programs are examples of real-world PLC applications. All examples of how to use PLC programming and ladder logic to solve real problems.
Traffic Light Ladder Logic Diagram
One of the most used applications for a PLC is the traffic lights. At many schools, universities and even companies you will get the challenge to make a traffic light ladder logic diagram.
The traffic light PLC program is a combination of timers to control which lights are turned on and for how long time. But some sort of interlock must be there to prevent the green light to be on in multiple directions.
A PLC program like the traffic light is a little more complicated and therefore are a lot more solutions to. For inspiration you can look at these good examples of traffic light ladder diagrams:
The first ladder logic example is from Engineer On A Disk, which is a marvelous site full of great articles. In the example you will get all the ladder diagrams and step-by-step instructions and explanation.
If you are using LogixPro Simulator, then you should absolutely take a look at this great example video:
Ladder Diagram for Bottle Filling Plant
Detailed example from Electrical Engineering Portal. This is a great example because of all the explanation it gives. You will be introduced to the actuators (motors), sensors and switches and a step-by-step guide to how to make the PLC program. At last you will see the example ladder logic for the bottle filling application.
If you are using LogixPro Simulator from Allen Bradley, then you can learn a lot from this example video:
PLC Ladder Diagram for Elevator Control
Elevators are often controlled by a PLC or a similar controller (sometimes even relay controllers). In fact a PLC program is a great way to make an elevator control. But before you start looking at ladder diagrams and PLC program examples for elevator control, some safety issues are important to know about. You might want to incorporate a safety relay in the system.
Here are the things you need to know before you start to build a PLC elevator control:
- Mechanical safety
No elevator control without mechanical parts. All these parts has to be tested and verified to make sure that they will last.
- Electrical safety
Be sure to follow the rules and regulations for electrical safety. They differ a bit depending on whether you are in the US, Europe, Asia or anywhere in the World. This includes proper grounding, using the right circuit breakers, wire gauges and so on.
- PLC elevator program safety
The last but not least part is the PLC elevator program. In the elevator examples you will be looking at, there will be a lot of interlocks, to prevent some functions to run at the same time. This is a highly critical point. For example, you don’t want to elevator to run before the doors are closed!
This is a great introduction to how the elevator control system works:
And here is an example of a ladder diagram for elevator control from circuit4hobby:
Elevator PLC program (PDF)
Did these example PLC programs help you?
Rate this article below or write a comment if you found this article helpful or you have any questions.