Introduction To PLC
Introduction To PLC
Information
Engineering Systems
Department
Applications of PLCs
When the first electronic machine controls were designed, they used relays to control the
machine logic (i e. press "Start" to start the machine and press "Stop" to stop the machine).
A complex machine might need a wall covered in relays to control all of its functions.
□ Agriculture : On many agricultural sites, PLCs are primarily used to control the
mechanical level, PLCs in the agriculture industry have been used in simple tasks,
such as modular PLC controllers , to highly specialized tasks, such as fully automated
irrigation systems that monitor soil moisture levels and replenishes them
appropriately.
□ Robotics : PLCs are used in robotics applications to control robot movements,
motor control, and feedback systems.
□ Transportation: PLCs are used in transportation applications such as railway
signaling and control, airport baggage handling, and traffic control systems.
□ Energy and Utilities: PLCs are used in energy and utility applications such as
power generation and distribution, water treatment, and oil and gas refining.
□ Manufacturing: PLCs are widely used in manufacturing industries such as
automotive, electronics, and food and beverage to automate production processes such
Introduction to PLC
as assembly lines, material handling, and quality control.
Advantages of PLCs
□ Reliability.
□ Flexibility in programming and reprogramming.
□ Cost effective for controlling complex systems.
□ High speed of operation.
□ Ability to communicate with computer systems in the plant.
□ Ease of maintenance /troubleshooting.
□ Reduced space.
□ Energy saving.
Disadvantages of PLCs
□ PLC devices are proprietary it means that part or software of one manufacturer
can’t be used in combination with parts of another manufacturer.
□ Debugging the PLC sometimes consumes a lot of time.
2 Introduction to PLC
3 Introduction to PLC
Major components of a common PLC
This type of PLC is most commonly called the Fixed I/O PLC. “Fixed I/O” actually stands
for Fixed “Input/Output”. When you buy Compact PLCs, you will notice that the input
section and the output sections of the PLC are integrated into the microcontroller itself.
This means that every type of output or input is fixed and is determined by the
manufacturer. Furthermore, the number of inputs and outputs may not be expanded in this
type of PLC.
I Introduction to PLC
b- Modular PLC
The modular PLC is a type that allows multiple expansions of the PLC system through the
use of modules, hence the term “modular”.
Modules give the programmable logic controller additional features like increased
number of I/O units, and they are usually easier to use because each component is
independent of each other.
The power supply, communications module, Input/Output module are all separate to the
actual microcontroller so you have to manually connect them to each other to create your
PLC control system.
5 Introduction to PLC
A type of modular PLC is the rack-mounted or rack mount PLC. In a rack mount PLC, the
communications module of the PLC resides in the rack itself, so all connections are
centralized.
PLC models
Siemens PLC
Simulation software
The Simulation software used in this laboratory is GEMO programming software which is
used to develop the ladder programs “off-line”.
Ladder Diagram is built in the form of horizontal rungs with two vertical rails that represent
the electrical connection on relay-logic schematics.
You can program all the necessary input conditions to affect the output conditions, whether
logical or physical.
8 Introduction to PLC
Unlike traditional flowcharts, the Sequential Function Charts can have multiple paths. You
can use branches to initiate multiple steps at one time.
2- 1. Sequential Function Charts Advantages A couple of
the advantages of Sequential Function Charts are:
1. Processes can be broken into major steps that can make troubleshooting faster and
easier.
2. You have direct access in the logic to see where a piece of equipment faulted.
3. It can be faster to design and write the logic due to the ability to use repeated
executions of individual pieces of logic.
2- 2. Sequential Function Charts Disadvantages
Even when you consider the advantages of the Sequential Function Charts, this PLC
Programming Language does not always fit every application.
2. There can also be many errors that are more difficult to deal with in comparison to many
of the other languages that I have previously reviewed.
13 Introduction to PLC
1 PROGRA
M
5. Instruction List LIST OF
X ERRORS -Fatal Error -Run-time
2
3 VAR ; TON;
: TON; ERROR
5
Timer l
Timeri RQQL; ! Error -Odd Address
Tag-i INT;
6
7 Tag-i TIME;
TIME ;
Error -Programming
8 tlm
9 lOuti Error
LD Tag-i
ST Timeri.lN starts timer with rising edge, resets
GOTO marki
CAL Timeri (
PT:=tIni, REALPARS
wm
ST
Timeri.Q
Timen. IN
gets TRUE, delay time (PT) after a
i i timer with rising edge, resets
starts
marki:
LD Tag-i
AND
OR 3 -I- In the laboratory we use the ladder
programming language.
Ladder Editor
Main Screen
Main screen is seen after the application starts. Main screen is composed of; main menu,
Editor & Simulation Buttons, 5 Contact columns, 5 Link columns, Coil column and
Comment Column.
14 Introduction to PLC
Main Menu
Main menu is composed of the following sub menu items.
File
File sub menu item is composed of the following sub menu items;
• New : Starts a new/empty diagram
• Open : Opens a previously saved diagram
• Save : Saves current/open diagram
• Save as : Saves current/open diagram with a new/different name
• Print : Opens print dialog.
• Search Contact : Use to search a specific contact in the diagram. Use F3 for
• the next one.
• Search Coil : Use to search a specific coil in the diagram. Use F4 for the
• next one.
• Save As Ver2.2 : Use to save file in Ver2.2. format
• Exit : Ends application
15 Introduction to PLC
Settings
Settings sub menu item is composed of the following sub menu items.
• Discrete Inputs : Opens Discrete Inputs sub screen.
• Discrete Outputs : Opens Discrete Outputs sub screen.
• Auxiliary Relays : Opens Auxiliary Relays sub screen.
• Timers : Opens Timers sub screen.
• Timer Ticks : Opens Timer Ticks sub screen.
• Counters : Opens Counters sub screen.
• Counter Comparators : Opens Counter Comparators sub screen.
• Fast Input Counters : Opens Fast Input Counters sub screen.
• State Machines A/B : Opens State Machines sub screen.
• Front Panel F Keys : Opens Front Panel F Keys sub screen.
• 0-10V Analog Inputs : Opens 0-10V Analog Inputs sub screen.
• Analog Comparators : Opens Analog Comparators sub screen.
• Special Password Flags: Opens Special Password Flags sub screen.
• Configuration Flags : Opens Configuration Flags sub screen.
• MODBUS Setting : Opens MODBUS Setting sub screen.
• System Settings : Opens System Settings sub screen.
• Yearly Alarms : Opens Yearly Alarms sub screen.
• Weekly Alarms : Opens Weekly Alarms sub screen.
• Run Time Screens : Opens Run Time Screens sub screen.
• Menu Designer : Opens LCD Menu Designer sub screen.
16 Introduction to PLC
Diagram
Diagram sub menu item is composed of the following sub menu items.
• Ladder Symbols : Diagram is drawn with ladder symbols.
• Electrical Symbols : Diagram is drawn with electrical symbols.
File Settings Diagram Dil/Language Data Transfer Miscellaneous
View
This sub menu is active in simulation mode. User selects show/hide of relevant simulation
sub screens via this sub menu.
• Discrete Inputs : Show / Hide
• Discrete Outputs : Show / Hide
• Auxiliary Relays : Show / Hide
• Timers : Show / Hide
• Counters : Show / Hide
• Counter Comparators : Show / Hide
• State Machine A : Show / Hide
17 Introduction to PLC
• State Machine B : Show / Hide
• Front Panel F Keys : Show / Hide
• Analog Comparators : Show / Hide
• Special Password Flags: Show / Hide
• Weekly Alarms : Show / Hide
• MODBUS Contacts : Show / Hide
• Analog Inputs : Show / Hide
• LCD Module : Show / Hide
Dil / Language
Dil / Language sub menu item is composed of the following sub menu items.
Qrl+AK+T
✓ English Cbri+Alt+E k
Data Transfer
Data Transfer sub menu item is composed of the following sub menu items.
• Select Communication Port : Selects RS-232 port to download; COM1,
• COM2, COM3, COM4, COM20 or COM21.
• Set Communication Speed : Selects communication speed; Fast or normal.
• Fast is introduced with Ver2.3.
18 Introduction to PLC
• Download New Program : Starts downloading current ladder
• diagram/program to Smart Relay. Previously stored diagram/program in smart
• relay is permanently replaced with the new one.
• Erase Device Program : Previously stored diagram/program in smart
• relay is permanently erased. User can download a new one any time later on.
• Check Device Type/Version : Used to check type and version of connected
• device.
• Reset (Reboot) Device : Used to soft-reset device.
• Calibration : Used after production or maintenance.
Miscellaneous
Miscellaneous sub menu item is composed of the following sub menu items.
• About : Displays information about editor.
• Conversion Calculator: Starts 4..20mA ^ 0..10 V Conversion Calculator for
• AR2.
19 Introduction to PLC
• Read License : Displays license information
Fig.1
This kit is the design of a set of experiments that linked
with PLC. Parts of this design will be displayed as
follows:
20 Introduction to PLC
I/O ports:
Fig.2
1- Inputs Parts: this used to supply voltage to components.
2- Outputs Parts: this used to input voltage.
3- Variable Voltage: Potentiometer that is used to supply analog voltage.
4- Display Voltage (3 Digits).
5- 12 Volts Supply Voltage.
6- 5 Volts Supply Voltage.
7- Analog Inputs Parts.
8- DC Motor Forward and Reverse Movements.
Fig.3
This process in Fig.4 requires that boxes moving on a conveyor be automatically positioned
and filled. The sequence of operation for the continuous filling operation is as follows:
• Start the conveyor when the start button is momentarily pressed.
• Stop the conveyor when the stop button is momentarily pressed.
• Energize the run status light when the process is operating.
• Energize the standby status light when the process is stopped.
• Stop the conveyor when the right edge of the box is first sensed by the photosensor.
• With the box in position and the conveyor stopped, open the solenoid valve and allow
22 Introduction to PLC
the box to fill. Filling should stop when the level sensor goes true.
• Energize the full light when the box is full. The full light should remain energized until
the box is moved clear of the photosensor.
EXP#2: Soft Drink Machine
Fig.5
As in Fig.5, a coin is inserted into the coin slot. Once detected, if a drink button is pressed,
the correct drink will be dispensed and the coin kept or if the reject button is pressed, the
coin will be rejected and no drink will be dispensed.
EXP#3: Sorting Device for Packages
Fig.6
23 Introduction to PLC
As in Fig.6, a Job is travels down a conveyor. Size of the job is identified by the help of job
length sensor I/P s (I/P 0 and I/P 1). If both the sensor sensed at a time when job is passed
then the job will be treated as big job. Or if only one sensor is sensed at a time then job will
be treated as small job. When job is reached to the rotary table, the table should turn either
left or right depending upon the size of job. The relevant piston should move the box to the
correct conveyor and the box should then continue to the end of that conveyor.
Feed
PAINT
Magazine
STATION
vl
Valv
7]
e P
PAINT SPRAY
C ---- 1
----- 3
HOPPFR
START
Valve 3
Fig.7
In Fig.7 that shown the paint spraying system where boxes are fed by gravity through a
feeder magazine one at a time onto a moving conveyor belt.
EXP#5: Product Packaging
Fig.8
24 Introduction to PLC
In Fig.8 that shown the Product Package System. Once the photoelectric sensor (X0) detects
10 products, the robotic arm (Y0) will begin to pack up. When the action is completed, the
robotic arm and the counter will be reset.
EXP#6: Motor Movement
LADDER Diagram
Ladder logic (also known as ladder diagram or LD) is a programming language used to
program a PLC (Programmable Logic Controller). It is a graphical PLC programming
language which expresses logic operations with symbolic notation. Ladder logic is made
out of rungs of logic, forming what looks like a ladder - hence the name ‘Ladder Logic’.
And if we were to draw a ladder scheme for lighting a flashlight with a flashlight, it would
look like this:
Switch Lamp
2- AND Gate
26 PLC Ladder Programming with Logic Gates
3- NOT Gate
4- NAND Gate
27 PLC Ladder Programming with Logic Gates
5- Exclusive-OR Gate
Block Diagram of a PLC
m
00X1 ft L2 Y1 0(0
00X2 Y2O0
00X3 Y3 °0
00X4 PLC Y4 °0
00X5 Y5 0(0
00X6 Y6O0
Piogia
0 Common Source 0
mming
poll
Ladder programming example
Ladder Logic Program for Start/Stop of Motor:
28 PLC Ladder Programming with Logic Gates
Programming a PLC
Programming a PLC
r.u )i
SlrlM
®°x:
0ox Motor
(xxitodoi
00X3 Y3 °0
f.l >1 0 0 X4 PLC Y4«0
stop
>r
00X5 Y5
°0
0ox6 Y6 O0
I- 00 otnrr.cn So u rce
Y1
HH
29 PLC Ladder Programming with Logic Gates
Starting of motor
30 PLC Ladder Programming with Logic Gates
Continuous
Moto
r
Motor
ooiiUtolor
anergiz
P.V' PLC 4 O0 eo
StO
Nir
C 00X
5@o ¥bO
■©KG i-^
0
-Mf
31 PLC Ladder Programming with Logic Gates
To Stop the Motor
32 PLC Experiment No.1
Objectives
At the end of the session, students will be able to design PLC program to controlling motors
and design logic circuits.
Problems Description 1. Converting Hardwired relay logic circuits into a PLC based
logic diagrams:
a) Design the PLC ladder diagrams for the given hardwired relay logic circuits:
b)
b) In a certain bank each, of three bank officers has a unique switch key to the vault. The
33 PLC Experiment No.1
bank rules require that two out of three officer's switches be activated to open the vault.
Draw the PLC basic ladder logic diagram for hardwired relay logic circuit that will unlatch
the door and turn on a light when two of three switches are activated.
b) Suppose we were given the task of designing a flame detection circuit for a toxic waste
incinerator. The intense heat of the fire is intended to neutralize the toxicity of the waste
introduced into the incinerator. Such combustion-based techniques are commonly used to
neutralize medical waste, which may be infected with deadly viruses or bacteria:
Toxic waste
inlet
34 PLC Experiment No.1
Toxic waste incinerator {
Design the circuitry of the logic system to open the waste valve if and only if there
is good flame proven by the sensors, first when the three sensors are detects flame.
As the following truth table:
sensor
inputs
, ___i ___ ,
AB C Output
0 0 0 0 Output = 0
0 0 1 0 (close valve)
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0 Output = 1
(open valve)
1 1 1 1
36 PLC Experiment No.1
The output of the circuit will be “high” if and only if input A AND input B AND input C
are all “high".
Toxic waste inlet
If using relay circuitry, we could create this AND function by wiring three relay contacts in
series, or simply by wiring the three sensor contacts in series, so that the only way electrical
power could be sent to open the waste valve is if all three sensors indicate flame:
37 PLC Experiment No.1
Secondly suppose that any single sensor failed “high”. That mean if “two out of
three” sensor logic were detects flame, the waste valve is opened. The truth table
for such a system would look like this:
sensor
inputs
AB C Output
0 0 0 0 Output = 0
0 0 1 0 (close valve)
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1 Output = 1
(open valve)
1 1 1 1
Now that we have a Boolean Sum-Of-Products expression for the truth table’s function, and
the logic gate or relay logic circuit based on that expression:
38 PLC Experiment No.1
ABC
L2
A CR1
B CR2
A
J7
\C CR3
A
c R1 C R2 C R3 _ Output
_ ABC
1
}
R1 C R2 C R3
c 1
ABC
c R1 C R2 C R3
' ABC
c R1 C R2 C R3
ABC
39 PLC Experiment No.1
Discussion
Draw the logic symbol, construct a truth table, ladder logic program, and state the Boolean
equation for each of the following: 1-
Relay schematic
2-
Relay schematic
40 PLC Experiment No.1
3-
41 PLC Experiment No.1
4-
Relay schematic
LS PB SOL
1
Relay schematic
A
B
o --- o \ o-
6- A motor control circuit with two start/stop buttons. When either start button is depressed,
the motor runs. By use of a seal-in contact, it continues to run when the
42 PLC Experiment No.2
Die Stamping Application
Objectives
At the end of the session, students will be able to design PLC program to controlling
automatic Die Stamp.
Problems Description
When the master switch is turn on the piston reciprocates between the extended and retracted
positions. When the master switch is turned off, the piston returns to the retracted position
and all solenoids are off.
43 PLC Experiment No.2
2. Define inputs and outputs:
Inputs
Address ypeT
Function
X0 Pushbutton Master switch
X1 Limit Switch Upper limit switch
X2 Limit Switch Lower limit switch
Outputs
Address T
ype Function
Y0 solenoid Up solenoid
Y1 solenoid Down Solenoid
3. Develop the PLC ladder diagram program and test its function.
Discussion
1- Repeat the Procedure above.
2- Explain the following:
i) What is limit switch?
ii) The Application of limit switch.
44 PLC Experiment No.3
Continuous filling operation
Objectives
At the end of the session, students will be able to design PLC program to controlling
automatic Continuous filling operation.
Problems Description
This process requires that boxes moving on a conveyor be automatically positioned and
filled. The sequence of operation for the continuous filling operation is as follows:
• Start the conveyor when the start button is momentarily pressed.
• Stop the conveyor when the stop button is momentarily pressed.
• Energize the run status light when the process is operating.
• Energize the standby status light when the process is stopped.
• Stop the conveyor when the right edge of the box is first sensed by the
photosensor.
45 PLC Experiment No.3
• With the box in position and the conveyor stopped, open the solenoid valve and allow
the box to fill. Filling should stop when the level sensor goes true.
• Energize the full light when the box is full. The full light should remain energized until
the box is moved clear of the photosensor.
2. Define inputs and outputs:
Inputs
Address ype
T
Function
Start Pushbutton Start process
Stop Pushbutton Stop process
Photo Switch Sensor Sense boxes
Level Switch Sensor Sense liquid levels
Outputs
Address T
ype Function
Motor Coil Conveyor motor
Solenoid solenoid Control liquid gate
Run Pilot Led
Process operating indicator
Standby Pilot Led
Process stopping indicator
Full Pilot Led Box full indicator
3. Develop the PLC ladder diagram program and test its function.
Discussion
1. What is a logic gate?
2. Explain the basic operating principle of an electromagnetic control relay.
3. What is the operating difference between a normally open and a normally closed relay
contact?
4. Compare the method of operation of each of the following types of switches:
a. Manually operated switch
b. Mechanically operated switch
c. Proximity switch
46 PLC Experiment No.3
Discussion
1. Explain the function of each of the following actuators:
a. Solenoid
b. Stepper motor
2. How does an ultrasonic sensor operate?
3. How does a photoelectric sensor operate?
4. A temperature control system consists of four thermostats controlling three heating
units. The thermostat contacts are set to close at 50°, 60°, 70°, and 80°F, respectively. The
PLC ladder logic program is to be designed so that at a temperature below 50°F, three
heaters are to be ON. Between 50° to 60°F, two heaters are to be ON. For 60° to 70°F, one
heater is to be ON. Above 80°F, there is a safety shutoff for all three heaters in case one
stays on because of a malfunction. A master switch is to be used to turn the system ON and
OFF. Prepare a typical PLC program for this control process.
49 PLC Experiment No.5
Timers
Sorting Device for Packages
Objectives
At the end of the session, students will be able to design PLC program to controlling
automatic Sorting Device for Packages and they have knowledge of timers.
V. conv. Piston
(O/PO)
IP
Job 0
lenstli sensor
Start push button ( I P ? 1
50 PLC Experiment No.5
2. Define inputs and outputs:
Inputs
Address T
ype Function
I0 Proxy sensor Box length sensor
I1 Proxy sensor Box length sensor
I2 Proxy sensor Rotary table sensor
I3 Proxy sensor Horizontal conv.sensor
I4 Proxy sensor Vertical conv. Sensor
I5 Push button Start button
Outputs
Address T
ype Function
O0 Solenoid Push to vertical conv.
O1 Solenoid Push to horizontal conv.
O2 Motor Starting conveyor
O3 Motor Horizontal conveyor
O4 Motor Vertical conveyor
O5 Motor Turn rotary table right
O6 Motor Turn rotary table left
3. Develop the PLC ladder diagram program and test its function.
Discussion
Q: Develop the PLC ladder diagram program and test its function for the following problem
that doing an automatic traffic light control: The sequence of the traffic lights is as follows:
RED
5 seconds later
RED & AMBER
5 seconds later
GREEN 5 seconds
delay
The sequence should be fully automatic and start with the RED 'ON' immediately
51 PLC Experiment No.5
52 PLC Experiment No.6
Counter
Product Packaging
Objectives
At the end of the session, students will be able to design PLC program to controlling
automatic Product Packaging and they have knowledge of counters.
Once the photoelectric sensor (X0) detects 10 products, the robotic arm (Y0) will begin to
pack up. When the action is completed, the robotic arm and the counter will be reset.
2. Define inputs and outputs.
Inputs
• X0 - Photoelectric sensor for counting products.
• X1 - Robotic arm action completed sensor.
Outputs
• Y0 - Robotic arm for packing
3. Develop the PLC ladder diagram program and test its function.
Discussion
1- Repeat the procedure above.
2- Explain the following: a-
53 PLC Experiment No.6
What is counter?
b- Applications that the counter is used for, with examples.
54 PLC Experiment No.7
Paint Spraying
Objectives
At the end of the session, students will be able to design PLC program to controlling
automatic Paint Spraying.
Paint spraying system where boxes are fed by gravity through a feeder magazine one at a
time onto a moving conveyor belt. Upon the start signal, boxes are pushed towards the
conveyor by valve 1. This is a cylinder which extends and retracts which operates switches
S1 and S2 respectfully. A spraying nozzle paints each box as it passes under the paint spray
controlled by valve 2. A sensor (S3) counts each box being sprayed. When 6 boxes have
been painted the valve 2 shuts off (paint spray) and valve 1 (cylinder) stops moving boxes
onto the conveyor. Three seconds later the conveyor stops moving and the hopper with its
load moves forward (valve 3) where it is emptied. Ten seconds later the hopper returns to
the original position. The cycle is then complete and waits for a start signal again.
55 PLC Experiment No.7
2. Define the Inputs and Outputs:
Inputs
• Start Switch - On/Off (Normally Open) - NO
• Stop Switch - On/Off (Normally Closed) - NC
• S1 - cylinder retract sensor (NO)
• S2 -cylinder extend sensor (NO)
• S3 - Box Detected sensor (NO)
Outputs
• Y0- Motor - On/Off (Conveyor Run)
• Y1- Cylinder to feed boxes - On/Off
• Y2- Paint Spray - On/Off
• Y3- Cylinder to move hopper - On/Off
3. Develop the PLC ladder diagram program and test its function.
Discussion
1- Repeat the procedure above.