Skip to content
Tutorials Center
My learning

Topics

Lesson 30 of 37 ยท Safety and Troubleshooting

PLC Safety Fundamentals - E-Stop, SIL and Safe Design

Learn machine safety basics for PLC engineers: risk assessment, emergency stop, interlocks, safety PLCs, SIL and PL, fail-safe design and a runnable C model of a two-channel monitor.

A machine that works is not enough; it must also be safe. A press, a conveyor or a robot cell can injure or kill, and the law in most countries holds employers and manufacturers responsible. Safety is a discipline of its own, with standards, certified components and strict methods. This lesson is an introduction for PLC programmers: it explains the principles and vocabulary, not a substitute for training, standards or a qualified safety engineer.

The code here is educational. Never use any example on this site as a real safety function.

No safety hardware is available on this site. Concepts are explained in text and diagrams, and C stand-ins model the ideas (dual-channel monitoring and fail-safe behavior).

Safety is separate from control

The standard control program decides how the machine does its job. The safety function decides when it must stop and prevents dangerous movement. The two have different design rules:

  • Safety functions must work even if the standard PLC program is wrong. Never rely on ordinary logic, the HMI, or a software flag for protection.
  • Safety components are certified and designed so that a fault leads to a safe state.
flowchart LR
    A["Hazard identified"] --> B["Risk assessment"]
    B --> C["Reduce by design"]
    C --> D["Safeguards<br/>(guards, light curtains, E-stop)"]
    D --> E["Verify and validate"]
    E --> F["Information for use<br/>(signs, training)"]

Order of preference: remove the hazard, then guard it, then warn about what remains.

Risk assessment

Before choosing a solution you assess the risk: how severe could the injury be, how often is a person exposed, and how likely can the hazard be avoided? Standards (ISO 12100, ISO 13849-1, IEC 62061) give methods. The result is a required performance level (PL a to e) under ISO 13849 or safety integrity level (SIL 1 to 3) under IEC 62061 / IEC 61508 for each safety function. Higher levels mean a lower probability of dangerous failure and stricter hardware and software requirements.

Common safety devices

  • Emergency stop (E-stop). A red mushroom button on a yellow background, latching, with positive-opening (forced) contacts. It is a complementary measure, not a substitute for guarding.
  • Interlocked guard. A gate switch that must be closed for the machine to run; opening it stops hazardous movement.
  • Light curtain. Infrared beams that detect a person's hand or body entering a zone.
  • Safety mat, laser scanner, two-hand control, enabling switch. For specific tasks and zones.
  • Safety relay or safety PLC. Evaluates the safety inputs and cuts power to the actuators through safe outputs and redundant contactors.

Safety logic is often done in a safety PLC (for example fail-safe CPUs from several vendors) that runs a certified safety program next to the standard program, with dedicated function blocks for E-stop, gate monitoring and muting.

Fail-safe principles

  1. De-energize to trip. A wire or button should be arranged so that losing power, breaking the wire or releasing a spring gives the safe state (the machine stops). A normally closed E-stop contact opens when pressed or when the wire is cut.
  2. Redundancy. Two independent channels, each able to cause the stop.
  3. Diversity and cross-monitoring. Channels are compared; if they disagree for longer than a short time, the system faults.
  4. Fault detection. Welded contactor contacts or shorted wires are detected by feedback loops ("monitored start") and test pulses.
  5. Manual reset. After an E-stop is released, the machine must not restart by itself. A deliberate reset is required.

Modelling a two-channel E-stop

This C stand-in reads both channels of an E-stop. Both must be closed (true) to allow running. If the channels disagree for more than a tolerance time, a discrepancy fault latches. A reset is required after any stop.

C C stand-in: dual-channel E-stop monitor with manual reset

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Releasing the button at t=8 does not restart the machine: it waits until the reset at t=10.

Now a discrepancy. A wire to one channel breaks while the other stays closed:

C C stand-in: channel mismatch becomes a latched fault

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

The machine stops immediately at t=3 (one channel opened), and the latched fault tells maintenance a channel is defective, rather than the E-stop quietly becoming a single-channel device.

Programming rules for the standard side

  • Do not bypass safety in software. No forced values, no "maintenance mode" that disables protection unless it is a designed, certified function.
  • Treat safety status as input only. The standard program can read "guard open" to display it and stop gracefully, but it cannot override it.
  • Stop categories. Category 0 cuts power immediately; category 1 brakes and then cuts power; category 2 stops under control and keeps power. The safety assessment chooses the category.
  • Document and validate. Changes to the safety program need re-validation and a signature.
  • Guard against restart. After power-up or a stop, require a manual start with a rising edge.

Faults of other kinds are handled in fault handling and watchdogs; safety-related ones follow the rules above.

Cybersecurity is safety too

A networked controller can be attacked. Basic measures: network segmentation, firewalls, disabling unused services, strong passwords, access control to the programming port, a physical key switch for run/program mode, and backups. Standards such as IEC 62443 give a framework.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why does an E-stop use normally closed contacts?

    De-energize-to-trip: any wire break opens the circuit and stops the machine, so failures end in the safe state.
  2. 2. After an E-stop button is released, what should happen?

    Unexpected restart is a hazard. A manual reset is required.
  3. 3. What is the purpose of two channels in a safety input?

    Redundancy with cross-monitoring makes the function tolerant of a single fault and exposes dangerous failures.
  4. 4. Which is the preferred order for reducing risk?

    Inherently safe design comes first; guards and protective devices second; information for use last.

Summary

  • Safety functions are separate from control, certified, and designed to fail safe.
  • Risk assessment sets the required PL or SIL; safeguards include guards, light curtains and E-stops.
  • Use de-energize-to-trip wiring, redundancy, cross-monitoring, fault detection and manual reset.
  • Never bypass safety in the standard program; add cybersecurity measures.
  • The C programs are educational stand-ins, not safety code.

Next: PLC Fault Handling and Watchdogs