PLC Book Part II — Ladder Logic Programming Essentials Chapter 6
Chapter 6 Part II · Ladder Logic Programming Essentials Intermediate ⏱ 60 min read ✦ 10 PLC Programs

06

Developing Fundamental PLC Wiring Diagrams & Ladder Logic Programs

Time to step out of the abstract and into the wiring closet. We’ll meet the physical devices that hang off every PLC’s I/O wires — relays, contactors, motor starters, and the eight common sensor types — and learn the two skills that turn an engineer into a programmer: converting a relay schematic into ladder, and writing ladder from a written specification. Ten worked programs along the way.

What you’ll be able to do after this chapter

Your goals for this chapter:

  • Distinguish a control relay, contactor, and motor starter — and pick the right one for a given load.
  • Read pushbutton, selector, drum, limit, and foot switch symbols on a wiring diagram.
  • Recognise the eight common industrial sensor types and explain what each one detects.
  • Wire and program inputs from real-world devices including thermal overloads, level switches, and pressure switches.
  • Choose appropriate output devices — solenoids, indicator lamps, alarms, contactors — for any control task.
  • Apply seal-in, interlock, and latching patterns to motor and process control.
  • Convert a hardwired relay schematic into an equivalent ladder logic program, rung by rung.
  • Write ladder logic directly from a narrative description of the desired behaviour.
  • Read basic instrumentation symbols on a P&ID and translate them to PLC I/O.

Key Concepts & Terms

Control relay (CR)ContactorMotor starterThermal overload (OL) PushbuttonSelector switchDrum switch Limit switchFoot switch Inductive proximityCapacitive proximityMagnetic reed PhotoelectricUltrasonicLoad cellRTD · ThermocoupleFlow switch SolenoidPilot lampAudible alarm Seal-inInterlockLatching relay Schematic-to-ladder conversionNarrative-to-ladder programming P&ID · Instrumentation
Section 6.1

Electromagnetic Control Relays

A control relay is the simplest electromagnetic device on the floor: a small electromagnet that pulls a set of contacts closed (or open) when its coil is energised. Apply 24 V DC to the coil and the contacts switch — that’s it. Drop the voltage and a spring snaps them back.

Relays solve one problem brilliantly: signal isolation. The PLC’s tiny output transistor cannot directly switch the 30 A motor in your machine. Instead, the PLC switches a small current through the relay coil, and the relay’s much beefier contacts switch the load. Same idea your finger uses when pressing a light switch — your finger doesn’t carry the current, the switch does.

Two terms to lock in:

  • Coil — the electromagnet itself. Drawn as a circle with the letters CR (Control Relay) plus a number. Energising the coil “operates” the relay.
  • Contacts — the actual switches the coil moves. A single relay can have many contacts. Each is either NO (normally open, closes when energised) or NC (normally closed, opens when energised). The “normal” state is always the de-energised state.
Section 6.2

Contactors — Heavy-Duty Relatives of the Relay

A contactor is essentially a relay built for muscle. Same electromagnet-and-contact idea, but the contacts are sized to carry tens or even hundreds of amps. Contactors switch motors, large heaters, lighting banks — anything where a regular relay’s 5–10 A rating would melt.

You’ll recognise a contactor by its size (palm-sized to shoebox-sized), the heavy bus bars it bolts onto, and the much larger main contacts behind a removable arc-suppression cover. Smaller “auxiliary” contacts on the side handle the control-circuit signalling — typically used for the seal-in branch we met in Chapter 5.

Practical anatomy

A typical 3-phase motor contactor has three big main contacts for the three power phases (L1/L2/L3 going to T1/T2/T3 on the motor) plus two or three auxiliary contacts rated 10 A. The PLC drives the coil through one of its outputs; the auxiliary contacts feed bits back to the PLC inputs to confirm the motor actually energised.

Section 6.3

Motor Starters and Thermal Overload Protection

A motor starter is a contactor with a thermal overload (OL) relay bolted to its output side. The OL contains a tiny heater coil for each phase, sized so it heats up at the motor’s rated current. If the motor draws too much current for too long — a stuck rotor, a jammed shaft, a failing bearing — the heaters get hot, a bimetallic strip bends, and an OL contact trips, opening to disconnect the contactor’s coil and shut the motor down.

The OL contact is wired normally-closed in the start/stop control circuit, so it must stay closed (no fault) for the motor to run. When it trips, the motor stops, and an operator must manually press the OL reset before the motor can restart. This delay is intentional — the motor needs to cool.

PLC vs the OL contact

In a modern installation, you have two choices for OL feedback. Wire the OL contact directly in series with the contactor coil (electromechanical protection — works even if the PLC is dead) and bring it into a PLC input I:1/2 for indication and alarming. The hardwired path provides safety; the PLC path provides visibility. Always do both.

Section 6.4

Manually Operated Switches

These are the buttons and switches the human operator touches. They translate a physical action — finger press, hand twist, foot stomp — into an electrical signal.

Pushbuttons

The momentary pushbutton is the workhorse of every control panel. Press it and a contact closes (NO) or opens (NC); release and a spring returns it to rest. NO and NC pushbuttons look almost identical — you read a tiny stamping on the side or check the wiring diagram. START buttons are conventionally NO; STOP buttons are conventionally NC for fail-safe behaviour.

Many real pushbuttons have both NO and NC contacts on the same body, mechanically linked. One press operates both — useful when you need to start one circuit and stop another simultaneously.

Selector Switches

A selector switch stays in whatever position the operator turns it to (no spring return). Two-position (ON/OFF, AUTO/MANUAL) and three-position (HAND/OFF/AUTO) variants are the most common. Internally it’s a multi-pole switch where each rotation position closes a different combination.

Drum Switches

A drum switch is a multi-position rotary that engages many contact patterns at once. The classic application is a forward/reverse motor switch with five positions. Rare on new equipment — most modern designs use individual buttons feeding logic — but you’ll meet drum switches on legacy machinery and low-cost retrofits.

Section 6.5

Mechanically Operated Switches

These switches are tripped not by a human, but by the machine itself — by a moving part touching a lever, plunger, or roller.

Limit Switches

The limit switch is the most common mechanically-operated input on any factory floor. A spring-loaded actuator (lever, plunger, or roller) sticks out from the switch body. When a moving part of the machine pushes against it, contacts inside transfer (NO closes, NC opens). Limit switches answer questions like “is the cylinder fully extended?”, “has the conveyor reached the next station?”, “is the door fully closed?”.

Three actuator styles dominate: plunger (push down to operate), roller lever (a wheel on an arm, ideal for cams and tabs), and roller plunger (a small wheel on a vertical plunger). Choose based on the geometry of what’s hitting it.

Foot Switches

A foot switch is a pushbutton you operate with your shoe. Useful when both hands are busy with the workpiece — sewing machines, shears, drill presses, packaging tables. Always wire foot switches as maintained (held while pressed) — never as latching — so the operator can release them in an emergency.

Section 6.6

Sensors — A Survey of the Eight Common Types

A sensor detects a physical condition and produces an electrical output (usually a discrete on/off bit, sometimes an analog signal). Choosing the right sensor for a given job is half of automation engineering. Here are the eight you’ll meet most often.

Inductive and Capacitive Proximity

Both look like cylindrical “pencils” that screw into a bracket and have a sensing face. Inductive sensors detect metal only via the eddy currents the target induces in the sensor’s coil. They’re the most rugged and cheapest of the proximity types. Capacitive sensors detect any material (metal, plastic, water, grain) by the change in capacitance between the sensor face and the target. Use capacitive when you need to detect through a non-metal wall — a plastic pipe full of liquid, for example.

Magnetic Reed

A reed switch is a tiny glass-encased contact that closes when a magnetic field passes near it. The classic application is sensing the position of a hydraulic or pneumatic cylinder — a magnet is embedded in the piston, and reed switches mounted on the cylinder body detect the piston at full retract and full extend.

Photoelectric (Light)

A light source shines at a receiver, and the receiver detects either the beam or its reflection. Three common variants:

  • Through-beam — separate emitter and receiver. Most reliable, longest range (up to 50 m), but needs both halves wired.
  • Retroreflective — emitter and receiver in one body, reflected off a corner-cube reflector. Simpler wiring, shorter range.
  • Diffuse — same body, no reflector — looks at light bouncing off the target itself. Easiest to install but range and reliability depend on the target’s colour and finish.

Ultrasonic

Same idea as a bat or a parking sensor — emit a short pulse of high-frequency sound, time the echo. Used for level measurement, distance, and presence detection where vision or proximity sensing isn’t practical (high temperature, transparent targets, dusty atmospheres).

Weight (Load Cell)

A load cell measures force or weight via a strain gauge bonded to a metal flexure. Used on silos, hopper scales, batch weighers, and tension-control rolls. Output is typically a tiny millivolt signal that a dedicated module amplifies into a 4–20 mA value.

Temperature (RTD & Thermocouple)

RTDs and thermocouples measure temperature. RTDs (typically PT100 or PT1000) work by the change in resistance of a precision platinum element as it heats up — accurate, stable, used for process temperatures up to about 600 °C. Thermocouples generate a tiny voltage at the junction of two dissimilar metals — cheap, rugged, and good up to 1200 °C+ for furnace work. Both feed dedicated temperature input modules that handle linearisation and cold-junction compensation.

Flow

Flow switches can be discrete (paddle pushed by flow closes a contact — gives you “flow OK / no flow”) or analog (turbine, vortex, magnetic flow meters output a 4–20 mA signal proportional to flow rate). Discrete flow switches are cheap and fine for “is the cooling water actually flowing?” interlocks; analog flow meters are needed when you have to measure or totalise.

Position

“Position” covers a big family — limit switches at one end, encoders and resolvers at the other. We’ve already met limit switches; encoders give continuous position over many revolutions and feed pulse trains to a high-speed counter input on the PLC. We’ll build a program with an encoder in a later chapter.

Section 6.7

Output Control Devices

What can a PLC output drive? Anything that needs an electrical signal, but in practice four kinds of devices cover 95 % of factory applications:

DeviceTypical useOutput type needed
Pilot lampStatus indication on the panel — RUN, FAULT, HOMEDiscrete DC or AC
Solenoid valvePneumatic / hydraulic actuators · open-close water valvesDiscrete (24 V DC or 120 V AC)
Audible alarm / hornOperator attention on faultsDiscrete (24 V DC typical)
Contactor / motor starterMotors, heaters, large lighting loadsDiscrete switching the contactor coil — never the motor directly
VFD / driveVariable-speed motorsAnalog or digital speed reference
Analog valve / damperModulating flow or positionAnalog 4–20 mA out

The single rule that protects your PLC’s output card: never let a load draw more current than the output module is rated for. A typical relay output handles 2 A at 120 V AC — plenty for a contactor coil, nowhere near enough for a 5 HP motor. The PLC always commands the motor through an intermediary contactor.

Section 6.8

Seal-In, Interlock, and Latching — A Reinforcement

You met all three of these patterns in Chapter 5. Let’s say each one out loud one more time, because if these three patterns are second nature, half of all industrial PLC programming is already in your head.

  • Seal-in. A parallel branch around the START button containing an XIC of the output’s own bit. Lets a momentary START button latch the output until something else breaks the rung.
  • Interlock. An XIO of one output bit placed in the rung of another output. Prevents two mutually-exclusive outputs from energising at the same time. Forward/reverse motors, up/down hoists, infeed/outfeed conveyors — all use software interlocks. Belt-and-braces them with mechanical contactor interlocks for high-power loads.
  • Latching. Persistent state — once set, stays set until explicitly reset. Built either with the seal-in pattern (preferred for motor control because the latch clears on power loss) or with OTL/OTU pairs (for state flags that should survive a power cycle).
Section 6.9

Latching Relays — The Hardware Cousin of OTL/OTU

Before PLCs, when a circuit needed to remember its state across power loss, engineers used a latching relay. This is a special two-coil relay: the “set” coil pulls the contacts closed and a tiny mechanical detent holds them there even after the coil is de-energised. The “reset” coil pulls them back open.

In ladder logic, OTL/OTU pairs are the direct software equivalent — except OTL/OTU also lose state on a CPU power loss unless the controller has a battery-backed retentive memory area, which most modern CPUs do.

Why it still matters today

Mechanical latching relays still beat software for one specific job: fail-safe shutdowns. A latching emergency-stop relay holds its tripped state through a complete power cycle, no battery needed. Once the E-stop fires, only a manual reset (a key turn or a separate reset button) clears it — exactly what regulators require for life-safety circuits.

Section 6.10

Converting a Relay Schematic to a Ladder Program

Most factories built before 1990 are still controlled by relay logic that has been “ported” to PLCs over time. The skill of reading an old relay schematic and writing the equivalent ladder rungs is one you’ll use often. The conversion is mechanical once you know the mapping:

Relay schematic elementLadder logic equivalent
NO pushbutton (START)XIC of the input bit it’s wired to
NC pushbutton (STOP)XIC of the input bit (since wired NC, bit is 1 at rest)
NO contact of a relay (CR1-NO)XIC of the corresponding internal or output bit
NC contact of a relay (CR1-NC)XIO of the same bit
NC overload contact (OL)XIC of the OL input bit
Series wiring (one after another)Contacts in series on the rung (AND)
Parallel wiring (branched)Parallel branches on the rung (OR)
Relay coil (CR1, M)OTE of the corresponding bit

Apply this table line by line to any relay schematic and you have your ladder program. Worked program 9 below shows the conversion in action on a classic three-wire motor starter.

Section 6.11

Writing Ladder from a Narrative — A Structured Approach

The other half of this skill set is going from prose (“the customer wants the machine to…”) to ladder. Engineers in their first job often freeze at this step because the narrative is open-ended. Use this five-step recipe and the freeze stops happening:

  1. List every input device the narrative mentions or implies. Pushbuttons, sensors, limit switches, selector positions. Assign each one an input address. Note whether each is NO or NC.
  2. List every output device. Motors, valves, solenoids, lamps, alarms. Assign each an output address. Note any interlocks or mutual exclusions implied.
  3. Write the boolean expression for each output. “Motor M1 is on when … AND … OR …”. Don’t worry about ladder syntax yet — get the logic right in plain English first.
  4. Translate each expression into a single rung. Series for AND, parallel for OR, XIO for NOT. Add seal-in branches for momentary inputs that should latch.
  5. Add the safety, fault, and reset rungs last. Stop buttons (NC, XIC), emergency stops (hardwired AND in the program), fault latches, alarm acknowledge.

This 5-step process scales from a 5-rung program to a 500-rung program. Worked program 10 below uses it from start to finish on a real motor narrative.

Section 6.12

Instrumentation and P&ID Symbols

On any process plant — chemicals, food, water treatment, pharma — you’ll be handed a P&ID (Piping and Instrumentation Diagram) before you ever touch the PLC. The P&ID shows every pipe, valve, vessel, pump, and instrument with a standard symbol set defined by ISA-5.1.

An instrument is shown as a circle (or other shape) with a tag inside. The tag has two parts:

  • First letter: what’s measured. L=level, P=pressure, T=temperature, F=flow, W=weight.
  • Second letter (and beyond): what kind of device. T=transmitter, I=indicator, S=switch, C=controller, V=valve, SH=switch high, SL=switch low.

So LSH-101 is “Level Switch, High, loop 101” — a discrete sensor that closes when level is too high. FT-220 is “Flow Transmitter, loop 220” — an analog 4–20 mA sender. TIC-305 is a Temperature Indicating Controller. Once you can read the tag, you know what to wire to the PLC and how to write the rung.

Tip for new engineers

When you start a new project, put the I/O list and the P&ID side by side and number them off together. Every instrument bubble on the P&ID should map to one row of the I/O list. Anything missing is something you’ll discover the hard way during commissioning. Better to find it on day 1.

Section 6.13

Putting It Together — From Wiring Diagram to Ladder

You now have all the pieces. The full design loop on a new project looks like this:

  1. Read the customer’s narrative and the P&ID. List every input and output device.
  2. Build the I/O list — every device gets a PLC address, an electrical specification (NO/NC, voltage, current), and a brief description.
  3. Lay out the panel — pick the contactors, motor starters, control transformers, terminal blocks, and PLC chassis.
  4. Draw the wiring diagrams — power section, control section (24 V DC), and I/O section (every input and output drawn).
  5. Write the ladder logic — section by section, following the narrative. Use the conversion table for any relay-style interlocks pulled from existing equipment.
  6. Test in PROG and TEST modes before going to RUN. Force individual inputs from the laptop to verify each rung does what you expect with no real machine motion.

This is the same loop whether you’re writing 30 rungs for a packaging machine or 3 000 rungs for a brewery. The discipline scales. Time now to apply it to ten worked programs.

Worked PLC Programs

Ten Programs — From a Single Relay to a Full Narrative-Driven Machine

Each program below takes a real-world wiring problem — a relay, a motor with overload, a sensor on a conveyor — and turns it into ladder logic step by step. The last two programs are the methodology gold: relay-schematic-to-ladder conversion, and writing ladder from a written specification.

01

PLC Program · Relay basics

Control Relay (CR1) — Internal Bit Drives an Output

CR

The problem: a single button should energise an internal control relay CR1, and that relay’s contact should drive a panel pilot lamp. Inside the PLC, “CR1” lives as an internal bit (B3:0/0); what would be a physical relay coil and contact in hardware becomes an OTE writing the bit, then an XIC reading it.

Inputs & Outputs

INPUT

I:1/0 — push-button (NO)

OUTPUTS

B3:0/0 — CR1 (internal)

O:2/0 — pilot lamp

Ladder Diagram (Two Rungs)

L1 L2 000 I:1/0 XIC · PB B3:0/0 OTE · CR1 001 B3:0/0 XIC · CR1 O:2/0 OTE · Lamp

Rung 0 energises CR1 (the internal bit). Rung 1 uses CR1’s “contact” to drive the lamp.

How it works

The simplest “control relay” pattern: one rung writes the bit, another rung reads it. In hardware, you’d see a relay with a coil energised on rung 0 and an NO contact in rung 1 closing the lamp circuit. In the PLC, both are bits in memory. The pattern matters because in larger programs, internal bits like CR1 stand between many input conditions and many outputs — write once, read many.

What we learned: in software, a “control relay” is just an internal bit (B-bit). One rung writes it; any number of rungs can read it with XIC or XIO. This is how you decouple “compute the condition” from “drive the output”.
02

PLC Program · Three-wire motor control

Motor Starter with Thermal Overload Protection

3-WIRE

The problem: the canonical industrial motor starter. Momentary START, NC STOP, NC overload contact (OL) from the thermal relay — all in series, with a seal-in branch. If the motor draws too much current and the OL trips, the motor stops and won’t restart until the OL is manually reset.

Inputs & Outputs

INPUTS

I:1/0 — START (NO)

I:1/1 — STOP (NC)

I:1/2 — OL contact (NC, 1 = OK)

OUTPUT

O:2/0 — Motor contactor (M)

Ladder Diagram

L1 L2 000 XIC I:1/0 Start O:2/0 seal I:1/1 Stop (NC) I:1/2 OL (NC) O:2/0 OTE · M

The classic three-wire control. STOP and OL both wired NC and tested with XIC — fail-safe.

How it works

This is the seal-in pattern from Chapter 5 with one extra contact: an XIC of the OL input added in series. While the motor is healthy, the OL contact in the field is closed (bit = 1) and the XIC passes power. If the motor draws too much current, the OL trips, the field contact opens, the bit drops to 0, the XIC blocks, and the motor stops. The seal-in latch also drops, so even after the OL is reset, the operator must press START again — exactly what you want for a fault.

What we learned: add safety contacts in series. STOP, OL, E-stop, low-oil-pressure — all wired NC and tested with XIC. Each one is one more thing that has to be true for the motor to run; any one of them can shut it down.
03

PLC Program · Selector switch

HAND-OFF-AUTO — Two Operating Modes for One Pump

SELECTOR

The problem: a sump pump can run in two modes selected by a 3-position rotary. In HAND, the operator runs the pump manually with a momentary button. In AUTO, a float switch starts the pump on high level. OFF stops it regardless. The selector sends two bits: HAND=1 in HAND, AUTO=1 in AUTO, both 0 in OFF.

Inputs & Outputs

INPUTS

I:1/0 — HAND position

I:1/1 — AUTO position

I:1/2 — Manual run button

I:1/3 — Float switch (1 = high)

OUTPUT

O:2/0 — Pump motor

Ladder Diagram

L1 L2 000 XIC I:1/0 HAND XIC I:1/2 Run PB XIC I:1/1 AUTO XIC I:1/3 Float HI O:2/0 OTE · Pump

Two parallel branches — top is HAND mode, bottom is AUTO mode. Either path starts the pump.

How it works

The selector makes either I:1/0 (HAND) or I:1/1 (AUTO) true at a time — never both, since that’s how the rotary is built. In OFF, neither is true, so neither branch can pass power and the pump stays off. In HAND, the top branch passes only when the manual run button is held. In AUTO, the bottom branch passes only when the float switch reports high level. Notice we don’t need a software interlock between HAND and AUTO — the rotary’s mechanics enforce it.

What we learned: a multi-position selector is just two (or more) parallel branches gated by the position bits. The selector enforces mutual exclusion in hardware; the program just consumes its outputs. Add seal-in branches if either mode needs latching action.
04

PLC Program · Limit switch

Conveyor with End-of-Line Limit Switch Stop

LIMIT

The problem: a conveyor runs forward when the operator presses START. When a part reaches the end-of-line limit switch, the conveyor stops automatically. The operator can clear the part and press START again to keep going, or press STOP at any time.

Inputs & Outputs

INPUTS

I:1/0 — START (NO)

I:1/1 — STOP (NC)

I:1/2 — End-of-line limit (NO, 1 = part present)

OUTPUT

O:2/0 — Conveyor motor

Ladder Diagram

L1 L2 000 XIC I:1/0 Start O:2/0 seal I:1/1 Stop I:1/2 XIO · LS O:2/0 OTE · Conv

The XIO of the limit switch sits in series — when the part trips the limit, the rung breaks.

How it works

Standard seal-in motor rung, with one extra contact: an XIO of the limit switch. The limit is wired NO, so when the part is not present, the bit is 0 and the XIO passes power. When the part rolls onto the limit, the bit becomes 1 and the XIO blocks — conveyor stops. The seal-in latch also drops, so the operator must press START again to continue.

What we learned: a sensor that should “stop” something goes in as an XIO in the rung — its 1 means “present/triggered” and we want that to break the rung, not pass it. The opposite (XIC) would mean “the conveyor only runs when the part is present”, which is the wrong logic.
05

PLC Program · Inductive proximity sensor

Bottle-Cap Detection with Bypass and Latch

PROX + OTL

The problem: a bottling line uses an inductive proximity sensor to detect when each metal bottle cap is positioned at the labelling station. The sensor sets an “OK to label” signal that the labelling head later resets when the label has been applied. A maintenance bypass switch lets the operator manually force OK_To_Label for setup work.

Inputs & Outputs

INPUTS

I:1/0 — Proximity (1 = cap detected)

I:1/1 — Label-applied signal (momentary)

I:1/2 — Bypass switch (maintained)

OUTPUT

O:2/0 — OK_To_Label

Ladder Diagram (Two Rungs)

L1 L2 000 XIC I:1/0 Prox XIC I:1/2 Bypass L O:2/0 OTL 001 XIC · Label-done I:1/1 U O:2/0 OTU

Rung 0 sets the latch when the prox sees a cap OR the bypass switch is on. Rung 1 unlatches when the labeller signals “done”.

How it works

Two rungs, classic OTL/OTU pair. Rung 0 fires (latching O:2/0) on either of two conditions: the proximity sensor seeing a metal cap, OR the maintenance bypass being on. Once latched, the labelling station knows it can proceed. When the labeller has finished and pulses its “label-applied” output, rung 1’s XIC of I:1/1 becomes momentarily true and OTU clears the latch — ready for the next cap.

What we learned: when a sensor fires only briefly (a part going past), use OTL to latch the detection. A separate “completion” or “ack” signal then OTUs the latch. The bypass branch is a nice pattern too — a parallel XIC of a maintenance switch lets you simulate the sensor without rewiring anything.
06

PLC Program · Photoelectric safety

Through-Beam Light Curtain — Cell Stop with Fault Latch

SAFETY

The problem: a through-beam photoelectric sensor is mounted across a robot work cell. While the beam is intact (1), the cell may run. If the beam is broken (0), the cell stops and a fault is latched — meaning the cell stays stopped even after the beam is restored. To clear the fault, the operator must press RESET while the beam is intact. Then a separate START button restarts the cell.

Inputs & Outputs

INPUTS

I:1/0 — Beam OK (1 = intact)

I:1/1 — RESET (NO momentary)

I:1/2 — START (NO momentary)

OUTPUTS

B3:0/0 — Fault_Latched (internal)

O:2/0 — Cell_Run

Ladder Diagram (Three Rungs)

L1 L2 000 XIO · Beam I:1/0 L B3:0/0 OTL · Fault 001 Reset I:1/1 Beam I:1/0 U B3:0/0 OTU 002 Start I:1/2 O:2/0 seal XIO Fault B3:0/0 Beam I:1/0 O:2/0 OTE · Cell

SET fault on beam break, CLEAR fault when RESET + beam intact, RUN cell with both interlocks in series.

How it works

  1. Beam intact, fault clear: rung 0’s XIO blocks (beam = 1), so OTL doesn’t fire. Operator can press START to start the cell.
  2. Beam breaks: rung 0 fires. B3:0/0 latches to 1. Rung 2 immediately drops the cell because the XIO of B3:0/0 blocks. The beam being intact again does not restart the cell — the latch holds.
  3. Operator clears the obstruction, presses RESET: rung 1 fires (RESET held + beam now intact). OTU clears B3:0/0 back to 0. Cell is now permitted to run, but won’t until START is pressed again to set the seal-in.
What we learned: a fault latch ensures a brief safety violation leads to a sustained shutdown that requires deliberate operator action to clear. This is the model for every guarded cell, light curtain, area scanner, or interlock door in industry. Always pair the latch with a deliberate two-step recovery: RESET to clear, START to run.
07

PLC Program · Float switches

Tank Fill Pump with Low/High Float Switches

LEVEL

The problem: a transfer pump fills a tank from a sump. Two float switches sit in the tank: LL (low level) and HL (high level). When level falls below LL, the pump runs. When level reaches HL, the pump stops. Between LL and HL, the pump continues whatever it was doing — that’s the deadband, and it’s exactly the seal-in pattern.

Inputs & Outputs

INPUTS

I:1/0 — LL float (1 = below low)

I:1/1 — HL float (1 = above high)

OUTPUT

O:2/0 — Fill pump

Ladder Diagram

L1 L2 000 XIC I:1/0 LL O:2/0 seal XIO · HL I:1/1 O:2/0 OTE · Pump

LL is the trigger to start; HL is the kill. Between them the pump seals itself in.

How it works

Classic two-float “level control with deadband”. When level drops below LL, the LL float makes its bit 1, the top branch passes power, and the pump starts (HL is still 0, so the XIO of HL passes too). The pump fills the tank. The seal-in branch keeps the pump running even as level rises past LL — until level finally reaches HL and the XIO of HL blocks. Pump stops. Level falls; pump won’t restart until LL fires again. Pure hysteresis using two discrete sensors instead of one analog reading.

What we learned: two discrete level switches and a seal-in branch implement hysteretic level control without any analog input or comparator instructions. The pattern works just as well for pressure (low/high pressure switches) or temperature (low-temp/high-temp switches).
08

PLC Program · Pressure switch

Air Compressor — Cut-In and Cut-Out Pressure Switches

PRESSURE

The problem: an air compressor maintains receiver tank pressure between 80 PSI (cut-in) and 100 PSI (cut-out). Two pressure switches: PSL closes (1) below 80 PSI, PSH closes (1) above 100 PSI. The compressor runs whenever the tank needs filling. A manual STOP overrides everything.

Inputs & Outputs

INPUTS

I:1/0 — PSL (1 = below 80 PSI)

I:1/1 — PSH (1 = above 100 PSI)

I:1/2 — STOP (NC)

OUTPUT

O:2/0 — Compressor motor

Ladder Diagram

L1 L2 000 XIC · PSL I:1/0 O:2/0 seal XIO · PSH I:1/1 Stop (NC) I:1/2 O:2/0 OTE · Comp

PSL kicks the cycle off, the seal-in keeps it going, PSH kills it at the upper limit, STOP shuts it down at any time.

How it works

Same hysteresis structure as the float-switch program, with one extra safety contact at the end: an XIC of the NC stop button. PSL kicks the compressor on at 80 PSI; the seal-in keeps it running until PSH kills it at 100 PSI. Stop button can shut it down at any time. The compressor cycles between 80 and 100 PSI without chatter.

What we learned: the same two-switch hysteresis pattern works for any process variable that has dedicated low and high switches — pressure, level, temperature, weight. Add an NC stop in series for manual override.
09

PLC Program · Methodology

Converting a Relay Schematic to a Ladder Program

SCHEMATIC

The problem: you’ve inherited the original relay schematic for a three-wire motor starter and need to replace the relay panel with a PLC. Convert the schematic to ladder logic, rung by rung.

Step-by-Step Conversion

  1. Identify each device. STOP (NC pushbutton), START (NO pushbutton), M aux (NO contact of M coil), OL (NC overload contact), M (relay coil).
  2. Assign PLC addresses. STOP → I:1/0, START → I:1/1, OL → I:1/2, M coil → O:2/0. The M aux contact references the same bit as the M coil — that’s how seal-in works in the PLC.
  3. Translate each element. STOP (NC, wired) → XIC I:1/0. START (NO) and M aux (NO) form a parallel branch — both XIC. OL (NC, wired) → XIC I:1/2. M coil → OTE O:2/0.
  4. Wire them up. STOP in series with the parallel branch (START parallel with M aux), then OL, then OTE. Same shape as the schematic.

Resulting Ladder Program

L1 L2 000 I:1/0 Stop I:1/1 Start O:2/0 seal I:1/2 OL O:2/0 OTE · M

The relay schematic, now in PLC ladder logic. Element-for-element conversion from the table in Section 6.10.

What we learned: conversion from relay schematic to ladder is mechanical once you have the mapping table. The relay schematic is almost ladder logic already — the PLC just gives you a software representation of the same circuit. The real engineering work goes into the I/O list and the wiring; the program itself is a near-copy of the original drawing.
10

PLC Program · Methodology

Writing Ladder Logic from a Narrative — A Garage Door

NARRATIVE

The narrative (from the customer):

“A factory roller door has UP and DOWN push-buttons, plus an UP limit switch (closed when door is fully open) and a DOWN limit switch (closed when door is fully closed). Pressing UP raises the door until the UP limit is reached. Pressing DOWN lowers it until the DOWN limit is reached. STOP halts the door at any point. The UP and DOWN motors must never run simultaneously — software interlock plus hardwired contactor interlock.”

Step 1 — Inputs & Outputs

INPUTS

I:1/0 — UP push-button (NO momentary)

I:1/1 — DOWN push-button (NO momentary)

I:1/2 — STOP push-button (NC)

I:1/3 — UP limit (NO, 1 = door fully up)

I:1/4 — DOWN limit (NO, 1 = door fully down)

OUTPUTS

O:2/0 — UP motor contactor

O:2/1 — DOWN motor contactor

Step 2 — Boolean expressions in plain English

UP motor runs when: (UP button just pressed OR UP motor already running) AND STOP not pressed AND UP limit not reached AND DOWN motor is off.

DOWN motor runs when: (DOWN button just pressed OR DOWN motor already running) AND STOP not pressed AND DOWN limit not reached AND UP motor is off.

Step 3 — Two seal-in rungs with cross-interlock

L1 L2 000 I:1/0 UP PB O:2/0 seal I:1/2 Stop I:1/3 UP-LS O:2/1 XIO DN O:2/0 OTE · UP 001 I:1/1 DN PB O:2/1 seal I:1/2 Stop I:1/4 DN-LS O:2/0 XIO UP O:2/1 OTE · DN

Two near-identical seal-in rungs. Each one’s interlock XIO points to the other direction’s output.

How it works

Rung 0 (UP): seal-in starts on UP push-button, holds until any of three things break the rung — STOP pressed, UP limit reached, or DOWN motor running. Rung 1 (DOWN) is structurally identical with directions swapped. The cross-interlock — XIO of O:2/1 in the UP rung, XIO of O:2/0 in the DOWN rung — means software cannot ever energise both motors at once. (For the contactor coil hardware, you also wire mechanical interlocks per Section 6.8.)

What we learned: the 5-step narrative-to-ladder process — list inputs, list outputs, write boolean expressions in English, translate to rungs, add safety — gives you a repeatable method that works on programs of any size. Two seal-in rungs with mutual XIO interlocks are the standard pattern for any “either/or” two-direction motor: hoists, doors, traverses, gates.

Common Student Mistakes

Things to watch out for in this chapter:

  • Driving a motor coil straight from a PLC output. The PLC’s output card cannot carry motor current. Always go through a contactor, and let the PLC switch the contactor’s small coil current.
  • Wiring a STOP button NO instead of NC. NO + XIC means a broken stop wire keeps the motor running — the opposite of what you want. Stops are always NC and tested with XIC.
  • Skipping the OL feedback into the PLC. Hardwiring the OL contact in series with the contactor coil is mandatory, but bringing it into a PLC input as well is what gives you alarms, history, and remote indication.
  • Confusing “NO sensor” with “NO ladder instruction”. The wiring style of the field device (NO or NC) determines the rest-state of the input bit. The ladder instruction (XIC or XIO) you choose is then a software decision based on the bit value you want to test for.
  • Forgetting the cross-interlock on forward/reverse drives. Software interlock alone isn’t enough at high power — always combine the XIO interlock with mechanical contactor interlocks at the panel.
  • Treating P&ID symbols as decoration. Every bubble on the P&ID becomes one row of the I/O list. If a bubble has no PLC tag, you’ve missed an instrument — find it on day 1, not on commissioning day.
  • Writing ladder before the I/O list. Inputs first, outputs second, then logic. Engineers who skip the I/O list end up with rungs that reference made-up addresses and have to be reworked.

Quick Recap

The ten things to take away from Chapter 6:

  • A control relay handles small loads. A contactor handles motor-class current. A motor starter is a contactor with thermal overload protection added.
  • Manually operated switches: pushbutton, selector, drum. Mechanically operated: limit, foot.
  • The eight common sensor types — inductive, capacitive, magnetic reed, photoelectric, ultrasonic, load cell, temperature (RTD/thermocouple), flow/position.
  • The PLC never drives motors directly — always through an intermediary contactor sized for the load.
  • Stop buttons are wired NC and tested with XIC — fail-safe under both pressed and broken-wire conditions.
  • Seal-in latches a momentary input. Interlock prevents two outputs from being on at once. Latching remembers state across rungs (and sometimes power cycles).
  • Mechanical latching relays are still used for life-safety circuits because they hold their state without battery backup.
  • Schematic-to-ladder conversion is mechanical: NO contact → XIC, NC contact → XIO, coil → OTE, series → series, parallel → parallel.
  • Narrative-to-ladder uses a 5-step process: list inputs, list outputs, write boolean expressions in plain English, translate to rungs, add safety/fault rungs last.
  • P&ID instrument tags are read as “what is measured” + “what kind of device” — e.g. LSH-101 = Level Switch High loop 101, FT-220 = Flow Transmitter loop 220.

Review & Self-Assessment

Chapter 6 Review Questions

Try answering each question on your own first. Tap to reveal the answer when you’re done.

Q1What is the difference between a control relay, a contactor, and a motor starter?+
A control relay is a small electromagnet that switches small loads — pilot lamps, alarms, signal isolation — typically 5–10 A. A contactor is the same idea built much larger, with main contacts sized to switch motors and large heaters (10–600 A). A motor starter is a contactor with a thermal overload (OL) relay bolted onto its output side to protect the motor from sustained over-current.
Q2Why is the OL contact wired NC and tested with XIC, rather than NO with XIO?+
For fail-safe operation. NC + XIC means: if the OL trips, the bit goes to 0 and the rung breaks (motor stops). If the wire to the OL contact breaks, the bit also goes to 0 and the rung still breaks (motor still stops). Both fault modes shut the motor down — exactly what we want. NO + XIO would do the opposite: a broken wire would keep the motor running.
Q3When would you use a capacitive proximity sensor instead of an inductive one?+
Use capacitive when the target is not metal (plastic, water, grain, powders) or when you need to detect through a non-metal wall — for example, sensing the level of liquid through the side of a plastic tank. Inductive is the workhorse for detecting metal targets directly: it’s cheaper, more rugged, and less affected by dust or moisture.
Q4What are the three common variants of photoelectric sensor and what’s the trade-off between them?+
Through-beam uses separate emitter and receiver — most reliable, longest range (up to 50 m), but needs both halves wired. Retroreflective bounces the beam off a corner-cube reflector — simpler wiring, medium range. Diffuse looks at light bouncing off the target itself — easiest to install, but range and reliability depend on the target’s colour and finish.
Q5List three reasons why a PLC must always drive motors through a contactor instead of directly.+
(1) Current rating: the PLC output card handles 1–2 A; motors draw tens or hundreds of amps. (2) Voltage isolation: the contactor isolates the high-power motor circuit from the PLC’s 24 V control voltage, protecting the CPU from faults. (3) Inrush current: motors draw 6–10× their running current at startup; only a contactor can handle that surge.
Q6In what way does a hardware “latching relay” differ from a regular control relay, and when would you choose one?+
A latching relay has two coils — set and reset — and a mechanical detent that holds the contacts in their current position even after the coil is de-energised. A regular control relay’s contacts spring back open the instant power is removed. Use a latching relay when the circuit must remember its state across power loss without needing a battery — typically for fail-safe shutdowns and emergency-stop circuits where regulators require the tripped state to persist.
Q7Convert this relay element to a ladder logic instruction: an NC auxiliary contact of relay CR3 is wired in series with a motor starter coil M.+
An NC contact of an internal relay maps to XIO of the corresponding internal bit. So CR3-NC in series with M coil becomes a rung that has XIO B3:0/2 (CR3 internal bit) feeding into OTE O:2/0 (M coil). When CR3 is energised, the XIO blocks and M drops; when CR3 is de-energised, the XIO passes and M can run.
Q8A narrative says “the conveyor must run only when the safety guard is closed AND the operator is pressing the start button.” Write the boolean expression and the ladder rung.+
Boolean: O:2/0 = I:1/0 · I:1/1 where I:1/0 is “guard closed” and I:1/1 is “start button”. Ladder: two XIC contacts in series driving an OTE — guard contact, start contact, then the conveyor coil. No seal-in (operator must keep holding the button — this is “jog” mode). Add a STOP/E-stop in series for safety per Section 6.8.
Q9Decode this P&ID tag: LSH-104.+
L = Level (what’s measured). S = Switch (kind of device). H = High (modifier). 104 = loop number. So LSH-104 is “Level Switch, High, loop 104” — a discrete sensor that closes when the level in vessel 104 rises too high. In the I/O list this becomes a discrete input (NO or NC depending on safety convention).
Q10Sketch (in words) how a software interlock between forward and reverse motor outputs is implemented in ladder.+
Each direction’s seal-in rung includes an XIO of the opposite direction’s output bit. The forward rung has XIO O:2/1 (REV) in series with everything else; the reverse rung has XIO O:2/0 (FWD). If REV is on, the FWD rung is blocked, and vice versa. This makes it impossible for both outputs to energise at once. For high-power motors you also wire a mechanical interlock at the contactors themselves — never trust software alone for safety-critical exclusion.
Q11Why are the eight sensor types arranged in two groups (top four discrete, bottom four often analog)?+
The top four — inductive, capacitive, magnetic reed, photoelectric — produce a clean on/off signal: target is either there or it isn’t. They wire to discrete inputs. The bottom four — ultrasonic, load cell, temperature, flow — produce a continuous value (4–20 mA, mV/V, pulse train). They wire to analog or specialty input modules. The split tells you what kind of PLC input card to budget for during panel design.
Q12Write down the five steps of the narrative-to-ladder process.+
(1) List every input device (pushbuttons, sensors, limit switches, selector positions) and assign each an input address. (2) List every output device (motors, valves, lamps, alarms) and assign each an output address. (3) Write the boolean expression for each output in plain English (“Motor M1 is on when … AND … OR …”). (4) Translate each expression into a ladder rung using series for AND, parallel for OR, XIO for NOT, and seal-in for momentary inputs. (5) Add safety, fault and reset rungs last — stop buttons, e-stops, fault latches, alarm acknowledge.

Need help wiring a panel or writing your first ladder program from a customer narrative?

Get one-on-one tutoring or project guidance from Dr Ahsan Rahman — Head of Electrical Engineering, with two decades of teaching panel design and PLC commissioning.

Request Consultation →