Home » PLC Tutorial | Programmable Logic Controller

PLC Tutorial | Programmable Logic Controller

by Online Tutorials Library

PLC: Programmable Logic Controller

PLC Tutorial

PLC or Programmable Logic Controller is a computer control system for the Automation Industry. It is a special-purpose computer without a keyboard, hard drive, etc. PLC is one of the demanding skills of the Electrical industry. Most organizations require a candidate having knowledge of PLC. Here, we will discuss Automation, applications, types, programming, process, architecture, etc.

In this tutorial, we will cover the following topic:


What is PLC?

PLC is a digital computer control system adapted to control the robotic devices and other manufacturing processes. It involves a basic study of Microcontrollers, digital circuits, and designing skills.

It provides easy, flexible, high-reliability programmable controllers suitable for simple and harsh environments. It monitors the state of input devices, takes decisions, and controls the output devices. The applications include Robotics, water filling tanks, etc.

PLC ranges from small devices with few Input/Outputs to large devices with thousand of Input/Outputs.

Thus, PLC is all about:

PLC Tutorial


Why PLC?

PLC was initially created in the United States for the replacement of relay systems.

The drawbacks of relays that make them unsuitable for the automotive industry are listed below:

  • The machine operation using relays logic was quite challenging and time-consuming. A change in the logic of the machine makes the process complicated.
  • Relays also fail quickly compared to computer components.
  • It requires more run downtime.
  • Relay also consumes plentiful electricity, more space, and heat.

Hence, to overcome such drawbacks, PLC was created.

A PLC model has a simple appearance. The essential components of PLC are Input/output (I/O) modules, co-processor modules, CPU, and peripheral devices. The CPU (Control Processing Unit) communicates with the Input/output. The I/O modules may be present near or farther away from the CPU. Hence, PLC is not limited to one building. It includes calculation in the programming, which is used to calculate different parameters, such as SPC (Statistical Process Control).

But for its operation, we need to program the Programmable Logic Controller. Most PLCs are controlled using the applications on the desktop/laptop. These applications communicate with the PLC using the communication medium, such as Ethernet or the proprietary communication bus. The selection of communication medium depends on the manufacturer. Most manufactures also rely on the USB.

The specific logic is different for each programmer with different techniques of doing the same thing.


Types of PLC

There are three types of PLC, which are shown below:

PLC Tutorial

Modular PLC

In modular PLC, modular means adding modules. It allows us to expand the structure of PLC. It is useful when there are a large number of inputs and outputs. We can add more input and outputs by adding the modules in the PLC.

It also has more memory and capability to store information.

The example includes control processing lines in the manufacturing industry.

Let’s have a look at the Modular type PLC.

PLC Tutorial

Rack PLC

The modules in the rack type PLC are arranged in the rows. The racks are placed inside the cabinets. The slots in the rack PLC communicate with each other connected by the standard network or bus.

Let’s have a look at the Rack PLC.

PLC Tutorial

Compact PLC

The Input / Output (I/O) modules in the compact PLC are determined by the manufacturer of that PLC. It means that the I/O is fixed. But, the compact PLCs are used for small scale applications.

Let’s have a look at the compact PLC.

PLC Tutorial


How PLC Works

In simple words, PLC takes the input from the input devices, processes it based on the logic in the CPU, and controls the output devices based on that logic.

PLC is lightweight and can operate without any electrical filtering or air conditioning.

Let’s discuss this in detail.

The devices such as pushbutton, sensors are connected as the input devices, which can detect a change in the input signals in the PLC. The input signal passes through the barrier that converts the voltage into low voltage, such as 5V. The CPU monitors the state of the input. Based on the specified logic, CPU processes and produces the output signal. The barrier present at the output terminal prevents the PLC from external noise and converts the low voltage to high voltage to drive output devices. The output signal controls the output devices, such as motor, controllers, pilot lights, etc.


Architecture of PLC

The PLC hardware setup or architecture contains the hardware and software that is used to perform the control functions.

Let’s have a look at the architecture of the PLC.

PLC Tutorial

The components of the PLC are listed below:

PS

PS stands for Power Supply. The power supply acts as a power source for the PLC system. It converts the high voltage into low voltage or DC, such as 120V AC to 24V DC.

The Linear power supply is less complicated than the other modes of power supply.

SMPS

It stands for Switch Mode Power Supply. SMPS is power conversion and a high-frequency power conversion device. It converts the voltage level into the specifically required voltage. SMPS uses solid stat switches to convert the AC supply into the smooth DC supply.

SMPS is generally used for high power conversion from AC to DC. It also has high efficiency than PS.

Let’s discuss some differences between PS and SMPS. Consider the below table.

Category PS (Power Supply) SMPS (Switch Mode Power Supply)
Weight Bulky Light in weight
Efficiency Low efficiency between 20 % to 25% High efficiency between 60 % to 65%
Complexity Less complex More complex
Response Faster response Slower response
Uses Radio frequency applications Mobile chargers, DC motors, etc.

How SMPS converts voltage?

Let’s consider the AC voltage of 224V. The process will convert 224V AC to 24V DC.

Consider the block diagram given below:

PLC Tutorial

It clearly explains the process of converting high voltage to low DC voltage.

CPU

CPU or Central Processing Unit is present in the Central rack of the PLC. The data bus is used as a medium to send data between different elements in the PLC. It controls all functions, such as programmed instructions stored in the memory of PLC. It also controls logic, communications, and monitoring in the PLC. It is the unit of the PLC that contains a microcontroller or microprocessor.

The CPU executes the program when it is operated in the run mode.

IM

IM or Interface Module is defined as an accurate, position sensing, and absolute device. It is commonly used with transducers to reduce noise in harsh environments.

Programming device

We need to specify the required program into the processor’s memory. The program is initially developed in the programming device. After that, the program is transferred to the memory unit of the PLC.

CP

CP stands for Communication Process. The communication process in PLC includes a wiring system and a shared protocol. The wiring system is used to connect different components in PLC, whereas shared protocol allows any device to understand the bits and bytes in the communication process.

MCB

MCB or Miniature Circuit Breaker acts as a safety device for the PLC. It automatically switches off the circuit if an overload or fault condition arises. MCB is commonly used instead of fuse I low voltage electrical network.

Input Module

The input module of PLC detects the input devices’ status, such as sensors, switches, push-buttons, etc.

Output Module

The output module of PLC controls the output devices, such as motors, relays, lights, etc.

Rack

The Rack usually acts as a holding device of PLC. It means that it holds everything together. We can add racks in the PLC to hold more modules. The racks are also available in a different size.

Memory Unit

Memory Unit is the unit that stores programs, data, and information in the PLC.

The PLC has two types of the memory unit, which are listed below:

Data memory: The data memory consists of the stored data from the Input/output modules of the PLC.

Program Memory: The program memory consists of the logic program or ladder logic program in the PLC.


PLC cycle

The PLC system is often expensive. The incorrect programming or design of PLC can result in loss of productivity. To save the time to design of PLC control applications, simulation software like PLCLogix are recommended. Such software saves time and also increases the safety associated with the PLC equipment.

The PLC cycle is shown below:

PLC Tutorial

Know your process: We should know our process that we are starting with.

Circuit design: The design is the first part of any project. A project or model cannot be created without design.

Devices used: It is crucial to know the devices used in the project.

Programming: It is an essential part. The created model is programmed for implementation.

Testing or Simulation: At the final stage, the model is tested. Considerable time is spent on testing and simulation.

The above steps are necessary to understand the operation of the PLC.

Scan cycle of PLC

The PLC continuously scans the process because the inputs are random (can change any time). The scan cycle is divided into three parts, named Input scan, Output scan, and program execution.

Scan time: It is defined as the time taken by one cycle to go through the program. The time duration of a cycle is minimal, i.e., 1/1000th of a second. It can vary depending on the program.

The lesser the scan time, the better and expensive will be the PLC.

The Scan cycle is shown below:

PLC Tutorial

Input Scan: The PLC solves the logic based on the specified inputs. The ON/OFF state of the input is saved in the data table in advance, avoiding sudden changes in the input. It also makes the process faster.

Program Execution: The control logic keeps the memory copy of the ladder logic program. It executes only one instruction at a time using that copy.

Output Scan: It updates the outputs after the scan process is completed. The values of the program are temporary. Based on such values, the Output is updated. After that, it self-checks for any fault and restarts the process.


What is a safety PLC?

The safety PLC is similar to the normal PLC with some extra safety features, such as redundancy. The safety PLC can also perform additional field device checking, such as snooping.

The PLCs are part of the Automation System, which is related to Electrical engineering. A safety PLC is one of the important of any automated Industrial process. The sensors, PLC (logic solver), and the control systems are considered the three parts of the SIS (Safety Instrumented System). SIS is termed as Safety Shutdown System.

The SIS monitors a process and reacts by making a shutdown if any unsafe or risk condition arises. The role of safe PLCs is to guard the process against project/plant failures to prevent the environment from harsh risks. In any hazardous condition, safety place will place the plant in a safe condition.


What is Automation?

Automation is defined as a process, system, procedure that reduces human efforts to a minimum. It is a mechanical device that operates and functions automatically without continuous input. The devices are created electronically.

The scope of Automation is increasing like other technologies, such as Machine Learning and Artificial Intelligence. For example, aircraft, boilers, heat treating ovens, automatic machinery, etc.

Let’s discuss some features of Automation.

  • Automation has not only reduced human labor but also uses machinery for repetitive tasks.
  • Industrial Automation has resulted in increased productivity, safety, better utilization of resources, improved production rate, and higher output.
  • It has increased consistency.
  • Time-saving procedure.
  • Better reliability
  • Reduced cost of operations.
  • More safety and job security.
  • PLC has replaced sequencers and timers.
  • I/O Scanning

The automation is categorized as Industrial and Non-Industrial Automation.

PLC Tutorial

Types of Automation

Let’s have a quick look at the types of Automation.

There are four types of Automation, which are listed below:

  • Fixed Automation
  • Flexible Automation
  • Programmable Automation
  • Integrated Automation

Fixed Automation

Fixed automation has an open and logic-based programming system. But, it has a high production rate and high initial investment.

Flexible Automation

The flexible automation is quite flexible in dealing with the products having design variations.

Programmable Automation

It is a human-based system. Here, the new program is prepared and enters into the new equipment to create new products.

Integrated Automation

It is the combination of the above three automation (fixed, flexible, and programmable). It is an industrial control system that extends its technical services in the engineering domain.


Applications of PLC

We generally use a desktop or laptop for programming.

Some of the applications of PLC are listed below:

  • Controlling elevators
  • Controlling traffic signals
  • Washing machines
  • Amusement rides
  • Machinery control
  • Bottle filling system
  • Water tank level control

Criteria for selecting PLC

It is essential to select the best PLC.

Let’s discuss the criteria for selecting a PLC. We should select any PLC based on the following parameters:

System Requirements

The required PLC should be compatible with the system requirements of our computer or laptop.

We should always check the PLC model.

Scan time

It is also an essential part of selecting any PLC. The PLC will less scan time is considered as the best PLC, but are costly. The variation of scan time depends on the number of inputs of the PLC.

Communication

Communication means sharing information with other devices. The hardware cable can be twisted pair cables, radio modem, etc.

Speed of Operation

It defines the operating speed of the control system of the PLC.

Application Requirements

It determines the input and output requirements for the PLC system.

Electrical Requirements

The Electrical requirements include the parameters, such as input voltage, control system’s power, output current, and output voltage.

I/Os

The I/O modules should be selected according to the required project needs. If we want to control the stepper motor, we can opt for a Rack PLC.

Memory

We need first to check the required amount and size of the memory. The memory of the PLC is related to the number of I/O, the installation of the control program, etc.

Software Requirements

The software requirements include compatible CPU, Communication and I/O ports, USB port, Ethernet port, user-specified port, etc.

Physical Requirements

We should always consider the location of the PLC control system. We should place the PLC control system in IP-rated closure in the harsh environments. Other parameters, such as maintenance, accessibility, and troubleshooting, should also be kept in mind before selecting any PLC.


Siemens PLC

As discussed, Siemens PLC is the most common PLCs used all over the industries.

PLC Tutorial

The Siemens PLC are divided into three generations, which are given below:

1st Generation – Micro

2nd Generation – Mini

3rd Generation – Nano or Rack PLC

The series of Siemens PLCs are listed below:

  • S7200
  • S7300
  • S7400
  • S7400H
  • S7400F
  • S71200
  • S71500

S7400F PLC also has the feature of Fault Tolerance. We can select the product as per the requirement. S7200 is the cheapest available Siemens PLC. It is easy to start programming with the S7-200 PLC.

SIMATIC STEP 7

Simatic step 7 is the powerful automation software tool, which includes the programming environments for Siemens PLCs. The Simatic Step 7 engineering software can be used for programming and configuring HMI Basic Panels.

The supported programming languages in the STEP 7 software are ladder programming, Functional Block Diagram, and Structured text programming language.

Today, the intelligent choice for automatic is the SIMATIC S7-1200 controllers.

Let’s understand the advantages of S7-1200 controllers, which are listed below:

  • These PLCs are available in failsafe and standard versions.
  • It comes with extended communication functions and improved data transfer.
  • It allows the transfer of sensitive machine data.
  • It supports predictive maintenance.
  • It also supports data transfer with other controllers.
  • It enables data storage.

PLC Protocols

PLCs communicate using the protocols. The protocols associated with the PLCs are listed below:

1. PPI

The PPI or Point to Point Interface Protocol is a communication protocol specially designed for S7-200 PLC. But, it is not directly opened by Siemens.

2. MPI

The MPI or Multi-Point Interface Protocol is an interface of the Siemens Company. The MPI is used to connect the devices, such as personal computers, etc. The speed of MPI ranges from 187.5 kBd (Kilo Baud) to 12 Mega Baud.

3. Profibus

Process field Bus or Profibus uses a multi-drop single cable, which is used to connect the devices. It is often confused with the Profinet. It is easy to find faults in a single cable. The installation cost of the Profibus cable is also low.

4. Profinet

The Process filed net or Profinet is also used by Siemens like Profibus. The response time of Profinet is faster, which provides higher data collection.

5. Fiber Optics cable

The Fiber Optics cable supports high bandwidths level and high transmission capacity over long distances.

6. Ethernet cable

The Ethernet cable acts as a wired transmission intermediate between the devices. Ethernet cables are considered for wiring analog input and outputs in PLC. The Ethernet connection provides faster security and reliability than the wireless connection.

7. LAN Cable

The LAN cable provides the downloading and uploading capacity from the host computer to the PLC or vice versa. The common LAN applications include distributed control, etc.

8. Cat 5, Cat 6, and Cat 7

Here, Cat stands for Category. These are the common Ethernet standards that are widely used for transmission with reduced interference.

The speed of Cat5 is upto 100Mbps.

The speed of Cat6 is upto 10Gbps.

The speed of Cat7 is upto 100Gbps. It is the latest cable, which is shielded.

Twisted Pair cables

It is a kind of wiring system in which two pairs of conductors of a single circuit are twisted together to improve the electromagnetic capability of the circuit.


PLC Manufacturers

The industries that make PLC are listed below:

  • Siemens
    It is the German multinational company that manufactures PLC. It is well known and most used PLC all over the world.
  • Rockwell Automation
    It is an American company that also took over the Allen Bradley brand. It is the largest manufacturer of PLCs and well known in the United States.
  • ABB
    The ABB is a Swiss multinational company that provides PLCs within vast industries and applications.
  • Omron
    It is a Japan-based electronics company.
  • General Elastic
    It is an American based PLC company.
  • Delta
    It deals with all types of automation machines. It is a Taiwan- based PLC manufacturer.
  • Schneider
    The Schneider is a French-based PLCs manufacturer.
  • Mitsubishi
    It is a Japanese MNC group that manufactures PLC.
  • Koyo Electronics Corporation Limited
    It manufactures the DirectLogic PLC brand. It is a Japanese based industry.

PLC Programming

PLC programming is a crucial task of implementing and designing control applications as per the user requirements. It is the set of instructions that can be in the graphical or textual form.

Here, we will discuss the most commonly used method called Ladder diagram, which is a type of graphical method. The PLC works according to the specified program as soon as it is placed in the run mode.

The programming is carried out in the PLC software. Here, we have discussed the software that is popularly used for Siemens PLC called SIMATIC STEP 7. We can easily download it from any browser. The function blocks in the programming include push-button, counters, timers, comparators, etc.

Types

We have discussed that the control logic establishes the input and output of a PLC. The control logic of the PLC can be programmed using different programming languages.

Out of all the programming languages, Ladder is the most common programming language used for PLC. So, we will discuss Ladder programming in detail.

The initial version of IEC standard 61131-3 supports five basic programming languages called FBD, ST, IL, SFC, and Ladder. The standard-based programming language to program PLC is called the Ladder diagram. ST and IL are the textual programming language, while Ladder, FBD, and SFC are the graphical programming languages.

. Let’s discuss six types of programming language, which are listed below:

FBD (Function Block Diagram)

The functions in the FBD diagram are described as the set of elementary blocks. The variables (input and output) in the Function Block Diagram are connected to blocks by the lines.

ST (Structured Text)

The Structured Text is a block-structured language that is based on Pascal. It is a high-level language. It is also a text-based language.

IL (Instruction List)

The instruction List is a text-based and a low-level language.

SFC (Sequential Flow Chart)

The Sequential Flow charts are defined by the function of charts in a sequence. We can use it if the process can be divided into steps.

Sample Program:

PLC Tutorial

Ladder Logic

It is defined as a graphical programming language that uses symbolic notation for expressing the logical operations. We can program the PLC on any software using the ladder logic.

Before beginning with the programming, let’s discuss some basic concepts.

Push Buttons

The pushbuttons are the simple buttons to control the machine or a process. We are required to push the button to change its electrical state from ON to OFF or vice-versa.

Push buttons are further categorized as NO (Normally Open) and NC (Normally Closed), as shown below:

PLC Tutorial

NC: The Normally Close is the default state of a circuit that makes electrical contact with the circuit. It means the circuit is in ON state.

NO: The Normally Open is the state of a circuit that makes no electrical contact with the circuit. It means the circuit is in the OFF state. It opens the terminal of the circuit to interrupt the flowing current.

We will use pushbuttons for programming in PLC.

Symbols used in Programming

Various symbols are used to create a ladder circuit for PLC programming. Let’s consider some essential symbols. The symbols are shown below:

PLC Tutorial

Let’s first discuss the concept of NO and NC. We will also discuss the output of NO and NC buttons when the input is 0 or 1.

NO

The NO button turns NC when it is pressed. It means, when the input is 1, NO turns NC. It means the current can pass through.

Consider the below image:

PLC Tutorial

It clearly shows that when the input is 0, NO remains NO. It turns NC when the input is 1.

NC

The NC button remains the same when the input is 0. It turns NO when the input is 1.

Consider the below image:

PLC Tutorial

We can arrange NO and NC in parallel or series according to the requirements.

Now, we will discuss the logic gates with their ladder diagram. The concept of using NO and NC in a ladder diagram will help us in building the circuits of PLC. The ladder diagram of Logic gates are discussed below:

Logic Gates

We will discuss logic gates with their circuit using NO and NC buttons.

Basic Gates

The Basic Gates are AND, OR, and NOT.

The truth table of OR and AND Gate is given below:

A B OR AND
0 0 0 0
0 1 1 0
1 0 1 0
1 1 1 1

The truth table of NOT Gate is given below:

A NOT
0 1
1 0

Ladder Diagram of AND Gate

The ladder diagram of AND Gate is given below:

PLC Tutorial

Here, A and B are the inputs, while L is the lamp. The lamp will glow when the current flows through the circuit and reaches the lamp. Otherwise, the lamp will not glow.

When A = 0 and B = 1, the circuit will appear as:

PLC Tutorial

The lamp will not light because the starting button is OFF. The current will not flow.

But, if A = 1 and B = 1, the circuit will appear as:

PLC Tutorial

Here, the lamp will light. Hence, the condition of the AND gate is satisfied.

Similarly, we will create a ladder diagram for all the gates using the same logic, as discussed above.

Ladder Diagram of OR Gate

The ladder diagram of OR Gate is given below:

PLC Tutorial

When A = 0 and B = 1, the circuit will appear as:

PLC Tutorial

When A = 1 and B = 1, the circuit will appear as:

PLC Tutorial

Ladder Diagram of NOT Gate

The ladder diagram of NOT gate is a simple NC.

It will give output 1 if the input is 0 and vice versa.

PLC Tutorial

If the input is 0, the circuit will appear as:

PLC Tutorial

If the input is 1, the circuit will appear as:

PLC Tutorial

The lamp will not light because NC will become NO.

Universal Gates

The Universal Gates are NAND and NOR.

The truth table of NAND and NOR gate is given below:

A B NOR NAND
0 0 1 1
0 1 0 1
1 0 0 1
1 1 0 0

Ladder Diagram of NAND Gate

The ladder diagram of NAND Gate is given below:

PLC Tutorial

When, A = 1 and B = 0, the circuit will appear as:

PLC Tutorial

Here, the lamp will light.

If A = 1 and B = 1, the lamp will not light because both NC will become NO.

Hence, the condition is satisfied.

Ladder Diagram of NOR Gate

The ladder diagram of NOR Gate is given below:

PLC Tutorial

When, A = 1 and B = 0, the circuit will appear as:

PLC Tutorial

Here, the lamp will not light because the first NC will become NO.

If A = 0 and B = 0, the lamp will light because both NC will remain the same.

Hence, the condition is satisfied.

Exclusive Gates

The Exclusive Gates are XOR and XNOR.

The truth table of EX-OR and Ex-NOR gate is given below:

A B XOR XNOR
0 0 0 1
0 1 1 0
1 0 1 0
1 1 0 1

For XOR

For XNOR

Ladder Diagram of XOR Gate

The ladder diagram of XOR Gate is given below:

PLC Tutorial

When A = 0 and B = 1, the circuit will appear as:

PLC Tutorial

Here, the lamp will light.

But, if A = 1 and B = 1, the circuit will appear as:

PLC Tutorial

Here, the lamp will not light because both the NC of the circuit becomes NO.

Hence, the condition is satisfied.

Ladder Diagram of XNOR Gate

The ladder diagram of XNOR Gate is given below:

PLC Tutorial

When A = 0 and B = 1, the circuit will appear as:

PLC Tutorial

The lamp will not light. The circuit is incomplete for the current to flow.

But, if A = 1 and B = 1, the circuit will appear as:

PLC Tutorial

Here, the lamp will light.

Hence, the condition is satisfied.

Memory Mapping in PLC

The memory mapping in PLC is discussed below:

1 byte = 8 bits.

1 bit = 0 or 1

2 bytes = 2 x 8 = 16 bits = 1 word

4 bits = nibble

2 word = 32 bit = 4 byte = 8 nibble = 1 double word

The memory is divided into program, words, and discrete registers.

Program: The program is created using functional blocks and symbols. The functional blocks, functions, and blocks can be programmed using five programming languages, as discussed above.

Words: 1 word = 16 bits.

Discrete Registers: The 1-bit registers that can be used as input are considered as discrete registers. The 16-bit registers that can be used as input are considered as Input register.

Consider the partial memory map for the PLCs, which is shown in the below table:

File No. File type Addressing range
0 Output Image O:0 to O:30
1 Input ImageI:0 to I:30
2 Status S:0 to S:n
3 Binary B3:0 to B3:255
4 Timers T4:0 to T4:255
5 Counters C5:0 to C5:255
6 Control R6:0 to R6:255
7 Integer N7:0 to N7:255
8 Floating-point F8:0 to F8:255

Memory Areas

The Memory areas in PLC are categorized as Load Memory, Work memory, and Retentive memory.

PLC Tutorial

Load Memory

It is a type of non-volatile memory. It contains the memory and the data blocks, code blocks, and the configuration of the hardware.

Work Memory

It is a type of volatile memory. It contains the memory and the data blocks. The work memory is only used in the CPU operation, and cannot be extended.

Retentive Memory

It is a type of non-volatile memory. It saves a limited amount of data in case of a power failure. But, certain actions like memory reset and factory settings reset can cause the deletion of memory objects of the retentive memory.

Other Components used in Programming

Other components used in the programming are listed below:

Timers

The Timers in PLC provides the ON and OFF time delay like electronics relays. For example, a timer of 5s is placed in the ladder circuit. The output will be OFF/ON after duration of 5 seconds.

The timers are categorized as ON timer, OFF timer, and Pulse timer.

ON Timer

The output in ON timer is turned ON after the specified delay. It is the most commonly used delay timer.

The ON Timer is represented as the figure shown below:

PLC Tutorial
PLC Tutorial

We can represent the time in two ways called seconds and milliseconds.

For example,

  1. T # 5S_200MS
  2. T#3S

Where,

S means seconds and MS means milliseconds

The parameters in the ON timer are listed below:

Timer Number: file name

Time Base: Time shown as a base. Here, it is shown in seconds

Preset Value: specified delay time

Accumulated value: Value becomes 0 when the timer is reset. It starts the timer counting from 0.

The output of the ladder diagram is turned ON when accumulated time becomes equal to the Preset time.

How ON timer works?

When the condition or the logic diagram becomes true, the timer starts counting. It counts until the specified delay time. For example, if the delay time is 10 seconds, the timer will count upto 10 seconds. The counting appears in the accumulated value section. As soon as the value of the accumulated section becomes equal to the Preset value (specified value), the logic operates (true) and turns the output ON.

Consider the below graph:

PLC Tutorial

OFF Timer

The output in the OFF timer is turned OFF after the specified delay. It is represented as the figure shown below:

PLC Tutorial
PLC Tutorial

The parameters in the OFF timer are similar to the parameters of the ON timer.

The output of the ladder diagram is turned OFF when the accumulated time becomes equal to the Preset time.

How OFF timer works?

When the condition or the logic diagram becomes true, the timer starts accumulating. It counts until the accumulated value becomes equal as the specified present value. As soon as the value of the accumulated section becomes equal to the Preset value (specified value), the output becomes false and turns the output OFF.

Consider the below graph:

PLC Tutorial

S_PULSE Timer

The pulse timer is used to generate pulses. It generated pulses of the specified length.

The pulse timer is shown below:

PLC Tutorial

The parameters of the S_PULSE Timer are discussed below:

S: It means SET. It is defined as the trigger signal of the timer.

TV: It means the timer value stored in the timer. The time value is represented as S5T#TV, where TV is the specified time value.

Let’s consider an example:

S5T#10S

Here,

10s is the time specified in seconds.

R: It means RESET. It is defined as the reset signal of the timer.

Q: It is the output of the Pulse timer.

BI: It represents the current time in the binary code.

BCD: It represents the current time in the binary coded decimal.

The time is specified in the form of S5T#5s.

Where,

5s is the specified time in seconds.

To set the time as 10 seconds, we will declare it as S5T#10s.

How does Pulse Timer work?

The set input (S) of the timer becomes active when it receives a positive pulse. The timer is in running state as long as the input is ‘1’. When the input changes its state from 0 to 1, the output is enabled. The timer keeps running until the accumulator value reaches the Preset value. We can read the accumulator value at the BI and BCD output of the Pulse timer.

Consider the below graph:

PLC Tutorial

S_ODT

Here, ODT stands for On Delay Timer. The timer runs as long as the input state of the signal is positive.

The S-ODT timer is shown below:

PLC Tutorial

The parameters of the S_ODT timers are similar to the S_PULSE timers.

S-ODTS

Here, ODTR stands for On Delay Timer. It is a type of Retentive On-delay timer.

The timer starts when the SET state of the timer is positive. The timer restarts when there is a change in the state from 0 to 1.

The S-ODTS timer is shown below:

PLC Tutorial

Let’s consider the graphs of S_PULSE, S_ODT, and S_ODTS timers, which are given below:

PLC Tutorial

Here, TV represents the specified timer value.

Counters

The counters are categorized as Step-up, Step-down, and Step-up-down.

Step-up Counter

The up-counter is used for counting up.

The functional block of the up-counter will appear as the figure shown below:

PLC Tutorial

The parameters of the functional block are discussed below:

CU: It determines the input state of the counter.

R: It means RESET. It is defined as the reset signal of the counter.

PV: It is defined as the limit of the counter.

Q: It means Output.

CV: It is defined as the current counter value.

The count value in the counter is represented as C # 10. The counter will count serially till 10 pulses.

How it works?

Each pulse on the input of the counter will increase its current value by 1. The output (Q) comes in the SET state when the current counter value is equal or greater than the counter limit.

A pulse on the Reset (R) will reset the state of the counter. It means that the current counter value of the counter will become 0.

Step-down Counter

The down-counter is used for counting down.

The functional block of the down-counter will appear as the figure shown below:

PLC Tutorial

The parameters of the block are discussed below:

CD: It determines the input state of the down counter.

LD: It is called the load input.

PV: PV means the limit of the counter.

Q: It means Output.

CV: It is defined as the current counter value.

How does it work?

Each pulse on the input of the down-counter will decrease its current value by 1. It means that the counter value will decrement by 1. The output (Q) comes in the SET state when the current counter value is equal or less than 0.

A pulse on the load input (LD) determines the counter limit value (PV). The value of the counter limit is further assigned to the CV (current counter value).

Step-up-down Counter

The up-down counter can be used for counting in both ways. We can set the up and down limit of the same number using the up-down counter.

The functional block of the up-down counter will appear as the figure shown below:

PLC Tutorial

The parameters of the block are discussed below:

CU: It determines the input state of the up counter.

CD: It determines the input state of the down counter.

R: It means RESET. It is defined as the reset signal of the counter.

LD: It is called the load input of the down counter.

PV: It is defined as the limit of the counter.

QU: It means Output of the Up counter.

QD: It means Output of the Down counter.

CV: It is defined as the current counter value.

How does it work?

Each pulse on the input of the up-counter will increase its current value by 1. Each pulse on the input of the down counter will decrease its current value by 1.

The output (QU) comes in the SET state when the current counter value is greater or equal than the counter limit (PV). The output (QD) comes in the SET state when the current counter value is equal or less than 0.

A pulse on the Reset (R) will reset the state of the counter. It means that the current counter value of the counter will become 0.

A pulse on the load input (LD) determines the counter limit value (PV). The value of the counter limit is further assigned to the CV (current counter value).

Comparators

The comparators are used to compare two values. We can also compare physical quantities such as pressure, temperature, etc. using comparators.

The types of values that can be compared using comparator are equal, greater than, less than, not equal, check the validity, and check invalidity.

The value in comparators is represented as:

Equal comparator: CMP = = 1

Here, one is the value being compared to. It is used to determine if the first value is equal to a second value or not. Similarly, not equal is used to determine if the first value is not equal to the second value.

The equal comparator is represented as the figure shown below:

PLC Tutorial

Greater or equal comparator: CMP > = 1

It is used to determine if the first value is greater than or equal to the second value or not.

Less or equal comparator: CMP < = 1

It is used to determine if the first value is less than or equal to the second value or not.

Less than comparator: CMP < 1

It is used to determine if the first value is less than the second value or not.

Greater than comparator: CMP >1

It is used to determine if the first value is less than the second value or not.

Now, we have discussed about timers, comparators, counters, and pushbuttons.

Let’s implement these in the ladder diagram. It will make to clearly understand the concept of the ladder diagram and the components used in it.

Consider the below examples.


Examples

Example 1: We have three pushbuttons. If A, B, and C are pressed, the red LED goes ON. If A and B are pressed, the green LED goes ON. It means that only one LED is on at a time.

Solution:

Given: Here, there are two LEDs: green and red. At a time, one LED light. It can be either green or red.

Push buttons: A, B, C

We will create a ladder diagram based on the above logic.

The ladder diagram is shown below:

PLC Tutorial

Here, we have inserted both NO and NC of the same button ‘C’ in the ladder diagram. When we press a NO button, it turns NC. When we press NC button, it turns NO.

When we press the C button, we are pressing both the NO and NC of button C.

Let’s start.

Case 1: Press all A, B, and C buttons together.

The circuit will now appear as:

PLC Tutorial

Here, the red LED will light, as shown above.

Note: The above symbols are colored only for a better understanding.

Case 2: Press only A and B button.

NC always allows the current to pass through the circuit. It only becomes NO, when we press it.

The circuit will now appear as:

PLC Tutorial

Here, the green LED will light. Since, the C button was NC, it also allows the current to pass.

Example 2: We have four push buttons. When A, B, and C are pressed, output goes ON. When C and D are pressed, the same output goes ON.

Solution:

Given: Here, there are four pushbuttons: A, B, C, and D.

But here, we have only one output.

We will create a ladder diagram based on the above logic.

The ladder diagram is shown below:

PLC Tutorial

Here, we have used NO (Normally Open) for all the four push buttons. If we want, we can also add NC for the D button in series with the three (A, B, C) push buttons. It will have no change in the output.

Let’s start.

Case 1: Press A, B, and C buttons.

The circuit will now appear as:

PLC Tutorial

Case 2: Press C and D button.

The circuit will now appear as:

PLC Tutorial

Since A and B push buttons were off, the Output goes ON from the lower series of C and D buttons.

Example 3: We have four inputs. Input 1 turns output ‘A’ ON. Input 1, 2, 3, and 4 turns output ‘B’ ON, while Input 1 and 2 turns ON output ‘C’ ON.

Solution:

Given: Here, there are four inputs (1, 2, 3, and 4) and three outputs (A, B, and C).

We will create a ladder diagram based on the above logic.

The ladder diagram is shown below:

PLC Tutorial

Let’s start.

Case 1: Press input 1.

The circuit will now appear as:

PLC Tutorial

Here, output A goes ON.

Case 2: Press all the inputs.

The circuit will now appear as:

PLC Tutorial

We have pressed all the four inputs (1, 2, 3, and 4). Here, output B goes ON.

As input 2 on the first row and input 3 on the third row is NC. So, pressing them will block the current flow.

Case 3: Press input 1 and 2.

The circuit will now appear as:

PLC Tutorial

Input 3 is NC. So, it allows the current to reach Output C. Hence; output C goes ON.

Example 4: We have three inputs and three LEDs as an output.

When we press button A and B, the red LED turns ON. When we press button A B, and C, the green LED turns ON. When we press button B and C, the yellow LED turns ON.

Solution:

Given: Here, there are three inputs (A, B, and C) and three outputs as LED (Red, Green, and the Yellow).

We will create a ladder diagram based on the above logic.

The ladder diagram is shown below:

PLC Tutorial

Let’s start.

Case 1: Pressing button A and B.

The circuit will now appear as:

PLC Tutorial

Here, red LED will light.

Case 2: Pressing all the buttons.

The circuit will now appear as:

PLC Tutorial

A is an NC button in the third row, which on pressing blocks the current flow. Hence, the Green LED will light.

We can also insert NC of the B button instead of the A button in the third row. According to the question, we can set the NO and NC as per our choice. But, it should not have any adverse impact on the output.

Case 3: Pressing button B and C.

The circuit will now appear as:

PLC Tutorial

Now, we will discuss some examples of timers and counters.

Example 4: There are two motors (1 and 2). Motor 1 becomes ON by pressing the start button. But, when the stop is pressed, it becomes OFF, and Motor 2 is ON for 10 seconds.

Solution:

Given: Here, there are two motors. There is the use of time duration in seconds. Hence, timers will be used.

We will create a ladder diagram based on the above logic. The circuit implementation using the timers, etc. is quite difficult than normal circuits.

Here, we will use the Pulse timer.

We will draw the three ladder diagrams.

The above process is explained step by step.

Let’s start.

Step 1: First ladder diagram

The first ladder diagram is shown below:

PLC Tutorial

Here,

‘Q 0.0’ is the output of the first ladder. The output ‘Q 0.0’ parallel with the ‘I 0.1’ button acts as a buffer for the circuit.

‘I 0.1’ is the start button.

The output of the circuit is considered as the output of Motor 1.

Working: When we press the start button, Motor 1 becomes ON.

The circuit after pressing the start button will appear as the image shown below:

PLC Tutorial

Step 2: Second ladder diagram

The second ladder diagram is shown below:

PLC Tutorial

Where,

‘I 0.2’ is the stop button.

Working: When we press the ‘I 0.2’ button, it will turn on the output I 0.0, which is an NC for the first ladder diagram. The NC ‘I 0.0’ is a pressed button, which will block the current flow in the first ladder diagram. It will further turn OFF the motor 1.

The circuit after pressing the stop button will appear as:

PLC Tutorial

The first ladder diagram appears as:

PLC Tutorial

Step 3: Third ladder diagram

The third ladder diagram is shown below:

PLC Tutorial

Q 0.1: Output of the Motor 2.

Working: When we press the ‘I 0.2’ button, it will turn on pulse timer. The timer will go ON the output Q 0.1. The output will remain ON for the specified duration of 10 seconds. When the counting in the accumulator becomes equal to the Preset value (10), timer stops.

Hence, all the conditions are satisfied according to the question. Similarly, we can create the logic diagram for other questions as well.

Step 4: Full circuit

The full circuit with three ladder diagrams is shown below:

PLC Tutorial

Note: If we want to ON any device after 10 seconds, we must use the S_ODT timer.

Automation Tools

The Automation tools are ANN (Artificial Neural Network), DCS (Distributed Control System), HMI (Human Machine Interface), SCADA (Supervisory Control and Data Acquisition.), and PLC (Programmable Logic Controller).

Let’s discuss the main differences between PLC and SCADA.

SCADA

SCADA or Supervisory Control and Data Acquisition is a software used to control and monitor an industrial process accomplished by the PLC. It is generally used for high-level process management systems and analyzing real-time data.

SCADA is mostly used in combination with the PLC, and other devices. The function of SCADA is to control the entire system, while the role of PLC is to act as controller points for specific assets. SCADA includes several components, due to which it possesses greater capability than PLC.

PLC and SCADA are used in the automation industry, such as oil and gas, energy, waste control, transportation, water control, etc.

PLC vs. SCADA

The differences between PLC and SCADA are listed below:

PLC SCADA
It stands for Programmable Logic Controller. It stands for Supervisory Control and Data Acquisition.
It comprises CPU, I/O modules, and the peripheral devices. It comprises of computers, GUI (Graphical User Interface), and networked data communications.
It is hardware. It is software.
It is a system that controls motors and complex machines. It is a system to run and monitor the plant processes.
It is a hardware device that can be of various types, as per the requirements. It consists of several components that increase its capability.

You may also like