Professional Documents
Culture Documents
Under Supervision of
Dr: Shahira Elfeky
By
1. Mohamed Hossam Fathy 20160782
2. Samir Magdy El Shahat 20160413
3. Mahmoud salah Mahmoud 20160964
4. Youssef shaban mohamed 20170966
5. Shimaa Samy El gohary 20170376
6. Mohamed Anas Hammad 20170628
Acknowledgments
Every project huge or small is successful largely due to the effort of a
number of wonderful people who have always given their valuable
advice or lent a helping hand. I sincerely appreciate the inspiration;
support and guidance of all those people who have been instrumental in
making this project a success.
Our deepest gratitude to Allah for holding our hands and guiding us
throughout our lives. We would also like to express our gratitude to
Dr: Shahira Elfeky supervisor of our project for his expert and for his
time.
I would also like to thank all the faculty members of our college for their
critical advice and guidance without which this project would not have
been possible.
Project Team
I
Abstract
This project work presents the study and design of PLC based intelligent car
parking.
Smart car parking is a place that allows entry and exit of cars in an orderly and
tidy manner, which achieves the largest internal capacity that helps in parking the
car, as the garage works automatically and is allowed to enter it provided that
there is one of the empty places inside the parking.
For making this arrangement in a real plan very high technological instruments
are required. In this project a prototype of such a model is made. This prototype
model is made for accommodating six cars at a time
The availability of a parking space is detected by the photocell sensor, and the
sensors are controlled and vacancies are checked by the PLC, in addition to an
external screen placed outside the garage to see if there are empty spaces inside
the garage or not, specifying the exact empty place.
The presence of these elements within the project is a means of assistance to car
owners that helps them to see the location of empty spaces inside the garage with
ease of entry and exit from it. Total comfort and flexibility for car owners.
Due to these advantages, this system can be used in hotels, railway stations,
airports where crowding of car is more.
II
List of Contents
Chapter 1 (Introduction)
1.1 Introduction …………………………………………………………………… 2
1.2 Improper parking ……………………………………………………………... 3
1.3 Project Idea …………………………………………………………………..... 5
1.4 Why Intelligent Car Parking? ………………………………………………... 6
Chapter 2 (Hardware)
2.1 Introduction……………………………………………………………………. 9
2.2 List of Component……………………………………………………………...10
2.3 Introduction to PLC……………………………………………………………10
2.3.1 History of PLC ……………………………………………………………10
2.3.2 Introduction to PLC……………………………………………………......11
2.3.3 Architecture of PLC ………………………………………………………12
2.3.4 Types of PLC …………………………………………………………......14
2.3.5 Manufacturers of PLCs …………………………………………………...16
2.3.6 Applications of PLC ……………………………………………………...16
2.3.7 Working of PLC ………………………………………………………….19
2.3.8 PLC used in project ……………………………………………………....22
2.4 Human Machine Interface (HMI)…………………………………………....24
2.4.1 Introduction……………………………………………………………….24
2.4.2 What is HMI?..............................................................................................25
2.4.3 HMI USES………………………………………………………………..25
2.4.4 Connection between PLC and HMI………………………………………28
2.4.5 SCADA vs HMI ………………………………………………………….29
2.5 Relay…………………………………………………………………………...30
2.5.1 Relay components…………………………………………………………31
2.5.2 Types of relay……………………………………………………………..33
2.5.3 Choosing the right relay…………………………………………………..34
2.5.4 A way to check the relay………………………………………………….34
III
2.6 Switches………………………………………………………………………35
2.6.1 Types of push buttons…………………………………………………...35
2.7 DC Motor…………………………………………………………………….36
2.7.1 Device installation………………………………………………………36
2.7.2 Main Types of DC Motors………………………………………………37
2.8 Sensor………………………………………………………………………...39
2.8.1 What is a sensor?......................................................................................39
2.8.2 Why We Use Sensors?.............................................................................40
2.8.3 Types of Sensors………………………………………………………..41
2.8.4 Types of proximity sensor………………………………………………44
Chapter 3 (Software)
3.1PLC Programming Languages……………………………………………..46
3.1.1Programming by ladder diagram………………………………………..47
3.2 Boolean logic design by ladder program……………………………………
3.3 PLC Counter……………………………………………………..
3.4 PLC TIMER ……………………………………………………………….
3.4.1 TIMER INSTRUCTIONS………………………………………………..
3.4.2 Types of PLC timers………………………………………………………
3.5 PLC Software of Project……………………………………………………
3.5.1 S 7200 wiring diagram ……………………………………………………
3.5.2 Plc Software of the project…………………………………………………
3.6 HMI in our project …………………………………………………………….
3.6.1 How we select the screen………………………………………………….
Conclusion…………………………………………………………………………
Reference…………………………………………………………………………..
IV
List of Figure
Fig(1) Improper parking…………………………………………………………………
Fig(2)Increase the number of cars……………………………………………………….
Fig(3)Car park entry……………………………………………………………………..
Fig(4) Parking inside……………………………………………………………………..
Fig(5) Our project……………………………………………………………………….
Fig(6) PLC SIEMENS…………………………………………………………………..
Fig(7) Architecture of PLC……………………………………………………………..
Fig(8) Mitsubishi Compact PLC ………………………………………………………………
Fig(9) Modular PLC…………………………………………………………………………………
Fig(10) Smart Relay ……………………………………………………………………………………
Fig(11) PLC Block Diagram………………………………………………………………………….
Fig(12) PLC Scan Cycle……………………………………………………………………………
Fig(13) PLC used in project………………………………………………………………………..
Fig(14) PLC Datasheet…………………………………………………………………
Fig(15) HMI forms…………………………………………………………………
Fig(16) screen and plc connection………………………………………………….
Fig(17) example of HMI……………………………………………………………
Fig(18) Connection between PLC, HMI, and PC …………………………………
Fig(19) Relay ……………………………………………………………………………
Fig(20) Relay Component……………………………………………………………….
Fig(21) Relay Contact points types……………………………………………………..
Fig(22) Types of push buttons………………………………………………………..
Fig(23) Device installation…………………………………………………………….
Fig(24) Permanent Magnet DC Motors…………………………………………………..
Fig(25) Compound DC Motors……………………………………………………………
Fig(26) Compound DC Motors………………………………………………………….
Fig(27) Series DC Motors………………………………………………………………..
Fig(28) Analog and Digital signals………………………………………………………
V
Fig(29) Sensor…………………………………………………………………………
Fig(30) types of sensors………………………………………………………………
Fig(31) proximity sensor………………………………………………………………
Fig(32) proximity sensor….……………………………………………………………
Fig(33) PNP proximity sensor………………………………………………………….
Fig(34) NPN proximity sensor…………………………………………………………..
Fig(35) Ladder Diagram………………………………………………………………..
Fig(36) AND logic ladder diagram ......................................................................................
Fig(37) OR logic ladder diagram .........................................................................................
Fig(38) NOT logic ladder diagram ......................................................................................
Fig(39) NAND logic ladder diagram ...................................................................................
Fig(40) NOR logic ladder diagram ......................................................................................
Fig(41) XOR logic ladder diagram ......................................................................................
Fig(42) X-NOR logic ladder diagram ..................................................................................
Fig(43) Counter function block with up, down, and reset counter instructions……………
Fig(44) PLC Timer………………………………………………………………………….
Fig(45) Timer Instruction…………………………………………………………………….
Fig(46) on-delay timer……………………………………………………………………
Fig(47) On-delay timer applications……………………………………………………..
Fig(48) Off-delay timer applications……………………………………………………
Fig(49) S 7200 wiring diagram……………………………………………………………
Fig(50)Network 1 of PLC program ....................................................................................
Fig(51)Network 2 of PLC program ....................................................................................
Fig(52)Network 3 of PLC program ....................................................................................
Fig(53)Network 4 of PLC program ....................................................................................
Fig(54) Network 5 of PLC program ....................................................................................
Fig(55) Network 6 of PLC program………………………………………………………
Fig(56) Network 7 of PLC program ....................................................................................
Fig(57)Network 8 of PLC program ....................................................................................
VI
Fig(58) Network 9 of PLC program ....................................................................................
Fig(59) Network 10 of PLC program ..................................................................................
Fig(60) select HMI…………………………………………………………………………
Fig (61) communication setting…………………………………………………………….
Fig (62) screen1…………………………………………………………………………….
Fig(63) screen1…………………………………………………………………………….
Fig (64) screen2……………………………………………………………………………
Fig(65) write address screen2……………………………………………………………..
Fig (66) read address in screen2…………………………………………………………..
Fig (67) parking in screan3………………………………………………………………..
VII
List of Tables
Table (1) Difference between Microcontroller and PLC…………………………………
Table (2) Counter instructions…………………………………………………………….
VIII
List of Abbreviations
DPST: A switch has two inputs and one output for each input
IX
Ch1: Introduction
1
1. Introduction
- Car parking systems have been around almost since the time cars were
invented. In any area where there is a significant amount of traffic, there are
car parking systems. Car Parking systems were developed in the early 20th
century in response to the need for storage space for vehicles.
- There are several advantages of employing a car park system for urban
planners, business owners and vehicle drivers. They offer convenience
for vehicle users and efficient usage of space for urban-based companies.
Automated car park systems save time, money, space and simplify the
often tedious task of parking.
2
1.2 Improper parking
Improper car parking is, when a car is not parked correctly in allocated
parking area. Due Improper car parking the space allocated for parking will
not be used in proper manner. This may create traffic congestion.
3
Fig(2)Increase the number of cars
- With the increase in the number of cars and the need for car owners for
parking spaces, this went with the direction of the owners of institutions and
public and private establishments to provide parking spaces, taking into
account providing comfort for car owners, facilitating entry and exit
processes or finding places inside the garage while saving time for owners of
these cars in finding places inside the garage.
4
1.3 Project Idea
- With the development in all areas of technology and the great development
in all branches, smart garages have begun to appear
- smart garages provide all means of safety and comfort that allow car owners
to be able to park their cars easily and conveniently, in addition to saving
time in searching for empty places to park.
- The idea of the project revolves around the practical application of the idea
of smart garages, where the project contains entry and exit gates for the entry
and exit of cars. The gates open if there are parking spaces inside and do not
allow opening at all if the number of places in cars inside is complete with
the availability of a screen to display if there are free places inside Or the
places are complete and with the vacant space specified specifically to make
it easier for car owners to find parking spaces.
- From the inside, there are sensors in every parking space that sense when the
car is parked in the specified place and are connected to the external HMI via
a PLC device.
5
1.4 Why Intelligent Car Parking?
Efficiency
The car parking system provides car parking solutions that accommodate
the maximum number of cars in the least space by organizing the parking
spaces in contrast to the random parking spaces
Saves Time
Easy
Informing car owners of the empty spaces and organizing the parking spaces
in an orderly manner that makes it easier for visitors to reach and move
easily, which saves effort and makes it easier for car owners.
Car Safety
Providing safety systems and guards to protect cars inside the garage that
provides safety for cars
Organizing the places from the inside appropriately with the organization of
the way of entering and leaving the garage, providing places for cars and
maintaining them, and avoiding cars colliding with each other.
6
Fig(3)Car park entry
7
Fig(4) Parking inside
8
Chapter2: Hardware
2.1 Intoduction
The car parking system is implemented on Siemens S7-200 PLC, this PLC also has integrated
HMI screen. HMI is an electronic device that connects the operator to the machine. It is
designed to make this project user friendly and easy to access.
Relay
Switches
Photo Sensor
In the 1960's PLC were first developed to replace relays and relay control systems. Relays,
while very useful in some applications, also have some problems. The primary reason for
designing such a device was eliminating the large cost involved in replacing the complicated
relay based machine control systems for major U.S. car manufacturers. These controllers
eliminated the need of rewiring and adding additional hardware for every new configuration of
logic. These, along with other considerations, led to the development of PLCs. PLC was more
improved in 1970‟s. In 1973 the ability to communicate between PLCs was added. This also
made it possible to have the controlling circuit quite a ways away from the machine it was
controlling. However, at this time the lack of standardization in PLCs created other problems.
This was improved in the 1980's. The size of PLC was also reduced then, thus using space
even more efficiently. The 90's increased the collection of ways in which a PLC could be
programmed.
10
2.3.2 Introduction to PLC:
- PLC (Programmable Logic Controller) is a device that was invented to replace the
necessary sequential relay circuits for machine control.
- The PLC works by looking at its inputs and depending upon their state, turning on/off its
outputs.
- The user enters a program, usually via software, that gives the desired results.
- PLCs are used in many "real world" applications. If there is industry present, chances are
good that there is a PLC present. If you are involved in machining, packaging, material
handling, automated assembly or countless other industries you are probably already
using them. If you are not, you are wasting money and time.
Almost any application that needs some type of electrical control has a need for a PLC.
11
2.3.3 Architecture of PLC
The PLC gives output in order to switch things on or off. The PLC‟s output is proportionally
activated according on the status of the system‟s feedback sensors and input terminal which is
connected to PLC. The decision to activate output is based on logic program. The logic
program stored in RAM or ROM memory. The PLC also have same as computer, a CPU, data
bus and address bus to communicate with external devices such as programmers, display
monitor. The next diagram shows a simplified diagram of PLC‟s structure. The central
processing unit control everything according to a program stored in a memory (RAM/ROM).
Everything is interconnected by two buses, the address bus and data bus. The system must be
able and A/D converter.
12
Advantages of PLC:
- Flexibility (in case of system function modification, the circuit need not to be rewired
but the modification will be done in the S/W program)
- Compact
- Easy to fault diagnostics and maintenance
- Decrease installation time
- Most modern PLC can be linked to SCADA system and HMI
- No need for additional auxiliary contacts, timers, counters and auxiliary contactors (or
relays)
Disadvantages of PLC:
13
2.3.4 Types of PLC
1- Compact PLC
A Compact PLC is the more simple type of controller, and contains all of the basic system
components within a single housing, or box. These components typically include the
processor, which runs the software program, in addition to ports for input and output
connections. Unitary PLCs are typically attached directly to the device or application that is
being controlled.
A commonly used example of a unitary PLC type is the MicroLogix 1000, built by Allen
Bradle6y. The MicroLogix 1000 includes on-board memory for storing programs, 32 digital
input and output ports, and a communications port used to program the unit. This setup is
typical of many unitary systems.
14
2- Modular PLC
A modular PLC shown in Fig 10 contains several different modules that can be coupled
together to build a customized controller. Typically, a base module contains core functions
such as electrical power regulation, the computer processor, and input connections. Additional
modules, including analog to digital signal converters or additional outputs, can be added to
this core unit as needed. This modular design allows a PLC to be customized and changed
easily.
The Allen Bradley MicroLogix 1200 is a commonly used example of the modular PLC type.
This unit is able to handle between 23 and 40 inputs and outputs. The actual number of
connections can be expanded easily by adding modules. This provides a wide range of
flexibility and is typical of a modular PLC.
15
2.3.5 Manufacturers of PLCs
Allen Bradley PLCs (AB)
Siemens PLCs
Omron PLCs
Mitsubishi PLCs
Hitachi PLCs
Delta PLCs
16
11. Modernization of boiler and turbo generator set.
- Number contacts per rung and number of rungs are limited in smart relay
17
Difference between Microcontroller and PLC
18
2.3.7 Working of PLC
Input module
• Digital input
• Analog input
The CPU is the brain of the system. The CPU is a very microprocessor-based system that
replaces control relays, counter, timers and sequencers. A processor appears only once in a plc
and it can be either a one bit (or) a word logic operation. PLCs with word processors are used
when processing text and numerical data, calculations, gauging, controlling and recording as
well as the simple processing of signals in binary code are required. The CPU accepts (reads)
input data from various sensing devices, executes the stored user program from memory and
sends appropriate commands to control device. A direct current (dc) source is required to
produce the flow level voltage used by the processor and the inputs and outputs modules. The
processor memory module is a major part of the CPU housing. Memory is where the control
plan or program is held or stored in the controller the information stored in the memory relates
to the way the input and output data should be processed
19
PLC Scan Cycle
20
Damage of PLC:
Over voltage in output module supply (which supplies loads connected with PLC output
module)
Over current because of connecting large loads directly with PLC output module
Short circuit (SC) in output module Fast output (in the range that relay contacts can sense it)
for long period (only if PLC is relay output) causes mechanical damage in the internal relay of
output module
22
Fig(14) PLC Datasheet
23
2.4 Human Machine Interface (HMI)
2.4.1 Introduction:
We use HMIs in industry to control and monitor machines. A very common
HMI that you all encounter on a regular basis would be an ATM machine. The
screen and push buttons allow you to operate the machine to dispense a certain
amount of money, or to deposit money.
- The possibilities are only limited to the software and hardware used.
24
2.4.2 What is HMI?
Although HMI is the most common term for this technology, it is sometimes referred to as
Man-Machine Interface (MMI), Operator Interface Terminal (OIT), Local Operator Interface
(LOI), or Operator Terminal (OT). HMI and Graphical User Interface (GUI) are similar but not
synonymous: GUIs are often leveraged within HMIs for visualization capabilities.
HMIs can connect to PLC logic and display it on the screen for troubleshooting
purposes. This can save valuable time compared to connecting a computer or laptop
every time.
The most common roles that interact with HMIs are operators, system integrators,
and engineers, particularly control system engineers. HMIs are essential resources
for these professionals, who use them to review and monitor processes, diagnose
problems, and visualize data.
26
sophisticated operations, like switching machines off or increasing production
speed, depending on how they are implemented.
HMIs are used to optimize an industrial process by digitizing and centralizing data for
a viewer. By leveraging HMI, operators can see important information displayed in
graphs, charts, or digital dashboards, view and manage alarms, and connect with
SCADA and MES systems, all through one console.
How does the HMI connect to the machine to be able to control and
monitor it?
it is not as easy as just placing a button on the screen or a tank with a level on the
screen. The person programming the HMI must program each indicator and button to
a specific input or output address of a PLC. Engineers can program an HMI to
perform almost any function that can be controlled or information that can be
27
monitored by a PLC. HMIs and PLCs work together to monitor and control the
machine.
Ethernet Connection:
In the past, it was common for PLC suppliers to limit connectivity to their own hardware and
software, but user demands have forced a move to more open systems. This openness now
allows many PLCs to link to just about any HMI, typically through Ethernet. While this takes
care of hardware connectivity in many instances, there's still the issue of protocol
compatibility. The ability to communicate with multiple protocols simultaneously on a single
network is a big advantage of Ethernet. This allows linking of two or more PLCs from
different suppliers to a single HMI -- all on the same network. If PLC A, B, and C each has an
Ethernet port but uses different communication protocols -- such as Modbus TCP/IP,
Ethernet/IP, and ProfNet -- the HMI can communicate with all three on the same network.
28
Fig (18) Connection between PLC, HMI, and PC
29
2.5 Relay
It is one of the most important electrical elements in electronic circuits, and it is a
mechanical switch that is electrically controlled by a voltage applied to the coil inside it.
The relay is more of a bearing element than an electronic one. It is available in different
sizes and with different endurance capacities starting from 1ampere up to 60ampere.
It is available in multiple voltages such as 220v 60v 48v 36v 24v 12v 9v 6v.
The contactor's composition is a normal contactor, but without points Only main
auxiliary points, so it is used in control circuits
It is an electrical element consisting of a mechanical switch that can be controlled
Electrically by connecting a voltage to its coil
Relay is widely spread in the industry in different sizes and in different shapes, but All
business ideas have one, and it is used in electronic and electrical circuits Various fields
of industry
Fig(19) Relay
30
2.5.1 Relay components
4. Contacts: There are open and closed contact points that open or
close the circuit (N/O - N/C – COMM)
31
Advantages of relays
1- Large size
2- Noisy
3- Design and installation time is large
4- Difficult in fault diagnostics and maintenance
Relay types according to the type of contact points
32
2.5.2 Types of relay
2- Latching relay
Its principle of operation is based on continuous conduction when pressed.
3- Contactor relay
It is similar to the idea of the relay, but it is used to feed large loads, such as electric
motors
4- Solid-state relay
It does not depend on the connection through mechanical parts and the magnetic coil,
but rather on the connection through an electronic board designed in a certain way to
perform the function of the relay, and this type is high in cost compared to mechanical
relays.
6- Mercury-Wetted relay
It works on conduction and separation by a drop of mercury inside a tube, in the case of
the conduction it is in a vertical position, and in the case of the separation it is in a
horizontal position.
33
2.5.3 Choosing the right relay
1- Relay coil voltage value and type, available in (6v, 9v, 12v, 15v, 24v, 36V, 48v).
3- The number and type of contact points, such as (DPDT, SPST, DPST, SPDT).
Through the Avo, by placing the Avo indicator on the ohm and measuring the
resistance.
As for petitions, the most important thing in them is that they be clean and measured
between each other as an ohm If you do not read anything, it is oxidized and must be
cleaned.
34
2.6 Switches
One of the most commonly used components in automatic control circuits or PLC are
push button switches.
Its uses: It is used to start or stop one or more engines. It can also be used in other things
according to the application
1- Type NO i.e. normally opened: it is always open and when pressed it turns into closed and when the
hand is raised it returns to open
2- NC type i.e. normally closed: it is always closed and when pressed it opens and when the hand is raised
it turns again to closed
3- Double type NO, NC: This type has two points, one of them is NO and the other is NC. When pressed,
it turns the open into closed and the closed into open. When the hand is raised, the original position is returned.
A DC motor is defined as a class of electrical motors that convert direct current electrical
energy into mechanical energy.
In its simplest form, the device consists of two magnetic poles, a north pole and a south pole,
separated by a certain distance - called a fixed member - in the middle of which is placed a coil
connected to a battery that supplies it with a constant current. The coil forms the rotor of the
motor.
36
Fig(23) Device installation
2- Compound DC Motors
3- Shunt DC Motors
37
Fig(26) Compound DC Motors
4- Series DC Motors
2.8 Sensor
2.8.1 What is a sensor?
A sensor is a device that measures physical input from its environment and converts it into data
that can be interpreted by either a human or a machine. Most sensors are electronic (the data is
converted into electronic data), but some are simpler, such as a glass thermometer, which
presents visual data. People use sensors to measure temperature, gauge distance, detect smoke,
regulate pressure and a myriad of other uses.
There are two types of electronic sensors: analog and digital. Analog sensors convert physical
data into an analog signal. Analog sensors are much more precise than digital sensors, which
are limited to a finite set of possible values. Below is a chart showing the difference between
analog and digital signals:
39
Because analog signals are continuous, they can account for the slightest change in the
physical variable (such as temperature or pressure). Digital signals, while following the general
trend of variation, are restricted to fixed data (ones and zeros).
There are a multitude of types of sensors. In the average automobile alone, there are dozens of
different types of sensors. Tire pressure sensors indicate whether a tire is flat or in need of
more air. Self-driving cars such as the Tesla are equipped with ultrasonic sensors that measure
the distance between the vehicle and other objects in its environment using sound waves.
Home security systems use motion sensors, which detect the movement of primarily larger
objects. The most used motion sensor for home surveillance is called a Passive Infrared (PIR)
system, which detects infrared radiation in the sensor’s environment.
.
Fig(29) Sensor
The ability of Sensors is to measure multi various data on the activities taking place within a
system that throws open plenty of use cases.
40
1. Operating the system efficiently.
2. Monitoring the operations for any abnormalities.
3. Controlling the operations.
4. Utilizing the resources effectively.
5. Making design changes to improve performance further.
6. Enhancing Future product portfolio.
the following is a list of different types of sensors that are commonly used in various
application. All these sensors are used for measuring one of the physical properties like
temperature, resistance, capacitance, conduction, Heat transfer etc.
1-temperture sensor
2-proximity sensor
3-Infaraed sensor
4-light sensor
5-Accelerometer sensor
6-pressure sensor
7-Ultrasonic sensor
8-touch sensor
41
10-tilt sensor
proximity sensor:
The proximity sensor or photoelectric sensor is another type of position sensing
device. Photoelectric sensors use a modulated light beam that is either broken or
reflected by the target. The control consists of an emitter (light source), a receiver to
detect the emitted light, and associated electronics that evaluate and amplify the
detected signal causing the photo electric’s output switch to change state.
42
Fig(31) proximity sensor
Capacitive proximity sensors are like inductive proximity sensors. The main difference
between the two types is that capacitive proximity sensors produce an electrostatic field
instead of an electromagnetic field. Capacitive proximity switches will sense metal as well as
nonmetallic materials such as paper, glass, liquids, and cloth.
43
Fig(32) proximity sensor
The sensing surface of a capacitive sensor is formed by two concentrically shaped metal
electrodes of an unwound capacitor. When an object nears the sensing surface it enters the
electrostatic field of the electrodes and changes the capacitance in an oscillator circuit. As a
result, the oscillator begins oscillating. The trigger circuit reads the oscillator’s amplitude and
when it reaches a specific level the output state of the sensor changes. As the target moves
away from the sensor the oscillator’s amplitude decreases, switching the sensor output back to
its original state
44
it detects this as a logic HIGH signal. PNP proximity sensors are also known as ‘sourcing’
sensors.
45
For a PNP type sensor, the PLC needs to be configured as a ‘sinking’ type. Connecting the
input 1M to 0V will configure the PLC as input sinking. With this configuration, the sensor
can ‘source current’ and the PLC will ‘sink current’ to detect sensor output.
For a PNP type proximity sensor, if an input card is used, it must be a ‘ sinking’ type card. The
S7-1200, Digital Input SM 1221 input card for S7-1200 PLCs is a sink/source configurable
input card and it can interface with either type of sensor.
Ch3: Software
46
3.1 PLC Programming Languages
Ladder diagram (LD)
Instruction List (IL)
Function Block Diagram (FBD)
Sequential Function Chart (SFC)
Structured Test (ST)
Continues Function Chart (CFC)
The Ladder Diagram is also a graphics oriented programming language which approaches
the structure of an electric circuit. Ladder Diagram consists of a series of networks. Each
network consists on the left side of a series of contacts which pass on from left to right the
condition "ON" or "OFF" which correspond to the Boolean values TRUE and FALSE. To
each contact belongs a Boolean variable. If this variable is TRUE, then condition pass from
left to right. Fig [31] shows the simple ladder logic diagram with normally open, normally
closed and coil.
47
3.1.1 Programming by ladder diagram
48
OR logic:Y1=X0+X
Fig(37) OR logic
49
NOR logic: Y1=X0+X1 not
50
3.3 PLC Counter
Table(2) Counter instructions
UP COUNTER
An up counter (CTU) output instruction adds a count, in increments of one,
every time its referenced event occurs. In a control application, this counter
Also, this counter can keep track of the number of parts (e.g., filled bottles, machined
parts, etc.) that pass a certain point. An upcounter increases its accumulated value (the
count value in its accumulated register) each time the up-count event makes an OFF-to-
ON transition. When the accumulated value reaches the preset value, the counter turns ON
the output, finishes the count, and closes the contact associated with the referenced output.
After the counter reaches the preset value, it either resets its accumu-lated register to zero
or continues its count for each OFF-to-ON transition, depending on the controller. In the
latter case, a reset instruction is used to clear the accumulated value.
DOWN COUNTER
A down counter (CTD) output instruction decreases the count value in its accumulated
register by one every time a certain event occurs. In practical use, a down counter is used
in conjunction with an up counter to form an up/down counter, given that both counters
have the same reference registers. In an up/down counter, the down counter provides a
way to correct data that is input by the up counter. Depending on the programmable
controller, the down counter will either stop counting down at zero or at a specified
maximum negative value. In a block format instruction, a down count occurs every time
the down input of the counter transitions from OFF to ON.
COUNTER RESET
A counter reset (CTR) output instruction resets up counter and down counter accumulated
values to zero. When programmed, a counter reset coil has the same reference address as
the corresponding up/down counter coils. If the counter reset rung condition is TRUE, the
reset instruction will clear the referenced address. The reset line in a block format counter
instruction sets the accumulated count to zero (accumulated register = 0). Figure 9-49
illustrates a typical block-formatted counter rung with up, down, and reset counter
instructions. The counter will count up when contact 10 closes, count down when contact
11 closes, and reset register 1003 to 0 when contact 12 closes. If the count is equal to 15
as a result of either an up or down count, output 100 will be ON. If the contents of register
1003 are greater than 15, output 101 will be ON. Output 102 will be ON if the
accumulated count value is less than 15
Fig(43) Counter function block with up, down, and reset counter instructions
3.4 PLC TIMER
PLC timers are internal PLC instructions that can be used to delay input and output signals
in the PLC program.
These timers operate like relay timers but you cannot hold a PLC timer in your hand and
they do not need to be connected to wires to operate.
PLC timer is an element in ladder logic programming taken from electrical systems.
Timers are devices that count time increments.
The timer creates a delay in both PLC programming and in relay boards on connection or
instantaneous disconnection.
Simply, when the input is activated the timer starts its operation keeping track of the time.
When this time exceeds the programmed time then the timer activates its output.
You could set the PLC timer from millisecond (ms) to an hour (hr) time span in the
programming of
Next, I will discuss what happens to the PLC on-delay timer when the selector switch gets
turned on and off.
– When you turn on the selector switch, the timer enabled bit and timer timing bit turn on
and the timer’s accumulated value starts accumulating time.
– If you leave the selector switch on, the timer’s accumulated value will reach ten
thousand. When it does, the timer will stop accumulating time, the timer timing bit will
turn off, and the timer done bit will turn on.
– At this point, when you turn off the selector switch the timer accumulated value will
reset back to zero, and the timer enabled and timer done will turnoff.
– If you turn off the selector switch before the timer is done timing, the timer accumulated
value will reset back to zero and all of the timer bits will be off.
On-delay timer applications
On-delay timers are used a lot in PLC programs and in many different ways. For example,
an on-delay timer can be used on a conveyor’s start button.
The timer could be set up so that the start button would need to be pushed and held for
five seconds before the conveyor would start.
Another on-delay timer could also be set up to sound a conveyor start-up warning horn
and light.
Off-delay timer
Next, I will discuss what happens to the PLC off-delay timer when the selector switch gets
turned on and off.
– When you turn on the selector switch, the timer’s accumulated value resets to zero, and
the timer enabled bit and the timer “done bit” turn on.
– When you turn off the selector switch, the timer accumulated value will start
accumulating time, the timer enabled bit will turn off, the timer timing bit will turn on and
the timer done bit will stay on.
– If you leave the selector switch off, the timer’s accumulated value will reach ten
thousand. When it does, the timer will stop accumulating time, the timer timing bit and the
timer done bit will turn off.
– If you turn on the selector switch before the timer is done timing, the timer accumulated
value will reset back to zero, the timer enabled bit will turn on, the timer timing bit will
turn off and the timer done bit will stay on.
Off-delay timers are used when you need something to stay running longer than
everything else. For example, cooling fans and pumps might continue to run after a
machine pauses from doing work.
Fig(48) Off-delay timer applications
Retentive on-delay timer
Retentive on-delay timers are a lot like on-delay timers. They get set up the same way and
the bits react in the same way.
The only major difference with retentive on-delay timers is how the timer accumulated
value acts when you turn the selector switch on and off and that it needs a reset bit.
– For an retentive on-delay, when the selector switch is turned on, the retentive on-delay
timer accumulated value starts accumulating time, the timer enabled bit turns on, and the
timer timing bit turns on.
– If the selector switch is left on, the accumulated value will reach ten thousand, the timer
will stop accumulating time, the timer enabled bit will stay on, the timer timing bit will
turn off, and the timer done bit will turn on.
– At this point, if the selector switch is turned off, the accumulated value will stay ten
thousand, the timer enabled bit will turn off, the timer timing bit will stay off, and the
timer done bit will stay on.
– If the selector switch is turned back on, only the timer “enabled bit” will turn on,
everything else will stay the same.
To reset the accumulated value of a retentive on-delay timer, a timer reset bit will need to
be added to the PLC program. I will use a momentary push button to trigger this reset bit.
– When the selector switch is off and the timer reset button is pushed, the timer
accumulated value will reset to zero and the timer done bit will turn off.
Retentive on-delay timers can be used to track the runtime of equipment. They can be set
up to trigger an indicator light to let someone know the equipment has run long enough
and requires maintenance to inspect and clean it.
3.5 PLC Software of Project
3.5.1 S 7200 wiring diagram
We have 8 points for input and 6 points for output In project we have 8 inputs and 4
outputs
Input Output
Push button for I0.0 Relay for open enter gate Q0.0
enter
Sensor 1 I0.1 Relay for close enter gate Q0.1
Sensor 2 I0.2 Relay for open exit gate Q0.3
Sensor 3 I0.3 Relay for close enter gate Q0.2
Sensor 4 I0.4
Sensor 5 I0.5
Sensor 6 I0.6
Push button for exit I0.7
Network 2
The exit push button (I0.7) is connected with a up counter ( c1) With a reset exit gate
opening (Q0.3) and It has 1 time to be 1
Network 4
Through the following network when C0 is 1 and motor for closing gate is 0 and M0.1 is 0
M0.0 will be 1
Network 7
Through the following network when C1 is 1 and motor for closing gate (Q0.2)is 0 and
M0.2 will be 1
Fig(63) screen1
Write address
Fig(65) write address screen2
Reade address
Screen “3”
Fig (67) parking in screan3
Conclusion
Reference
1- Tubbs, Stephen P. Programmable Logic Controller (PLC) Tutorial, Siemens Simatic
S7-200: Circuits and Programs for Siemens Simatic S7-200 Programmable
Controllers: For Electrical Engineers and Technicians. First ed., Stephen P. Tubbs,
2007.
3- ANTONSEN, TOM MEJER. PLC Controls with Ladder Diagram (LD): IEC 61131-3 and
Introduction to Ladder Programming. First ed., BOOKS ON DEMAND, 2021.
5- “Simatic S7-200 Smart: Simatic Controllers: Siemens India.” Siemens India Website,
https://new.siemens.com/in/en/products/automation/systems/industrial/plc/
simatic-s7-200-smart.html.
Our Greetings
Project Team