0% found this document useful (0 votes)
52 views380 pages

Compilation

Uploaded by

afifsyauqi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views380 pages

Compilation

Uploaded by

afifsyauqi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 380

Sensors Technology

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
What is Sensor?
• Sensor is a device that measured or response to the change of
the measured physical environment.
• Sensor will act as the input for the automation system.
• Sensor most frequently will be used to control the output or
simply used to display the value on the screen.
Sensor type
• Position • Chemical
• Velocity
• Light
• Acceleration
• Force/Pressure • Sound
• Torque • Temperature
• Touch/Tactile • Level Sensor
• Proximity
• Flow Meter
• Photo/Optical
Position sensor
• Used to detect the position of something which means that they
are referenced either to or from some fixed point or position.
• There are 2 types:
• Angular position sensor
• Linear position sensor
Angular position sensor
• Optical Incremental Rotary Encoders uses a transparent disk which contains opaque
sections that are equally spaced to determine movement.
• A light emitting diode is used to pass through the glass disk and is detected by a photo
detector. This causes the encoder to generate a train of equally spaced pulses as it rotates.
• The output of incremental rotary encoders is measured in pulses per revolution which is
used to keep track of position or determine speed.
Optical absolute encoder
• Optical Absolute Encoders utilize stationary mask in between the photodetector and the
encoder disk as shown below.
• The output signal generated from an absolute encoder is in digital bits which correspond to
a unique position. The bit configuration is produced by the light which is received by the
photodetector when the disk rotates.
• The light configuration received is translated into gray code. As a result, each position has
its own unique bit configuration.
Magnetic rotary encoder
• A Magnetic Rotary Encoder consists of two parts: a rotor and a sensor.
• The rotor turns with the shaft and contains alternating evenly spaced north and south poles
around its circumference.
• Hall Effect sensors work by detecting a change in voltage by magnetic deflection of
electrons.
• Available for both incremental and absolute encoder type.
Linear position sensor
• Optical linear encoder act the same as optical rotary encoder.
• Available in both incremental and absolute encoder type.
Magnetic linear encoder
• Magnetic linear encoder act the same as magnetic rotary
encoder.
• Available in both incremental and absolute encoder type.
Velocity sensor
• Velocity sensor measures the linear or angular position measurements at known intervals.
• Velocity=distance/time
• To know the linear or angular position, we need position sensor such as encoder to
measure the velocity.
• There are devices that is developed specifically for measuring velocity such as tachometer.
Acceleration sensor
• It measure acceleration, which is the change in speed (velocity)
per unit time.
• A fixed electrode comprising Si, a working electrode, and a spring
is the sensor part.
• The distance between the fixed and movable electrodes is the
same in a state of no acceleration.
• The movable electrode is displaced when acceleration is applied.
• This triggers a change in the fixed electrode's spatial relationship,
changing the capacitance between the electrodes.
Acceleration sensor
Force/pressure sensor
Force/pressure sensor
Force/pressure sensor application
Torque sensor
• Convert torsional mechanical input to electrical signal.
• Torque applied on a shaft induces a strain on the surface of the
shaft, which is measured using strain gauges.
Touch/tactile sensor
• Used to detect physical touch or interaction.
• Have several types:
• Limit switch
• Tactile switch
• Capacitive touch sensor
• Tactile sensor
Tactile/limit switch
Limit Switch
Tactile Switch

• Use to detect limitation of a moving object/components.


• Digital input with either HIGH or LOW signal.
Tactile/limit switch

• Placing finger on the touch sensitive area changes the


capacitance value of the sensor.
• Only detects the presence of touch, not the force of the
touch.
• Example: Smartphone touch screen
Fingerprint Sensor: detects
fingerprint, uses different principle
Proximity sensor
• A proximity sensor is a non-contact sensor that detects the presence
of an object (often referred to as the “target”) when the target
enters the sensor’s field.
• There are various types of proximity sensor:
• Inductive proximity sensor
• Capacitive proximity sensor
• Ultrasonic proximity sensor
• IR proximity sensor
INDUCTIVE PROXIMITY SENSOR

• Can detect the presence of metallic object only.


• Cannot detect plastic, glass, wood etc.
Capacitive proximity sensor

• Detect proximity of any object by measuring the changes in the capacitance


of the sensor due to the presence of the object in close proximity to the
sensor.
• Possible targets for capacitive sensors include but are but not limited to:
glass, plastic, water, wood, metals, and a myriad of targets of other
materials.
ULTRASONIC PROXIMITY SENSOR

• It sends an ultrasonic pulse out at 40kHz which travels through


the air and if there is an obstacle or object, it will bounce back to
the sensor.
• By calculating the travel time and the speed of sound, the
distance can be calculated.
INFRARED PROXIMITY SENSOR

• Working principle almost the same to the ultrasonic sensor. The


difference is it uses infrared signal.
• Detect proximity of any object by measuring the intensity of the
reflected Infrared light.
PHOTO/OPTICAL PROXIMITY SENSOR
• Photo/optical means that the sensor uses light as a medium for
transferring signal.
• There are 3 types:
• Through Beam Sensor
• Retro-reflective sensor
• Diffuse sensor
THROUGH BEAM SENSOR

• Emitter/Transmitter will transmit the signal and will be received by


the receiver.
• Receiver will not received the signal if interrupted by an object.
• During normal state (uninterrupted), the value is 0 or FALSE.
RETRO-REFLECTIVE SENSOR
• They consist of an emitter and receiver in a single housing. The
light produced by the emitter is reflected back to the receiver
with a reflector.
• Whenever this light beam is obstructed, the output signal of the
sensor changes state.
• During normal state (uninterrupted), the value is 1 or TRUE.
DIFFUSE SENSOR
• Diffuse reflection sensors are used for direct detection of objects
and combine transmitter and receiver in one housing.
• The transmitter emits a continuous light beam (usually red light,
but also infrared light and laser light).
• The light source is reflected by the object to be detected.
Chemical sensor

Example: Hydrogen gas sensor

• Used to detect a presence of certain chemicals in the form of


liquid or gas.
LIGHT SENSOR
• Photoelectric device that converts light energy (photons)
detected to electrical energy.
• The most common light sensor is light dependent resistor (LDR).
SOUND SENSOR
• A sound sensor is defined as a module that detects sound waves
through its intensity and converting it to electrical signals.
• Works similarly to our ears, having diaphragm which converts
vibration into signals.
• Such sound waves cause the diaphragm in the microphone to
vibrate, resulting in capacitance change.
TEMPERATURE SENSOR
• Used to measured surrounding temperature.
• Consists of several types:
• Resistance Temperature Detector
• Thermocouple
• Thermistor
RESISTANCE TEMPERATURE DETECTOR
• RTDs are precise temperature sensors that are made up of high-
purity conducting metals such as platinum, copper or nickel
wound into a coil.
• The metal can be made of different materials including platinum,
nickel, or copper. However, platinum is the most accurate and
therefore carries a higher cost.
THERMOCOUPLE
• A thermocouple usually consists of two junctions of dissimilar metals,
such as copper and constantan that are welded or crimped together.
• One of these junctions, known as the Cold junction, is kept at a
specific temperature while the other one is the measuring junction,
known as the Hot junction.
• The voltage between the two wires reflects the change in
temperature.

Thermocouple
THERMISTOR
• Thermistor reacts precisely to even the minute temperature
changes. It provides a huge resistance at very low temperatures.
• This means, as soon as the temperature starts increasing, the
resistance starts dropping quickly.
• With this large change, it means the temperatures are reflected
very fast but also very accurately.
Level sensor
• Level Sensors can be broken into two classifications;
• Point level measurement
• Continuous level measurement
• Point level sensors are designed to indicate whether a liquid has
reached a specific point in a container.
• Continuous level sensors, on the other hand, are used to render
precise liquid level measurements.
Level sensor type
Capacitance level sensor
• A capacitance level sensor is a proximity sensor that gives off an
electrical field and detects a level by the effect on its electrical
field. These sensors are:
• Small
• Less expensive than other sensors
• Invasive to the product
• Accurate
• Have no moving parts

• However, they do have to be calibrated and will only detect


certain liquids.
• Capacitance sensors can be used in liquid storage tanks. A water
treatment facility that has storage tanks would be an ideal use for
a capacitance sensor.
Optical level sensor
• Optical sensors work by converting light rays into electrical signals
which measure a physical quantity of light then translate it into a
measurement.
• These sensors have no moving parts
• They are not affected by high pressure or temperature
• They are small in size
• They can be used in liquid applications
• However, if the lens gets coated or dirty they would require
cleaning.
• They can be used as low-level indicators to prevent run dry
conditions when using oil, coolant, or hydraulics.
Optical level sensor
Conductivity (Resistance) Level Sensor
• A conductivity or resistance sensor uses a probe to read conductivity. The probe has a pair
of electrodes and applies alternating current to them.
• When a liquid covers the probe its electrodes form a part on an electric circuit, causing
current to flow which signals a high or low level.
• The advantages of using a conductivity level sensor are:
• There are no moving parts
• They are low cost
• Fairly easy to use

• The disadvantages are:


• They are invasive (meaning they must touch the product being sensed)
• They only sense conductive liquids
• The probe will erode over time
• Appropriate use for these sensors would be for signaling high or low levels.
Vibrating (Tuning Fork) Level Sensor
• They use a fork-shaped sensing element with two tines. The fork vibrates at its natural
resonant frequency. As the level changes, the frequency of the fork will change detecting
the level.
• These sensors are:
• Cost effective and compact
• Invasive to the product
• Easy to install
• Essentially maintenance-free

• They have unlimited uses based on the material that they can sense. Mining, food and
beverage, and chemical processing industries use these sensors for their applications.
Float Switch
• Float switches use a float, a device that will raise or lower when a product is applied or
removed, which will open or close a circuit as the level raises or lowers moving the float.
• The advantages of a float switch are:
• They are non powered device
• They provide a direct indication
• They are inexpensive
• The disadvantages are:
• They are invasive to the product
• They have moving parts
• They can be large in size
• Float switches will only give an indication for a high or low level, they cannot measure a
variable level. A great use for float switches is in liquid storage tanks for high or low-level
indication.
Ultrasonic Level Sensor
• Ultrasonic level sensors work by emitting and receiving ultrasonic waves. The time it takes for the waves to
reflect back is how distance is measured.
• The advantage of using this type of sensor is that:
• These sensors have no moving parts
• They are compact
• They are reliable
• Non-invasive (Non-contact)
• Unaffected by the properties of the material they are sensing
• Self-cleaning because of the vibrations they give off
• The disadvantage of using this type of sensor is that:
• They can be expensive
• In some situations, the environment can have a negative effect on them
• An example application is a hot asphalt tank in a shingle manufacturing plant.
• The ultrasonic sensor would be placed in the top of the tank away from the hot asphalt and used to sense
the level in order to send a fill request for the tank.
Radar Level Sensor
• These sensors transmit microwaves by an antenna on the radar sensor. The product that is
being sensed reflects these microwaves back to the antenna and the time from emission to
reception of the signal is proportional to the level of the product.
• The advantages of radar sensors are that:
• They are not affected by temperature, pressure or dust
• They can also measure liquids, pastes, powders, and solids
• They are very accurate and require no calibration
• They are non-invasive
• The disadvantages of radar sensors are that:
• They are expensive
• They have a limited detection range
Flow meter
• A flow meter is a device used to measure the volume or mass of a gas or liquid.
• Flow meters are referred to by many names, such as flow gauge, flow indicator,
liquid meter, flow rate sensor, etc. depending on the particular industry.
• Flow meter sensors work in different ways, but with the same end goal:
Provide the most accurate and repeatable flow measurements for a specific
application.
Consideration for flow meter
• There are no “universal” flow meters which are suitable for all applications.
Selecting the proper technology for your application requires writing a flow
specification which covers the use of the meter. There are usually trade-offs
with each meter type, so knowing the critical specifications will be
important.
• Things you must know:
• What is the Gas or Liquid being measured?
• Minimum and maximum flow rates.
• What are the accuracy requirements?
• The fluid temperature and viscosity.
• Fluid compatibility with the materials of construction
• The maximum pressure at the location.
• What pressure drop is allowable?
• Is the meter mounted in a hazardous location where explosive gases may be present?
• Is the fluid flow continuous or intermittent?
• What type of output signal or readout do you need?
Motors & Actuators

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
MOTORS
• A motor is a machine that converts electrical energy to mechanical energy.
• The electrical energy could come from AC power or DC power.
• There are various type of electrical motor being used in the industry.
DC Motor
• DC motors are motion components that take electrical power in
the form of direct current and convert it into mechanical rotation.
• DC Motor comprises of two types which are brushed and
brushless.
• The build and working principle between the two is different.
Brushed DC Motor (Permanent Magnet)
• A brushed DC motor has permanent magnets on the outside of its structure, with a
spinning armature on the inside.
• The permanent magnets, which are stationary on the outside, are called the stator.
• The armature, which rotates and contains an electromagnet, is called the rotor.
• The rotor spins 180-degrees when an electric current is run to the armature.
• To go any further, the poles of the electromagnet must flip.
• The brushes, as the rotor spins, make contact with the stator, flipping the magnetic
field and allowing the rotor to spin a full 360-degrees.
Brushed DC Motor (Series Wound)
• Speed varies automatically with the load, increasing as the load
decreases.
• This series wound motor is usually limited when heavy power
demand is necessary.
Brushed DC Motor (Shunt Wound)
• A brushed shunt wound Brush DC Motor will run at constant
speed regardless of the load.
Brushed DC Motor (Compound Wound)
• A combination of the brushed shunt and brushed series wound
motors, combining the characteristics of both.
• These brushed compound motors are usually used when severe
starting conditions are met and constant speed.
Brushless DC Motor
• Brushless DC motor has only two basic parts: rotor and the stator.
• The rotor is the rotating part and has rotor magnets whereas
stator is the stationary part and contains stator windings.
• In BLDC permanent magnets are attached in the rotor and move
the electromagnets to the stator.
AC Motor
• The motor that converts the alternating current into mechanical
power by using an electromagnetic induction phenomenon is called an
AC motor.
• This motor is driven by an alternating current.
• The AC motor may be single phase or three phase.
• The three phase AC motors are mostly applied in the industry for bulk
power conversion from electrical to mechanical.
• For small power conversion, the single phase AC motors are mostly
used.
• The single phase AC motor is nearly small in size, and it provides a
variety of services in the home, office, business concerns, factories,
etc. Almost all the domestic appliances such as refrigerators, fans,
washing machine, hair dryers, mixers, etc., use single phase AC motor.
Synchronous AC Motor
• The motor that converts the AC electrical power into mechanical power and is operated
only at the synchronous speed is known as a synchronous motor.
• We can change the synchronous speed of the motor by changing the supply frequency and
the number of poles. But the motor would always run with this speed for a given supply
frequency and the number of poles.
• In synchronous motors, the stator has 3 phase windings and is excited by 3 phase supply
whereas the rotor is excited by DC supply.
Starting Method AC Synchronous Motor
• The moment of inertia of rotor stops the large-sized synchronous
motors from self-starting. Because of this inertia of the rotor, it is not
possible for a rotor to get in sync with the stator’s magnetic-field at
the very instance power is applied.
• So some additional mechanism is required to help the rotor get
synchronized.
• Induction winding is included in the large motors which generate
sufficient torque required for acceleration.
• For very large motors, to accelerate the unloaded machine, pony
motor is used. Changing stator current frequency, electronically
operated motors can accelerate even from the zero speed.
• For very small motors, when the moment of Inertia of the rotor and
the mechanical load are desirably small, they can start without any
starting methods.
Induction AC Motor
• The machine which converts the AC electric power into
mechanical power by using an electromagnetic induction
phenomenon in called an induction motor.
• The induction motor is mainly classified into two types., i.e., the
single phase induction motor and the three phase induction
motors.
• In an induction machine the armature winding serve as both the
armature winding and field winding. When the stator windings
are connected to an AC supply flux is produced in the air gap. The
flux rotates at a fixed speed called synchronous speed. This
rotating flux induces voltages in the stator and rotor winding.
Three Phase Induction AC Motor
• The stator of three phase induction motor is made up of numbers of slots to
construct a 3 phase winding circuit which we connect with 3 phase AC source.
• When the motor is excited with a three-phase supply, three-phase stator
winding produces a rotating magnetic field with 120 displacements at a
constant magnitude which rotates at synchronous speed.
• This changing magnetic field cuts the rotor conductors and induces a current in
them according to the principle of Faraday’s laws of electromagnetic induction.
As these rotor conductors are shorted, the current starts to flow through these
conductors.
Single Phase Induction AC Motor
• Single phase induction motors generally have a construction
similar to that of a three phase motor: an ac windings is placed
on the stator, short-circuited conductors are placed in a
cylindrical rotor.
• The significant difference is, that there is only a single phase
supply to the stator.
• Not self-starting as 3-phase, so need external excitation method
such as capacitor.
Servo Motor
• A servo motor is a self-contained electrical device, that rotate
parts of a machine with high efficiency and with great precision.
• The output shaft of this motor can be moved to a particular
angle, position and velocity that a regular motor does not have.
• The Servo Motor utilizes a regular motor and couples it with a
sensor for positional feedback.
• The controller is the most important part of the Servo Motor
designed and used specifically for this purpose.
Servo Motor
• The servo motor is a closed-loop mechanism that incorporates
positional feedback in order to control the rotational or linear
speed and position.
• The motor is controlled with an electric signal, either analog or
digital, which determines the amount of movement which
represents the final command position for the shaft.
• A type of encoder serves as a sensor providing speed and
position feedback. This circuitry is built right inside the motor
housing which usually is fitted with gear system.
Servo Motor

Industrial Servo Motor


Hobbyist Servo Motor
Advantages & Disadvantages Servo Motor
Stepper Motor
• A stepper motor is an electric motor whose main feature is that its shaft
rotates by performing steps, that is, by moving by a fixed amount of degrees.
• This feature is obtained thanks to the internal structure of the motor, and
allows to know the exact angular position of the shaft by simply counting
how may steps have been performed, with no need for a sensor.
Stepper Motor
• Stepper motors have typically 50 to 100 electromagnet poles (pairs of north and
south poles) generated either by a permanent magnet or an electric current.
• Each permanent magnet pole offers a natural stopping point for the motor
shaft.
• The greater number of poles allows for a stepper motor to position itself
accurately and precisely between each of the poles.
Stepper Motor
Industrial Stepper Motor
Hobbyist Stepper Motor
Advantages & Disadvantages Stepper Motor
Which Motor Should I Use?
Actuators
• An actuator is a device that makes something move or operate. It
receives a source of energy and uses it to move something.
• There are 2 types of actuators:
• Linear Actuator
• Rotary Actuator
• Common actuator source of energy:
• Electric
• Pneumatic
• Hydraulic
Actuators
1. Linear Actuators
• An actuator that can move something in a straight line, also referred to
as linear.

2. Rotary Actuators
• An actuator can make something move in a circular motion, also referred
to as rotary.
Pneumatic Actuators
• A pneumatic actuator is a device that converts energy typically in
the form of compressed air into mechanical motion.
• Pneumatic actuators are recognized by several different names
including pneumatic cylinders, air cylinders, and air actuators; all
of which are one and the same.
• Consisting of a piston, cylinder, and valves or ports, a pneumatic
actuator can convert energy into linear or rotary mechanical
motions.
• This is dependent on whether the application is using a
pneumatic rotary actuator or a linear actuator.
Pneumatic Actuators
Advantages Pneumatic Actuators
• Atmospheric air is abundant and readily available, which makes the
power source an infinite resource.
• A pneumatic system uses compressed air, automatically keeping the
instrument clean and free from contaminants that can damage or
prevent the system from working.
• A pneumatic system is easy to maintain and easy to use.
• Pneumatic systems are suitable for working environments exposed to
radiation and high temperature, which makes pneumatics immune to
most elements present in nature.
• A pneumatic system can also use other types of compressed gases.
This is beneficial for applications where natural gas is the power
source. Compressed natural gas may be used as an alternative power
source for pneumatic instruments
Disadvantages Pneumatic Actuators
• A pneumatic device is sensitive to extreme changes in
temperature as well as vibration.
• Compressed air is more expensive than electricity.
• It is essential to ensure that there are no leaks in a pneumatic
system because compressed air escaping leads to energy loss.
• Pneumatic systems are known for making a loud noise.
• Installation cost increases when the instrument requires specialty
pipes.
• Pneumatic systems are not upgradable to become compatible
with smart electronics.
Hydraulic Actuators
• A hydraulic actuator consists of a cylinder or fluid motor that uses
hydraulic power to facilitate mechanical operation.
• Because liquids are nearly impossible to compress, a hydraulic
actuator can exert considerable force.
• A typical piston-type hydraulic actuator is shown in Below Figure.
It consists of a cylinder, piston, spring, hydraulic supply and
return line, and stem.
Hydraulic Actuators
Advantages Hydraulic Actuators
• Hydraulic actuators are rugged and suited for high force applications. They
can produce forces 25 times greater than pneumatic cylinders of equal size.
They also operate in pressures of up to 4,000 psi.
• A hydraulic actuator can hold force and torque constant without the pump
supplying more fluid or pressure due to the incompressibility of fluids.
• Easy to spot leakages of a hydraulic system.
• A large amount of power can be transmitted through the hydraulic system
using small flexible hoses and tubes.
• Hydraulic systems have the ability to maintain its viscosity of airworthiness,
its density and the temperature of the fluid in a very hot environment.
• The amount of force on the driving system can be adjusted with force
multiplication.
• Minimize undesirable noises.
Disadvantages Hydraulic Actuators
• Leakage of these fluids will create environmental problems and
safety issues.
• Contaminants present in the hydraulic fluid will damage the
system performance and productivity. Hence, it requires
continuous filtration.
• Wrong selection of hydraulic fluid for a system will damage the
components.
• Proper maintenance is required.
Spool Valve
• Spool valves can be used in both hydraulics (where the oil is the
energy source) or Pneumatics (where the air is the energy source)
and their job is to control the flow direction of the energy source
by combining or switching the paths through which the oil or air
can travel.
Spool Valve Actuators
• The spool can be moved in many different ways;
• Manually using a button or a lever
• As part of a larger control system using a solenoid actuator
How Spool Valve Works

1. When solenoid is activated,


the spool will close exhaust
port (P3) and open inlet port
(P1).

Solenoid

Pneumatic shaft
1. Compress air connected to port 1
2. Port 2 is connected to the pneumatic cylinder extend connection
3. Port 3 is unconnected as it is the exhaust port.
4. In the normal state without the actuator being operated nothing 1. This allows the compressed
will happen as the spool is physically blocking the airflow at port 1 Pneumatic cylinder
air to enter the pneumatic
and the cylinder is retraced because ports 2 and 3 are connected cylinder.
due to the spool position. 2. When the air entered it, the
5. So any air already within the system would escape to the pneumatic shaft is moved
atmosphere through the exhaust port. forward.
Types Of Spool Valve
• Spool valves come in a wide variety of different types and configurations, some
having more ports and able to control multiple items of equipment at once.
• Imagine how a 4/2 (four by two) or even a 5/3 (five by three) spool valve might
be used.
Spool Valve Schematic Drawing
• In engineering drawings, pneumatic circuit symbols provide
detailed information about the valve they represent.
• Symbols show:
• The methods of actuation
• The number of positions
• The flow paths
• The number of ports a valve has
Spool Valve Schematic Drawing
• When we see a spool valve schematic, we can see it is made up of
boxes, each containing a number of lines and arrows.
• The number of boxes that make up a valve symbol indicates the
number of possible positions the valve has.

3 position
5 ports
Pneumatic Circuit Symbols

Spring
Solenoid

Pushbutton
Lever
PLC BASIC INTRODUCTION
Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
WHAT IS A PLC?
• PLC stands for Programmable Logic Controller.
• It is an industrial computer control system that continuously monitors the state of
input devices and makes decisions based upon a custom program to control the
state of output devices.
• The PLC receives information from connected sensors or input devices, processes
the data, and triggers outputs based on pre-programmed parameters.
• There are 2 types of PLC:
• Compact PLC
• Modular PLC
History of PLC
• The PLC was invented in response to the needs of the American
automotive industry.
• Before the PLC, control, sequencing, and safety interlock logic for
manufacturing automobiles was accomplished using relays, timers
and dedicated closed-loop controllers.
• The process for updating such facilities for the yearly model change-
over was very time consuming and expensive, as the relay systems
needed to be rewired by skilled electricians.
• In 1968 GM Hydramatic (the automatic transmission division of
General Motors) issued a request for proposal for an electronic
replacement for hard-wired relay systems.
History of PLC

PLC
control
panel

Relay
control
panel
History of PLC
• The winning proposal came from Bedford Associates of Boston, Massachusetts.
• The first PLC, designated the 084 because it was Bedford Associates eighty-fourth
project, was the result.
• Bedford Associates started a new company dedicated to developing, manufacturing,
selling, and servicing this new product: Modicon, which stood for MOdular DIgital
CONtroller.
• One of the people who worked on that project was Dick Morley, who is considered to be
the "father" of the PLC.
• The Modicon brand was sold in 1977 to Gould Electronics, and later acquired by German
Company AEG and then by Schneider Electric, the current owner.
Disadvantages of Relay Control Panel
• Large amount of work required connecting wires
• Difficulty with changes or replacements
• Difficulty in finding errors; requiring skillful/experienced work force
• When a problem occurs, hold-up time is indefinite, usually long
Advantages of PLC
• Increased reliability: Since all the logic is contained in the PLC’s memory, there is
no chance of making a logic wiring error.
• More flexibility: It is easier to create and change a program in a PLC than to wire
and rewire a circuit.
• Lower Cost: Generally, if an application has more than about a half-dozen control
relays, it will probably be less expensive to install a PLC.
• Communications Capability - A PLC can communicate with other controllers or
computer equipment to perform such functions as supervisory control, data
gathering, monitoring devices and process parameters, and download and upload
of programs.
• Faster Response Time: Machines that process thousands of items per second and
objects that spend only a fraction of a second in front of a sensor require the
PLC’s quick-response capability.
• Easier to Troubleshoot: To find and fix problems, users can display the control
program on a monitor and watch it in real time as it executes.
Compact PLC
• Within a single case, there would be many modules.
• It has a fixed number of I/O modules and external I/O cards.
• So, it does not have the capability to expand the modules.
• Every input and output would be decided by the manufacturer.
• Some manufacturer allows to extend IO but up to certain number only.
Modular PLC
• This type of PLC permits multiple expansion through “modules”,
hence referred to as Modular PLC.
• I/O components can be increased.
• It is easier to use because each component is independent of each
other.
PLC Programming Languages
• 5 most popular types of PLC Programming Languages are:
1. Ladder Diagram (LD)
2. Sequential Function Chart (SFC)
3. Function Block Diagram (FBD)
4. Structured Text (ST)
5. Instruction List (IL)
PLC Block Diagram
Input & Output Type
Input & Output Type
Input & Output Type
Selection of PLC
Electromechanical Relay
• A Relay is an electromechanical device that can be used to make or
break an electrical connection.
• It consists of a flexible moving mechanical part which can be
controlled electronically through an electromagnet.
• Basically, a relay is just like a mechanical switch but you can control it
with an electronic signal instead of manually turning it on or off.
Electromechanical Relay
• Many machines and equipment use a higher voltage to run.
• To make it safer for the operators, we use a low voltage and current
for our controls.
• You wouldn’t want someone pushing a button with high voltage
attached to it.

480VAC
Electromechanical Relay
• When the coil receives the current, it creates a magnetic field, which attracts the
movable contact, or the armature.
• When the coil loses power, it loses its magnetic field, and a spring retracts the
contact.
• Mechanical relays can handle large amounts of current but are not as fast at
switching as other types of relays.
• They can be used with AC or DC currents, depending on the application and
design.
Solid State Relay
• Solid-state relays are solid-state electronic components that do not have
any moving components, which increases their long-term reliability.
• The control energy required is much lower than the output power,
resulting in a power gain that’s higher than that of most other relays.
• They’re generally the smallest relays and are also faster at switching
than other relays, and so they’re used for applications such as computer
transistors.
• Computers execute millions of instructions per second and need high-
speed transistor switches
Solid State Relay Output Circuit
• The most common application of solid state relays is in the switching
of an AC load.
Differences
• Unlike EMRs, SSRs have no moving parts that will wear out, and therefore
no contact bounce issues.
• Due to an opto-isolator rather than moving parts, the life span of the SSR is
often longer than the EMRs.
• The SSR is able to switch “ON” and “OFF” much faster than a mechanical
relay’s armature can move.
• When SSRs are in the on-state, substantial resistance is present, which can
lead to significant heat generation when current is flowing.
• Therefore, SSRs should be mounted on heatsinks. Solid-state relays
normally have only one output contact, while electromechanical relays can
multiple output contacts.
Relay application
• Solid-state relays can be used for:
• Applications requiring high speed and frequent switching operations
• Applications in high vibration environments
• Applications where the relay has to be located near sensitive automation
components, such as PLC’s, HMIs, and temperature controllers
• Electromechanical relays can be used for:
• Applications requiring a wide output range from the relay
• Applications using motors and transformers requiring high starting amps
• Applications where the initial installation budget is very limited
Thermal Overload Relay (TOR)
• Thermal overload relays are economic electromechanical protection
devices for the main circuit.
• They offer reliable protection for motors in the event of overload or
phase failure.
• The thermal overload relay can make up a compact starting solution
together with contactors.
Magnetic Contactor
• A contactor is a special type of relay designed to handle heavy power
loads that are beyond the capability of control relays.
• Contactors are designed to operate such loads as lights, heaters,
transformers, capacitors, and electric motors for which overload
protection is provided separately or not required.
Magnetic Motor Starter
• It is a combination of contactor and over load relay.
• In motor starter, contactor controls the flow of electric current to the connected
motor and repeatedly make and break (interrupt) the power circuit from main
power supply.
• The overload protection block in a starter protects the motor from drawing
excessive current and overheating and burning out the circuit.
PLC Control of Large Motor Load
Input/Output Addressing Example
Brand Input Output
Siemens I0.0 .. I0.7 , I1.0 .. I1.7 Q0.0 .. Q0.7 , Q1.0 .. Q1.7
Allen-Bradley I:0/0 .. I:0/7 , I:1/0 .. I:0/7 Q:0/0 .. Q:0/7 , Q:1/0 .. Q:1/7
Mitsubishi/Toshiba X4001, X4002 .. X4007 Y430, Y431 .. Y437
Omron 000.00, 000.01 .. 000.07 100.01, 100.02 .. 100.07
PLC & Electrical Wiring

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Hardwired Relay Diagram
Ladder Logic Diagram

Each input and output device is given an address which enable the
PLC to know where it should be connected.
Wiring Input
Wiring Output
Input & Output Wiring
• There are two types of input & output wiring which are PNP(Sourcing)
and NPN (Sinking)

Based on the diagram, we will say that


Device 1 Device 2
device 1 is sourcing the current while device
2 is sinking the current

In reverse, we will say that device 2 is


Device 1 Device 2 sourcing the current while device 1 is sinking
the current
Input & Output Wiring
Input & Output Wiring

Based on technical specifications, this


type of PLC can be wired as sinking or
sourcing.

If we wired our PLC as sinking, our input sensor need to sourcing.


If we wired or PLC as sourcing, our input sensor need to be sinking.

Some manufacturer labelled their sensor as NPN or PNP sensor.


If we wanted to use a PNP sensor, our PLC will have to be wired as sinking.
If it is NPN sensor, our PLC will have to be sourcing.
How to wire the PLC?
Input & Output Wiring
PNP Switch NPN Switch
(Sourcing) (Sinking)

Sinking PLC Sourcing PLC


Motor Starter Relay Circuit
Legends & Abbreviation

Every wiring diagram


typically have pages of
reference for component
symbols.
Electrical Wiring Diagram

Hardware Components All the components are


drawn on neutral condition
(non energized state)
Electrical Wiring Diagram

Wire tags

The power enters the terminal


blocks with the “X0” terminal strip.

3 phase power supply


Electrical Wiring Diagram

Wire tags on hardware


Addressing component in wiring diagram

All of them have a 2.0 number just beside the


arrow.
– By “2” it refers us to page two.
The page is divided to 10 separate columns. – By “0” it points out to the first column of page 2.
Each device is located in its column, so we will
used this as reference.
Addressing component in wiring diagram

As we can see, it continues right here.


Note that the incoming is label as 1.9
which is our previous page. For this contact, the wiring is coming
from page 130 on column 6.
Addressing component in wiring diagram

Below the coil, you see the 13-14


contact (NO Contact) of page two and
also the other NO and NC contacts of
this relay with the addresses they have
been used in this drawing.
Relay wiring example

1. Pin 13 & 14 is used to power up the relay.


2. Pin 9 & 12 is the common.
3. If we want to do NO connection, we will
connect pin 5 & 9.
4. For NC connection, we will use pin 1 & 9.
5. For this model, one relay can control 2
different output.
SIEMENS HARDWARE
Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Siemens PLC Series
S7-1200 HARDWARE
1 2 3
1. Electrical source to power the PLC
2. Input source type
3. Output source type
CPU Operation Mode
• Yellow light indicates STOP
mode.
• Green light indicates RUN
mode.
• A flashing light indicates
STARTUP mode.
• ERROR LED for indicating
errors.
• MAINT LED for indicating a
maintenance requirement.
SIMATIC S7-1200: Modules
SIMATIC S7-1200: Installation and Mounting Positions
SIMATIC S7-1200: Signal, Communication or Battery Board
SIMATIC S7-1200/1500: Memory Card(s)
TIA Portal - Central Engineering Framework

The Totally Integrated Automation Portal constitutes the


working environment for an integrated
engineering with SIMATIC STEP 7 V16 and SIMATIC WinCC V16.
• Central engineering framework
• Automatic data and project consistency
• Uniform operator control concept for all automation tasks
• Powerful libraries covering all automation objects
STEP 7 Range of Products
WinCC Range of Products
Startdrive Range of Products and Licensing
SIEMENS SOFTWARE
Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
TIA Portal: Portal View and Project View
Portal View
Project View
Menu Bar and Toolbar
Project Tree (First Level)
Project Tree (Second Level)
Task Cards
Inspector Window
Window Arrangement
Splitting and Arrangement of the Working Area
Keeping the Editor Window in the Foreground
(when Editor Space is Split)
Save / Manage / Use Window Layouts
Undo and Redo
Saving a Project
Archiving / Retrieving a Project
TIA Portal - Settings: User Interface Language
Help
Keyboard Shortcuts of the TIA Portal
Project Migration
Update Tool
Software and Hardware
Configuration
Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Online Connection via Industrial Ethernet:
IP Address and Subnet Mask
Assigning an IP Address for PC/Laptop

You can put any


number. But it
cannot be the
same with PLC
Assigning IP Address for PLC CPU

Open TIA Portal, Select → "Online &


Diagnostics", and open the →"project
view"
Assigning IP Address for PLC CPU

In the project tree under → "Online access", select the


network adapter that was set previously. If you click →
"Update accessible devices" here, you see the IP address (if
previously set) or the MAC address (if IP address not yet
assigned) of the connected SIMATIC S7-1200. Select → "Online
& Diagnostics" here.
Assigning IP Address for PLC CPU

Must be different
from PC

If the IP address was not successfully assigned, you


will receive a message in the → "Info" window
under → "General".

Under → "Functions", you now find the → "Assign IP address" item. Enter the following IP
address here (example): → IP address: 192.168.0.1 → Subnet mask 255.255.255.0. Click
→ "Assign IP address" and this new address will be assigned to your SIMATIC S7-1200
Restore the factory settings of the CPU

If the IP address could not be assigned, the


program data on the CPU must be deleted. This
is done by resetting the CPU. To reset the
controller, select the → "Reset to factory
settings" function and click → "Reset".
Create a new project
→ Select the Totally Integrated Automation Portal for this, which is opened here with a
double-click (® TIA Portal V16)

→ In the portal view under the "Start" menu, select the command → "Create new project".

Modify Project name, Path, Author and Comment


as appropriate and click → "Create".

The project will be created and opened and the "Start" menu, "First
steps" will open automatically
Specified Hardware Configuration
• Example: Insert the CPU 1214C DC/DC/DC

In the → "Start" portal, select → "First steps" → "Devices & 1. The "Show all devices" menu opens in the "Devices &
Networks" → "Configure a device" Networks" portal.
2. Switch to the "Add new device" menu
Specified Hardware Configuration

1. The specified model of the CPU will now be added as a new device.
2. (Controllers → SIMATIC S7-1200 → CPU → CPU 1214C DC/DC/DC→
6ES7214-1AG40-0XB0 → V4.2)
Specified Hardware Configuration

The TIA Portal now switches automatically to the


project view and displays the selected CPU in the
1. Click "Add". device configuration on slot 1 of a rail.
Unspecified Hardware Configuration

In the → "Start" portal, select → "First steps" → "Devices & 1. The "Show all devices" menu opens in the "Devices &
Networks" → "Configure a device" Networks" portal.
2. Switch to the "Add new device" menu
Unspecified Hardware Configuration

1. Create a new CPU. Use an unspecified model of the S7-1200 CPU with order number
6ES7 2XX-XXXXX-XXXX for this.
2. (Controllers → SIMATIC S7-1200 → CPU → Unspecified CPU 1200 → 6ES7 2XX-
XXXXX-XXXX → V4.2)
Unspecified Hardware Configuration

1. Click "Add". 1. The TIA Portal now switches automatically to the project view
and displays a notice there that this device is not specified.
2. In order to have the hardware configuration automatically
detected, start detection by clicking "detect" in the yellow
information box (→ detect).
Unspecified Hardware Configuration

1. Select the type of your PG/PC interface (→ Type of the PG/PC interface: PN/IE).
2. Select the network adapter you want to use to establish an Ethernet connection with the PLC (→ PG/PC
interface: Intel(R) Ethernet Connection (4) I219-LM).
3. Click “Start search” button.
Unspecified Hardware Configuration

1. Select the CPU.


2. Click “Detect”
3. The correct CPU type will be displayed.
Configure the Ethernet interface

1. Select the CPU with a double-click


2. Under → "Properties", open the →
"PROFINET interface [X1]" menu and select
the → "Ethernet addresses" entry.
Configure the Ethernet interface

1. Under "Interface networked with", only the


"Not networked" entry is available.
2. Add an Ethernet subnet with the → "Add
new subnet" button.
3. Keep the preassigned "IP address" and
"Subnet mask".
Configure the address areas

1. The next step is to check the address areas of the


inputs and outputs and adapt them if necessary.
2. DI/DO should have an address area of 0…1 and
AI/AO should have an address area of 64…67 and
64…65, respectively.
3. (→ Device overview → DI 14/DQ 10_1 → I
address: 0..1→ Q address: 0...1 → AI 2_1 → I
address: 64…67 → AQ 1x12BIT_1 → Q address:
64…65)
Save and compile the hardware configuration

If the project was compiled without errors, you see the following
screen.

1. Save the project by clicking “Save project”


2. Select the "CPU_1214C [CPU1214C DC/DC/DC]“
3. Click the "Compile" icon
Download the hardware configuration to the device

1. Select the interface as shown.


2. The ® "Show all compatible devices"
check box must be selected.
3. Click “Start search”.

1. Select the ® "CPU_1214C [CPU1214C DC/DC/DC]"


2. Click the ® "Download" icon.
Download the hardware configuration to the device

1. You first obtain a preview.


2. Confirm the prompt → "Overwrite all"
3. continue with → "Load".
1. Select the "CPU 1214C DC/DC/DC”
2. Click “Load” button. → "Overwrite all" and continue
with → "Load".
Download the hardware configuration to the device

1. Click “Start all”


1. After a successful download, the project view will open
2. Click “Finish” button.
again automatically.
2. A loading report appears in the information field under
"General". This can be helpful when troubleshooting an
unsuccessful download
Download the hardware configuration to the
PLCSIM simulation
• If we do not have any physical hardware around, we can simulate our
project using PLCSIM.
• Open the PLCSIM by clicking “Start simulation” icon.

1. Click “Ok”.
PLCSIM Simulation

The "S7 PLCSIM" software is


started in a separate window in 1. Select the interface as shown.
the compact view 2. The "Show devices with the same
address" check box must be selected.
3. Click “Start search”.
PLCSIM Simulation

1. Press “Load”

1. Select the “CPU-1200 Simulation”


2. Click “Load” button. → "Overwrite all" and continue
with → "Load".
PLCSIM Simulation

1. Click “Start all”


2. Click “Finish” button.
1. After a successful download, the project view will open
again automatically.
2. A loading report appears in the information field under
"General". This can be helpful when troubleshooting an
unsuccessful download
PLCSIM Simulation

1. Click the button to


change to project view.
PLCSIM Simulation

1. Click Project  New


2. Give the project name
3. Click “Create”
PLCSIM Simulation

1. You can see the downloaded


configuration with the status of all
inputs and outputs in the project
view by double-clicking → "Device
configuration".
2. Here you can also create your own
→ “Sim tables“ with selected input
and output signals.
3. You can modify the input signals
used in your program to test the
program in the PLCSIM simulation.
PLCSIM Simulation

1. Double click SIM table_1. 1. We can test the program by modify the
2. Empty sim table will be open. value in the box.
3. Click “Load Project Tags” button. 2. The box at the bottom can be use as
4. The project tag specified in the TIA momentary pushbutton.
portal will be displayed automatically.
PLCSIM Simulation

1. If there is a new tag created, manually


update sim table.
2. Click the empty box and click the icon
on the right.
3. Choose the new tag.
4. DO NOT PRESS LOAD TAG AGAIN.
Archive the project

1. Click Project  Archive


2. Click “Yes”.
3. Select a folder where you want to
archive your project.
4. Save it as file type "TIA Portal project
archive"
PLC Tags, Memory & Data
Types
Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Data Types
• 1 BIT = 0 or 1
• 1 BYTE = 8 bit
• 1 WORD = 16 bit
• 1 DOUBLE WORD = 32 bit
Bool, Byte, Word, and DWord data types
Integer data types
Floating-point real data types
Addresses of PLC Tags
PLC Tag tables
Creating PLC Tags

1. Double click on “Show all tags” or “Default tag table”.


2. Click on the “<Add new>” and give name for the tag.
Creating PLC Tags

1. Choose the correct data type and address.


2. Since pushbutton only give signal either 0 or 1, Bool data type is used.
3. Pushbutton is an input device so operand identifier “I” is used.
4. 0.0 is used because it is the first unused bit.
Creating PLC Tags

1. Stop Pushbutton also an input and it


use the next available bit which is I0.1
2. Lamp is an output device so “Q” is used
with the first available bit 0.0
Creating PLC Tags

Finding / Replacing / Sorting PLC Tags Error Indication in the PLC Tag Table
Absolute and Symbolic Addressing
Renaming / Rewiring Tags
Monitoring using Watch Table
• We can simulate or test our system using watch table.
• However, it only works for internal memory (M0.0, M0.1 etc.)
• The modify function will not work for physical Input (I0.0) and Output
(Q0.0)
Creating Watch Table

1. Double click “Add new watch table”.


2. Click on the “<Add new>” and choose
the PLC tag that we wanted to use for
monitoring
Modifying Watch Table

1. Right click on the modify value.


2. Choose modify to 1.
Creating Force Table

1. Double click “Force table”.


2. Click on the “<Add new>” and choose the
PLC tag that we wanted to use for forcing
Modifying Force Table

1. Right click on the force value.


2. Choose force to 1.
Bit Logic Operation

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Creating a simple ladder
1. Create a new project.
2. In the program blocks, open “Main [OB1]”

Favorites Command

To insert the command, just drag and drop.

This symbol appears if the network is not complete.


The network is complete when it has input and output.
Inserting branch
1. Click the left rail.
2. Click open branch

1. Insert a contact

1. Click the arrow and hold.


OR
2. Release at the desired location.
1. Click the arrow.
2. Click close branch
Inserting command to favorite toolbar

1. Choose any command on the right.


2. Click and hold the command.
3. Release it at the favorite area.
Normally Open & Normally Close

Normally open
(NO)

Normally close
(NC)
Normally Open & Normally Close

Task 1: Create simple ladder logic as shown on the


left and simulate it using PLCSIM (Refer chapter 6).
IO Address Location

The IO address can be different for each CPU.


We can check the available address:
1. Open devices & Networks.
2. Click on the PLC>Properties>IO tags.
Logic Gates in PLC Ladder Logic
Logic Gates in PLC Ladder Logic
Logic Gates in PLC Ladder Logic
Task 2
• Draw the ladder diagram for the following logic gate.

1 2
Input Instructions
Example
When A is activated, the addition will
operate non stop. After C is deactivated,
the addition will stop.

When B is activated, the addition will


operate once.

When C is activated, the addition will


not operate. After C is deactivated, the
addition will happen.
Output Instructions

Output Set: When the coil is energize,


the output will be high. Output will stay
high even the coil is de-energize.
Output Reset: When the coil is energize,
the output will be reset.
Output Energize: When the coil is
energize, the output will be high.
Set and Reset command must be used together. Output will be low when the coil is de-
The address for both must be the same. energize.
Output Instructions
Multiple Output
• If we have multiple output to be on at the same time, arranged it in
parallel.

Series: If Lamp 1 fail to ON,


Lamp 2 will not ON
Parallel: If Lamp 1 fail to ON,
Lamp 2 still can ON
Seal-in Instructions (Latching)
• If we use a momentary pushbutton to turn on an output, we need
something to hold the output value.
• It is not logical for the operator to keep holding the pushbutton in
order for the output to stay on.
• Other than using Set/Reset instructions, we can use seal-in or
latching method.
Seal-in Instructions (Latching)

Seal-in area: Use NO contact with the


output address that we wanted to latch

Holding the pushbutton Release the pushbutton


Task 3
• Create a ladder logic to start a conveyor with a start pushbutton. The
conveyor will always stays on until stop pushbutton is pressed.
Task 4
• Create a ladder logic to start a conveyor with a pushbutton. When
the conveyor is started, 2 green light will turn on simultaneously. The
conveyor will always stays on until stop pushbutton is pressed. When
the conveyor is stop or not working, red stop light will turn on.
Timer Operation

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Inserting Timer Command

Drag & Drop Can change the data block name


Timer Pulse
• Timer Pulse (TP) timer generates a pulse with a preset width time.

Data Block
Data Block Name

Elapsed Time (current time)


Preset time Must use %MD address
32 bits (Double integer)
Example preset time:
T#24d_20h_31m_20s_800ms
Timer Pulse Timing Diagram

IN 2s 0.2s
If IN is on for 2s, the If IN is on for 0.2s, the
output will on for 1s only output will stay on for 1s
Timer ON Delay (TON)
• Timer On Delay instruction is used to delay an instruction before
become true/high. E.g. After 5 seconds, the motor will on.
TON Timing diagram

IN 10s 0.2s
If IN is on for 10s, the If IN is on for 0.2s, the
output will on after 3s output will not on.
delay. When IN is off, the
output will also off
TON Latching
• The problem with TON is that when we release the button before reaches the
preset time, the timer will reset.
• If the preset time is 30 seconds, it’s not practical for the operator to hold the start
button for 30 seconds before the motor is starting.
• To overcome this problem, we create TON Latching.

We use the data block name with .IN


Task 1
• Write a ladder logic to turn on 3 lamp with TON function. Lamp 1 will
on after 3 seconds being activated. 3 seconds after lamp 1 is turned
on, lamp 2 will also turn on. 3 seconds after lamp 2 is on, lamp 3 will
turn on. Each lamp will turn on with 3 seconds delay each.

Lamp 1 Lamp 2 Lamp 3


3s 3s 3s
ON
Timer OFF Delay (TOF)
• Used Timer Off Delay instruction to delay an instruction before
become false/low. E.g. To fill the water inside tank for 5s before off.
TOF Timing Diagram

IN 3s
Once IN is activated,
output is on immediately.
Timer will start when IN
is deactivated.
Timer On Retentive (TONR)
• TONR as the name suggest, it keep the elapsed time value even the
input is off.
• It need a reset input to reset the elapsed time.
Addressing using %MD
• Since Time is double integer, we have to use MD.
• The address for each tag need to have 4 byte spacing between each
other to avoid conflicts.
• Recall back lesson from chapter 7.
Task 2
• Once the limit switch is ON, the red light and yellow light will on
simultaneously. After 30 seconds the heater will turn on and yellow
light is off. The red light stays on.
Task 3
• A start pushbutton (PB1) is used to start motor 1. A pilot light is used to indicate
that motor 1 is running. Motor 2 can only be started 10 seconds after motor 1 by
using a separate start pushbutton (PB2). Another pilot light is used to indicate
motor 2 running status. If the operator press PB2 when time<10s, motor 2 will
not start. Both motor will be stop if stop pushbutton or emergency pushbutton is
press.
Motor 1 PL 1

PB1 PB2

Motor 2 PL 2
STOP
Counter Operation

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Inserting Counter Operation

Drag & Drop

Can change the data block name


Counter Up (CTU)
• The count value (CV) will increase by 1 when the input signal (CU) is
transition from 1 to 0.
• If the CV >= to preset value (PV), the output signal (Q) will be 1.
• Reset count (R) is used to reset the CV to 0.
Task 1
• Write a logic to latch the Motor (Q0.0) using a start pushbutton (I0.0).
When the counter reaches 10 counts, the motor is stop (unlatch). A
reset button (I0.1) is used to reset the count.
Counter Down (CTD)
• The count value (CV) will decrease by 1 when the input signal (CD) is
transition from 1 to 0.
• If CV<=0, the output (Q) will be high.
• Load count (LD) is used to load the PV to the CV.

%MW2
Task 2
• Write a logic using CTD that count the number of students (I0.0)
passing through the gate (Q0.0). When there are 10 students pass
through, the gate will closed.
Counter Up and Down (CTUD)
• CTUD combines the two function of CTU and CTD together in one
block.

%MW4
Addressing using %MW
• Since counting value is integer, we have to use MW.
• The address for each tag need to have 2 byte spacing between each
other to avoid conflicts.
• Recall back lesson from chapter 7.
Task 3
• Create a ladder logic for car parking system. The parking lot has 10 space available for
parking. If the parking is available, green light is on. When the car reaches the gate, the
entrance sensor will detect the car and the gate will open for 5s. If the parking is full, red
light is on. When there is a car left the parking lot, exit sensor detects the card and green
light will turn back on.
Entrance Exit

1 2 3 4 5

6 7 8 9 10
Task 4
• Start PB is press to start the process. Once sensor A detect 10 pcs of material
inside a box, the conveyor will start running. When sensor B detect the box, the
conveyor will off and the painter will on for 10s. After 10s, the conveyor starts
again. When the box reaches sensor C, the process will repeat until reaches 5
boxes and all the process will stop. If Stop PB is press at anytime, all the process
will stop immediately.
Math Operation

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Inserting Math Operation

Drag & Drop


Data Type

• We can choose the data type for our


calculation.
• If the number is whole number, use Int, DInt
• If our calculation involves decimal places, we
need to choose Real or LReal
Changing Display Format

The value is displayed


in hexadecimal.

Right click on the tag


name and change the
display format to
decimal
Modify Operand Value
Make sure the format
is in decimal

Right click on the tag


name and click
modify operand
Data Type Range Values
Addition & Subtraction
Multiplication & Division
Mod & Calculate
Increment & Decrement
Get Minimum/Maximum
Set Limit
Example
Task 1
• Convert Fahrenheit to Celsius. Take F= 120.
• The formula:
Task 2
• Convert Celsius to Fahrenheit. Take C = 37
Comparator Operation

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Comparator Operation
• Comparator function is used to compared between two different
value of the same data type.

Both value
must be integer
Inserting Comparator Operation

Drag & Drop


Exercise
Task 1
• The operator needs to enter the speed for the motor. The speed must
be from 0 -1750 rpm. If the value entered is outside limit, the motor
wont start. *use modify operand to enter the motor speed
Task 2
• The temperature limit for the oil is between 0-100 Celsius. If the
temperature reach outside the limit, red light will turn on. Create the
ladder logic using limit instruction. *use modify operand to enter the
oil temperature
Task 3
• Create a ladder logic for batch counting operation to sort part
automatically for quality control. A sensor is used to detect and count
the defective part. If the defective part is equal or more than 8 pcs,
red light will on. If the defective part is less than 8, green light is on.
Reset pb is used to reset the counter when there is new batch coming
in.
Move Operation
• Copies the contents of the operand at the IN input (Tag_1) to the
operand at the OUT1 output (Tag_2).
Convert Operation
• Read the content of the IN parameter (Tag_5) and converts it
according to the specified data type.
Jump and Label Instructions
• Jump and Label instructions need to be use in pair.
• The instruction will not complete if either one is not present in the
ladder.
• If the Jump instruction is activated, it will goes straight to the jump
label.
• It will skip any ladder that is between the jump and label instructions.
Inserting Jump and Label Instructions

Drag & Drop


Jump and Label Instructions

Jump is activated

Network 2 is skipped.
Analog Operation

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Introduction to Analog Operation
• PLC can only work with the two values 0 and 1.
• This is due to the fact that a PLC or a microcontroller is really just
advanced electrical circuits made out of transistors.
• Since a transistor can only be either on or off, these two states will
then represent the values 0 and 1.
• In the real world, analogue signals have continuously changing values
which come from various sources and sensors which can measure
sound, light, temperature or movement, and many digital systems
interact with their environment by measuring the analogue signals
from such transducers.
Analog Signals in PLC
• A PLC can only work with the values 0 and 1
• Analog signals are continuous signals that can vary over time.

The Question Is Now: How Do A PLC Deal


With All These Different Values? Let’s Say You
Have An Analog Signal At 5 Volts Going Into
The PLC. We Cannot Represent It With
Boolean Values, Because They Can Only Have
The Values 0 And 1

Answer: Converting analogue value to binary value


Analog-to-digital Conversion
• It is necessary to have an electronic circuit which can convert
between the two different domains of continuously changing
analogue signals and discrete digital signals, and this is where
Analogue-to-Digital Converters (A/D) come in.
• There are 3 types of analog signal:
• Voltage
• Current
• Resistance
Resolution of Analog Signal
• Resolution is the number of bits per conversion cycle that the
converter is capable of processing.
• For example, a converter with 12 bits of resolution is often referred to
as “12 bits wide,” since 12 bits get processed in each conversion cycle.
Resolution of Analog Signal
• If you need accurate voltage level for your system to read, then the
bit resolution is important to know.
• The resolution depends on both the bit length and the reference
voltage.
This is accurate as the digital system will be
able to tell when the voltage changes on an
accuracy of 1.22mV for 12 bits.
Analog Input
• Analog inputs can come from a variety of sensors and transmitters or
both.
• For example the thermocouple types connected to a transmitter, which is
then connected to a PLC analog input.
• The job of the sensor or transmitter is to transform that into an electrical
signal. Few of the things you can measure with analog sensors:
• Level
• Flow
• Distance
• Viscosity
• Temperature
Analog Input
• A transmitter is often needed because the sensor in itself cannot provide us with
an analog signal.
• Or at least not one that fits a PLC analog input. It is possible to buy analog input
modules where you can connect a temperature sensor for example directly.
• But most often you will have a voltage or current input module where you
connect a transmitter.

Calibration is very important


when talking about transmitters.
You have to know how much
those mA or volts represents in
the physical value
Wiring Analog Input
• Two basic analog input signal (commonly used):
• Voltage
• Current
• These two types of analog signals works in very different ways, you
will also have to wire them differently on the analog input module.
• Mistakes in the wiring can potentially destroy the input module, so be
careful!
Voltage Analog Input Wiring
• All analog voltage has 2 terminals:
• AGND: The ground or reference for analog inputs
• AIN: Analog input
• It is between AGND and AIN that the PLC measures how many volt there are on
the analog input.
• When you’re connecting the analog voltage source, the AIN is where you connect
the positive (+) side of it.
• The negative side (-) should be connected to AGND. Those are the two main wires
for the analog signal.
Voltage Analog Input Wiring
• But if you only connect those two you will end up with a very vulnerable signal.
• Electromagnetic compatibility (EMC) can easily alter your analog signal.
• As you can see below, this is solved by shielding the wires and connecting the
shield to ground.
• Be aware though that this is NOT the same ground as the AGND!
Current Analog Input Wiring
• Instead of voltage you can also use current as analogue signal. They
might be a little more tricky to wire, but in general they are more stable.
• The current in analogue signals is usually measured in mill amperes (mA).
A typical range here is between 0 and 20 mA.
• First of all, you need a closed loop for current to flow.
• Even though the wiring of the first type of current transmitter is the same
as with voltage, something different goes on here.
• Current is the flow of electrons from one pole to another. That is why you
will always need a closed loop for measuring current.
Current Analog Input Wiring
• Wiring of current analogue inputs. They can generally be divided in three
types:
• 2-wire analogue input
• 3-wire analogue input
• 4- wire analogue input
• When talking about 2, 3 and 4 wires what we’re talking about here is really
the transmitters or transducers.
• Current transmitters can be wired in different ways and therefore with a
different number of wires.
• The difference is really the power supply for the signal.
• Sometimes the transmitter will supply the circuit, and sometimes you have
to use an external supply.
2-Wire Analog Input
• The simple way is to connect a 2-wire transmitter and connect it to be loop-powered. Basically this means that the PLC will supply the current loop. Only
2 wires are needed here. In order for the PLC to supply the current we need to use another terminal on the analogue input module:

You can also use an external power supply for the 2-wire transmitter.
One wire that goes from A+ through the transmitter and back in another Connect the 0 V from the supply to AGND and 24 V through the
wire to AIN. The supply comes from A+, the transmitter controls the transmitter back to AIN. Although you would practically need 3 wires
current flow and the analogue current signal goes into AIN. for this, it is still considered a 2-wire analogue input connection.
Because the transmitter only has two wires
3-Wire Analog Input
• In a 3 wire current loop only the ground is shared
between the supply and the signal.
• The ground is connected to both AGND and on the
power supply (-).
• But the transmitter has 2 positive (+) wires. One that
goes to the power supply (+), and one that goes to
AIN.
• Though they share the ground a 3-wire transmitter
creates 2 loops.
• One for the signal and one for the supply.
• Now the sensor or transmitter can consume as much
current as it needs without interfering with out
analogue signal.
4-Wire Analog Input
• The 4-wire transmitter is also widely used
since it separates the supply from the signal.
• By giving the transmitter 4 wires, you can have
2 for the supply and 2 for the signal.
• Naturally, the 4-wire transmitter requires an
external power supply.
• Clearly the biggest advantage of using a 4-wire
transmitter is the complete separation
between supply and signal.
• They can be fully isolated or opto-isolated so
that disturbance in the supply shouldn’t affect
the signal.
Analog Output
• Analog outputs has a lot of similarities with analogue inputs. But there are
still some differences in both the way you wire them, and in the way you
use them in your PLC program. Just like the analogue input, the analogue
outputs can be divided in two types:
• Voltage
• Current
• Both principles are the same. Either we use voltage or current as analogue
signal.
• The device you connect to your analog output is what decides which type
of analog signal you should be using.
• If you want to control a valve with a 4-20 mA signal, then your analog
output should also be 4-20 mA
Voltage Analog Output Wiring
• For this you will only need 2 wires. A positive and a negative side of the voltage source. Which in this case is our
analogue voltage output. Here’s how a simple 2-wire analogue voltage output is wired:
Current Analog Output Wiring
• Most analogue outputs on PLC’s works very
much like a 3-wire transmitter.
• This might seem odd, since we only had 2
wires so far.
• But the PLC often provides an internal
power supply giving us the third wire. The
supply for the signal.
• This means that when you’re working with
current outputs, you will most times only
have to wire the signal current loop.
• Of course you will eventually also have to
wire the supply loop.
• But that is often needed to supply the
module itself so the PLC can see it.
Voltage vs. Current Measurement
• Voltage and current are the common measurement used in PLC.
• Both have their own advantages and disadvantages
• Voltage signal can easily be altered by magnetic fields.

Voltage Current

Wiring Easy to wiring More difficult to wiring

Magnetic Field Affected Does not affect


Checking the address for all module

1. Double click on the PLC.


2. Properties bar will open
Checking the address for all module
Checking the address for all module

1. Other method to check the address is clicking the IO tags.


2. From here, it will list out all the available address to be used
Task 1
• Create a project with this device configuration:
• CPU: 215-1BG40-0XB0
• DI/DQ: 223-1PL32-0XB0
• AI/AQ: 234-4HE32-0XB0
• Identify all the input and output address for signal module DI/DQ and
AI/AQ.
Changing Measurement Type

1. We can choose the measurement type and


voltage range depending on our sensor
application.
Current Range
• If current is used as measurement type, there are two available
current range.
• Both can be used but 4-20mA is more preferable.
Analog Scaling
• NORM_X: Receive an input signal and normalize it to a value between
0 and 1 (real number).
• SCALE_X: Receive the value from NORM_X and scale it to the desired
range that we want to use.

Drag & Drop


Example: Displaying Temperature

The range is fix


to 0-27648

The range is
depends to our
requirement.
Example: Displaying Temperature

• 13824 is ½ from the 27648.


• The display value must be ½
from 100, which is 50

• If the scale value is change to


0-200, the display will change
to 100
Modular Programming

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Types of Program Block
Structured Programming
Functions (FC)
• Performs a specific operation on set of input values:
• To perform standard or reusable operation such as mathematical calculations
• To perform functional tasks such as for individual controls using bit logic operations
• FC can be called several times at different points in the program. This reuse simplifies
the programming of frequently recurring tasks
• For example, if you want to programmed for 10 different motors.
• All of the start sequence is the same.
• You can type the same program 10 times but what if there is 100 motors?
• By using FC, you only need to program it once and reuse it multiple times.
Creating Functions

1. Double click add new block.


2. Choose Function (green icon).
3. Give the block name.
Creating “Local Tags”

1. Here we can create the internal input &


output tags.
2. The InOut is used when the variable is used
as an input and output.
3. Temp is used for temporary data.
4. Constant is used for defining constant value.
Inserting Local Tags

Drag & Drop


Example for InOut

Output at network 2

Input at network 3
Inserting FC to Main OB

Open Main OB, drag


and drop FC1

Give the input and


output address.
Task 1
• By using FC, create a program to start the conveyor by using on and
off pushbutton. There are total of 5 conveyor with their own start and
stop PB.
• After creating the program, simulate it using Factory IO.
Function Block (FB)
• An FB is a code block whose calls can be programmed with block parameters.
• The FB stores the input (IN), output (OUT), and in/out (IN_OUT) parameters in
variable memory that is located in a data block (DB), or "instance" DB.
• The instance DB provides a block of memory that is associated with that instance
(or call) of the FB and stores data after the FB finishes.
• You typically use an FB to control the operation for tasks or devices that do not
finish their operation within one scan cycle. To store the operating parameters so
that they can be quickly accessed from one scan to the next, each FB in your user
program has one or more instance DBs.
• When you call an FB, you also open an instance DB that stores the values of the
block parameters and the static local data for that call or "instance" of the FB.
These values are stored in the instance DB after the FB finishes.
• You can associate different instance DBs with different calls of the FB.
Creating FB

1. Double click add new block.


2. Choose Function Block (blue icon).
3. Give the block name.
Creating “Local Tags”

1. Everything is the same as in FC.


2. FB has additional tag which is “Static”.
3. Static is something in which variable value
can be stored.
Task 2
• By using FB, create a program to fill water inside the tank by using fill
PB and release PB to drain the water.
• There are total of 3 tank that has their own preset time.
• Tank 1 fill water for 8 seconds, tank 2 for 5 seconds and tank 3 for 3
seconds.
• After the tank reaches preset time, the fill valve will be closed.
• After creating the program, simulate it using Factory IO.
Human Machine Interface (HMI)

Prepared by:
Mohamad Hafiz Bin Ahmad
[email protected]
Jabatan Latihan
Kulim Advanced Technologies Sdn. Bhd.
Introduction to HMI
• A very common HMI that you all encounter on a regular basis would
be an ATM machine.
• The screen and pushbuttons allow you to operate the machine to
dispense a certain amount of money, or to deposit money.
• An operator or maintenance personnel can operate and monitor the
machine from the HMI.
• They may include information like temperature, pressure, process
steps, and material counts.
• They can also show very precise levels in tanks and exact positioning
of machines.
Introduction to HMI
• For maintenance personnel, many HMIs can also 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.
PLC and HMI Connection
• HMI and PLC need to be compatible which means they need to be able to “talk”
to each other.
• Common protocols are Modbus, Ethernet/IP, and Profibus.
• Once the PLC and the HMI are “talking” then whatever is programmed into the
HMI can be used to monitor and control PLC functions.
Siemens HMI Series
Siemens KTP-400
Setting up PLC

1. All connected device must have


the same subnet to “talk” to
each other.
2. Each device must have different
node (1 device 1 node).
Adding HMI Device to TIA Portal

1. Create new project as usual.


2. On add new device, select HMI.
3. Choose any type of display.
4. Click Add
Adding HMI Device to TIA Portal

1. If we have setup a PLC


early on, we can choose
at “Browse”.
2. Click “Next” or “Finish”
if you don’t want to
change any settings.
Adding HMI Device to TIA Portal
Connecting HMI & PLC

1. If we add plc after HMI, we need


to connect both together.
2. Click “Devices & networks”.
3. Click “Network view”.
4. Click the green square and drop
to another.
Connecting HMI & PLC

1. If we have setup a PLC


early on, we can choose
at “Browse”.
2. Choose the PLC.
Example
• Create a simple On and Off Lamp.

1. Click the HMI device.


2. Click HMI tags.
3. Open Default tag table.
Creating HMI Tags

1. Create an HMI start button.


2. Under “PLC Tag”, choose the
Start button I0.0
Creating HMI Tags

1. Create all remaining PLC Tags.


Creating HMI Interface

1. Open Root screen.


2. Edit whatever we wanted to
display.
Creating HMI Interface

1. Click the start button.


2. On the properties, we
can edit many things.
1. Drag & Drop
Linking PLC Tags and HMI tags

1. Under Events, click on 1. Click Add function.


“Press” 2. Choose “SetBitWhileKeyPressed”
Linking PLC Tags and HMI tags

1. Choose HMI_Start.
2. Let Bit = 0.

1. Initially, the bit is 0.


2. When we press HMI_Start. The
bit will become 1.
3. If we release it, the bit will back
to 0 (reset).
4. Repeat for all tags stop and lamp.
Change Appearance
Creating Lamp Animation

1. Choose HMI_Lamp tag

1. Set bit 0 for green color.


2. Bit 1 for red color.

1. Under Animations, click Add new


animation.
2. Choose appearance to change the
lamp color.
Simulate HMI using WINCC

1. Click on the HMI device.


2. Click compile.
3. The download option will be
available if we have HMI
hardware.
4. Click on start simulation.
Simulate HMI using WINCC

1. Start button is pressed.

1. Stop button is pressed


HMI Numeric Input/Output

1. Create ladder & HMI as


shown.
2. Using memory bit (M30)
as an input is faster than
using (I0.0) for simulation.
HMI Numeric Input

1. Click on the preset time.


2. Link it to the HMI tag.
3. Set the type as Input
HMI Numeric Output (Display)

1. Click on the elapsed time.


2. Link it to the HMI tag.
3. Set the type as Output
Simulation

1. Press on the preset time.


1. Enter preset time.
2. Click enter.

1. Since the format is in


milliseconds, we need to
enter 5000 for 5 seconds.
Exercise
• Edit the ladder logic where the operator entered the preset time in seconds, not
in milliseconds. The elapsed time also should be display in seconds.
• Hint: use mathematical operations
Animating Object/Graphics

There are many objects and


graphics available under the
toolbox>graphics.
1. We can insert our own
graphics.
2. Scroll down, right click my
graphics folder > Link.
3. Choose the folder that
contains our graphics.
Inserting Graphics

1. Click Text and graphic lists.


2. Open Graphic lists.
3. Add the graphic name.
4. Drag and drop any graphic

Drag & Drop


Inserting Graphics

Drag & Drop

1. Choose the tag as usual.


1. Float the screen.
2. Open Root Screen.
3. Drag the icon and drop
it into the Root screen.
Inserting Graphics
Creating Tank Level Animation

1. Add a new screen.


2. Insert Bar.
3. Insert pumps and pipes.
Changing Between Screen

1. Create a button.
2. Under click, choose
ActivateScreen.
3. Choose screen name.
Changing Between Screen

1. Create a button to go back to


root screen.
2. Repeat the same step as
before.
Creating Tank Level Animation

1. Edit the ladder logic as shown.


2. Click on tank, choose the tags.
3. Simulate the HMI.
Alarm Class

Error- Alarms that is critical to the machine. The machine will not
work if the problem is not resolved. Example: motor is damaged,
the alarm will not go away until the motor is fixed.

Warnings-Alarms that can be reset or acknowledge immediately.


Example: motor is tripped due to sudden current surge. If there is
no current surge anymore, simply turn on back the overload relay.
Creating Discrete Alarm

1. Create a new screen ‘Error’.


2. Drag and drop the error controls into the
screen.
Creating Discrete Alarm
The Trigger tag cannot accept “Bool” type.
It must be either Dword or Word.
Output coil can only accept Bool.

1. Edit the ladder as shown.


2. Open HMI alarms.
3. Give the alarm name, text, class and trigger tag.
Testing the alarm
Creating Analog Alarms

1. For demonstration purpose, I will be using the


elapsed time as the analog water level.
2. IF the water level is less than 10, low level alarm
will be shown.
3. If the water level is more than 20, high level
alarm will be shown.
Testing Analog Alarms

Since elapsed time < 10, low Since elapsed time >25, high
level alarm is triggered. level alarm is triggered.

You might also like