PLC installation and commissioning
A well-programmed controller is useless if it is badly installed. A very large share of the faults in a new machine are not in the program but in the mounting, the power supply, a reversed polarity or a badly connected shield. This page follows the real path of a control panel: where it is mounted, how it is powered, how inputs and outputs are wired, how it is switched on for the first time, how the program is saved and how it is maintained.
01Mounting in the panel
The structure of the modules, the memory and the addressing are explained in Structure of a programmable controller; here the focus is what it takes to install them. The layout of the panel determines the working temperature, the noise the signals pick up and how easy maintenance is, and it is the one thing that cannot be fixed later with software.
- 35 mm DIN rail (IEC/EN 60715), screwed to the mounting plate every few centimetres: a rail that vibrates loosens everything on it.
- Metal mounting plate bonded to PE; the rail makes electrical contact with it through screws and washers that bite through paint or zinc plating.
- The PLC modules snap onto the rail and connect to each other through the backplane bus or connectors: they are assembled from left to right in the order of the configuration, with no gaps.
- Normal position: horizontal, with the ventilation slots at the top and bottom. Mounted vertically, the permitted temperature range is usually reduced: the manual says so.
- Leave free air above and below the PLC (in the order of 25 to 50 mm, or whatever the manual says) and keep the distance to ducts and other devices.
- The temperature limit (usually up to about 55 °C) refers to the air around the PLC inside the panel, not to the air in the room.
- Anything that produces heat —supply, drive, braking resistors, transformers— goes apart and never below the PLC, because hot air rises.
- Reserve space and free terminals (20 to 30 %): something always gets added.
- If the environment is dusty or damp, the IP protection rating of the enclosure and the ventilation filters are part of the installation.
Contactors, drives and motors generate fields and spikes that couple into nearby cables. A 24 V or 4-20 mA signal running alongside a power cable reaches the PLC full of noise. The rules are few: separate ducts for power, control and analog or data signals; a distance of 10 cm or more between them as a general criterion (the PLC manufacturer gives its own); if they have to cross, at 90°; shielded cable for analog and communication signals, and shielded cable also between the drive and the motor (Variable-speed drives). Terminal discipline, labelling and ferrules are covered in Control and signalling units.
In the power part, the AEA code is followed: neutral light blue, protective conductor green-yellow, phases brown, black and red. In DC control circuits blue is usual (IEC 60204-1). Beware: the blue of DC control and the light blue of the AC neutral look alike; that is why labelling at both ends matters more than colour.
A control panel has 230 or 400 V a few centimetres from the PLC modules. All mounting and wiring is done with the main isolator open, locked out and tagged, and with the absence of voltage verified with an instrument (procedure in Health and safety).
02Power supply and earthing
A panel with a PLC contains three circuits with different needs: the electronics (CPU and modules), the sensors and inputs, and the outputs with their loads. They are fed from a 24 V DC supply, and it pays to protect them separately so that a short circuit in a solenoid valve does not leave the CPU without power.
- Switch-mode and regulated, with safe isolation between the mains and the secondary (safety extra-low voltage, called MBTS/MBTP in AEA 90364 terminology).
- With a margin over the calculation, and with the voltage set to 24 V on the supply’s potentiometer.
- If the supply delivers less current at high temperature, the derating curve of the data sheet is used, not the nameplate value.
- Mounted apart from the PLC (it produces heat) and with its own short, thick wiring to the power terminals.
- Primary: a miniature circuit breaker of the rating the supply manufacturer specifies, generally curve C because of the supply’s inrush current (see Electrical protection).
- Secondary: a fuse or breaker per branch (CPU, sensors, each group of outputs), rated below what the conductor can carry.
- This way, a fault in one branch trips its own protection and the rest stays energised: the PLC logs it and raises an alarm instead of shutting down.
How to size the supply
Add up the currents of everything fed from the 24 V terminals in the worst case, that is, with everything running at once, and add a margin for expansion, ageing and temperature (25 % is a reasonable value).
A PLC with 12 digital inputs in use, 12 three-wire inductive sensors, 2 4-20 mA transmitters, one analog module, two digital I/O modules, 6 solenoid valves of 24 V and 3 W, 4 interface relays and 5 LED pilot lights. The values for each module come from its data sheet (those used here are representative).
| Consumer | Quantity | Unit current | Subtotal |
|---|---|---|---|
| CPU (24 V supply) | 1 | 0.300 A | 0.300 A |
| Digital modules (own consumption) | 2 | 0.040 A | 0.080 A |
| Analog module | 1 | 0.100 A | 0.100 A |
| Active digital inputs (input consumption) | 12 | 0.004 A | 0.048 A |
| Three-wire inductive sensors (own consumption) | 12 | 0.015 A | 0.180 A |
| 4-20 mA transmitters (loop maximum) | 2 | 0.020 A | 0.040 A |
| 24 V, 3 W solenoid valves (3 W / 24 V = 0.125 A) | 6 | 0.125 A | 0.750 A |
| Interface relays (coils) | 4 | 0.040 A | 0.160 A |
| 24 V LED pilot lights | 5 | 0.020 A | 0.100 A |
| Total current in the worst case | 1.758 A | ||
A supply of at least 2.20 A is needed, so the next commercial value up is chosen:
A 24 V / 2.5 A (60 W) supply covers the demand with the required margin. Each individual output (0.125 A) is also far from the channel limit, which in a transistor module is usually around 0.5 A. The calculation is conservative because it assumes all six solenoid valves energised at the same time; if the process logic never turns them all on together the real demand is lower, but the margin is kept.
Earthing: three different things
| What it is | What it connects to | What it is for |
|---|---|---|
| Protective earth (PE) | Mounting plate, DIN rail, doors and enclosures, machine frames. | Personal safety: if a phase touches an exposed part, the protective conductor lets the protection open the circuit. Size and continuity according to AEA 90364. |
| Functional earth (FE) | Shields of the shielded cables, mains filters, the “clean earth” terminals of the PLC and the supply. | Draining high-frequency noise. Connected with a short, wide conductor (braid or 360° clamp) to the plate or the shield bar. |
| 0 V of the 24 V supply | Bonded to PE at a single point, or left floating with earth-fault monitoring, according to the project criterion. | Sets the reference potential of the whole 24 V circuit. Two bonds to PE at different points form a loop through which noise currents circulate. |
Almost all “mysterious” noise problems come from multiple, accidental earth connections: a shield touching the machine frame at another point, a 0 V bonded to PE at two terminals. Draw an earthing diagram before wiring and stick to it.
03Wiring the inputs
The characteristics of each input type (optical isolation, filter, thresholds, resolution) are in Structure of a programmable controller. Here we deal with the wiring, which is where mistakes are made.
Digital inputs: PNP and NPN sensors
A pushbutton, a limit switch or an auxiliary contact is a dry contact: it works with any module, and the “common” is connected to whichever terminal applies. Three-wire proximity sensors (inductive, capacitive, photoelectric) have an output transistor that can be of two types, and which one it is determines how the module’s common has to be wired.
| Sensor | On detection, the output… | Module common | Name of the module |
|---|---|---|---|
| PNP (switched positive) | delivers +24 V to the input | to 0 V | sinking input: drains the current to the common |
| NPN (switched negative) | takes it to 0 V | to +24 V | sourcing input: supplies the current to the input |
In North American literature these terms describe the module’s input, as in the table; in other manuals they are applied to the sensor, and then a PNP sensor is “sourcing” (it supplies current). The confusion is common. Do not settle it by name but by polarity: measure with the multimeter between the sensor output and 0 V, with the sensor powered and detecting. If it reads almost 24 V it is PNP; if it reads almost 0 V (and 24 V when not detecting) it is NPN. Many European modules come with the common at 0 V and expect PNP sensors; NPN is frequent in equipment of Asian origin.
- Do not mix PNP and NPN sensors in the same input group with a shared common: half of them would be always on or never on.
- An electronic two-wire sensor has a residual current (one or two milliamps) that may be enough to keep the input at one. If that happens, a resistor is added in parallel with the input, as the manufacturer indicates.
- Stop pushbuttons and mushroom heads are wired normally closed (see Control and signalling): a broken wire looks like a stop, and that is the safe way.
- The 24 V that powers the sensors comes from the same supply as the input common. A sensor powered from another supply needs the 0 V of both tied together.
Analog inputs: the 4-20 mA loop
The 4 to 20 mA current is the standard for industrial transmitters because it is not affected by the resistance of the cable. It is connected in two ways depending on how the transmitter is powered.
- Two-wire transmitter (loop-powered): the transmitter behaves like a current source in series. It needs a minimum voltage across its terminals (usually 10 to 12 V) to work.
- Three-wire transmitter (with its own power): two conductors go to +24 V and 0 V and the third delivers the signal. The 0 V of the supply and the common of the input must be the same potential.
- The module must be configured for current (by jumpers or by software): a 0-10 V input that receives 4-20 mA reads wrongly and may be damaged. When the loop passes through several devices with different earths, a loop isolator is used (see Control and signalling).
- Shielding: twisted-pair cable with a braid, the braid grounded to functional earth at one end only, the panel end. At the transmitter end the braid is cut back and insulated. With both ends grounded, the potential difference between the two earths drives a current through the braid and turns it into an antenna. Some manufacturers allow the other end to be connected as well, through a capacitor, but this is only done when they say so.
A 24 V supply feeds a two-wire transmitter that needs a minimum of 12 V across its terminals, connected to a module with a 250 Ω measuring resistor. First, the voltage the module measures at the ends of the range:
With the maximum current of 20 mA, the total resistance the loop admits is the one that uses up the available voltage (24 V − 12 V):
Of those 600 Ω, the module already takes 250 Ω; the cable can have at most:
A 0.5 mm² copper cable has, per conductor, 0.0175 Ω·mm²/m / 0.5 mm² = 0.035 Ω/m. For a transmitter 500 m from the panel, the go and return are 1 000 m:
The cable uses 35 Ω of the 350 Ω available, and 18.3 V reaches the transmitter, more than the 12 V it needs. The current is the same at both ends of the cable, which is why the module reads correctly in spite of the cable resistance. That is why 4-20 mA tolerates long cables: the cable resistance only takes voltage away from the transmitter and does not change the current the module reads.
04Wiring the outputs
Outputs are one of the parts of the PLC that suffer most: they switch current, and inductive loads (contactor, relay and solenoid-valve coils) give it back with interest when they open. The output types are compared in Structure of a programmable controller; here, what to check and what to add when connecting them.
| Before connecting a load, check | Why |
|---|---|
| Voltage and type of the output (DC or AC) against the load | A transistor output only switches DC; a triac output, only AC; a relay output works for both. |
| Current per channel and per group | The total current of a group is lower than the sum of the individual maxima: it is in the data sheet. |
| Inductive or capacitive load | A relay contact’s capacity for coils is lower than for a resistor (utilisation categories AC-15 and DC-13 of IEC 60947-5-1). Incandescent lamps and switch-mode supplies have an inrush current far above the rated one. |
| Protection per group | One fuse per output group keeps a short circuit in the field from taking out the whole module. |
| Safe state | What the load does when the output opens or the PLC stops. The safe thing is for the machine to stop: energise to run, de-energise to stop. |
Inductive loads: suppression
A coil stores magnetic energy while current flows. When the circuit opens, that current cannot stop instantly: the coil generates whatever voltage it takes —hundreds of volts— to keep it going, and this voltage appears across the output terminals. On a transistor it causes immediate failure or progressive wear; on a relay contact, an arc that erodes it.
- A diode in anti-parallel with the coil: the cathode (the bar) on the positive side, the anode on the 0 V side. In normal operation it is reverse-biased and does not conduct.
- It goes as close to the coil as possible, not at the module: that keeps the loop of the recirculating current short.
- A 1N4007 is enough for small and medium 24 V coils. If it is fitted the wrong way round, it is a short circuit.
- Side effect: the coil de-energises more slowly, because the current decays through the diode. A relay or valve may take too long to release; if that matters, a zener is added in series with the diode.
- In AC there is no polarity to exploit: a resistor and a capacitor in series are placed in parallel with the coil, or a varistor (MOV).
- Many contactor manufacturers sell the snubber module that snaps onto the coil itself, with values calculated for it. Use it instead of improvising values.
- Typical values for an RC snubber on a 230 V coil are in the order of a hundred ohms and a hundred nanofarads, with an X2-class capacitor.
- With a relay output that switches often or carries high current, an interposing relay or a contactor is better: the PLC output commands, it does not power.
A motor, a heating element or a pump is switched by a contactor whose coil does hang from the output. Starting energy and short circuits are the business of the contactor and of the protection of the power circuit (Electrical protection). The emergency stop and safety interlocks are also wired in hardware, not only in the program.
05Commissioning step by step
Order matters: you go from what has no voltage to what has, and from what moves nothing to what moves. Each step has an acceptance criterion; if it is not met, you do not move on.
| Step | What is done | Acceptance criterion |
|---|---|---|
| 1 | Review and documentation. With the drawing, the I/O list and the program at hand: visual inspection of terminals, labels, ferrules and fuses. | Every conductor labelled as in the drawing; no loose wire or empty terminal without explanation. |
| 2 | Checks with no voltage. PE continuity, every field conductor end to end, no short circuit between +24 V and 0 V (with the ohmmeter, supply isolated from the circuit). Insulation of the power circuits is measured with a megohmmeter only with the modules and electronics disconnected. | PE continuous; no short circuit between +24 V and 0 V (the reading does not go to zero); no leakage to earth. |
| 3 | Energise the supply alone, with the output and sensor fuses open. Measure the voltage at the PLC terminals, not at the supply’s. | 24 V ± 5 % (22.8 to 25.2 V) and stable as each branch is connected. |
| 4 | Energise the PLC with the CPU in STOP and outputs disabled, if the device allows it. | Power and STOP LEDs on; no fault LED. |
| 5 | Input test. Operate every sensor, pushbutton and limit switch by hand; simulate the analog inputs with a loop calibrator at 4, 12 and 20 mA. | The module LED, the bit in the software and the drawing agree. Analog: 4 mA reads 0 %, 12 mA 50 %, 20 mA 100 %. |
| 6 | Forced-output test, with the actuator power open or the loads disconnected: force each output one at a time and check what it activates. Then, with the area clear and a warning given, repeat with power. | Each output drives the load the drawing shows and no other. At the end all forces are removed. |
| 7 | Program download. With the CPU in STOP, first save a copy of the program in the device, download the new one and compare the device version with the file. | The online comparison shows no differences; version noted in the log. |
| 8 | No-load test. Go to RUN with the actuator power open. Run through the sequence simulating the inputs; test the emergency stop, a sensor failure and a cut 4-20 mA loop. | The sequence matches the specification and each fault leads to a safe state. |
| 9 | Test with load. Close the power one actuator at a time, measuring currents and times with the equipment in service. | Currents within what was calculated, no protection trips, scan time measured and noted. |
| 10 | Handover. Final copy of the program, drawings updated with site changes, list of settings and commissioning report. | The copy is stored in two places and the form is signed. |
Before forcing: the area clear, a warning to anyone nearby, the emergency stop within reach and the actuator able to move without damage (a cylinder is not forced against a stop, a motor is not started without knowing its direction of rotation). One output is forced at a time. An input that is part of a safety circuit is never forced. And in many devices the forced value stays active even if the software is closed or the CPU goes to STOP: check the force table at the end.
06Program backup and maintenance
Where the program lives and how it is saved
The CPU keeps the program in a non-volatile load memory (flash or memory card); what it executes, together with process data, is in working memory. Retentive variables and the clock depend on a capacitor or on a backup battery (memory and retentive area). The program in the device is not a backup: if the CPU breaks, it is lost with it.
| What is saved | What it is for |
|---|---|
| The complete project (with symbols and comments), not just the binary | A program without symbolic names or comments is almost impossible to maintain. |
| Hardware configuration and network addresses | To replace the CPU or a module and have the system start up the same way again. |
| Parameters of drives, panels (HMI) and instruments | A drive without its parameters is a new device to configure. |
| Retentive values and recipes actually used in the process | What was tuned on site is not in the original project. |
| Software and firmware versions, and access levels | A project from a newer version may not open with the older one. |
Copy before touching anything and after every change, in at least two places (one outside the plant computer). Version in the file name, with the date: Packer_v1.4_2026-10-30, and a change log saying what was modified, by whom and why. Comparison online between the device and the file before downloading: “downloading” a program overwrites the one in the device. Documentation: I/O list, updated diagrams and the user manual at hand. Access passwords are kept in custody: neither left at the factory default nor held only in one person’s head.
Maintaining the controller
| Task | Frequency | What is checked |
|---|---|---|
| Backup battery | As the manufacturer says; date written on the device | The low-battery warning (LED or diagnostic bit). It is replaced with the CPU energised, or with the backup done, so as not to lose memory or clock. |
| Diagnostic LEDs | At every visit | State of the CPU and of the channels (next table). |
| 24 V voltage | Every six months | 24 V ± 5 % at the PLC terminals and stability under load. |
| Terminals, shields and earthing | Yearly | Re-tightening to torque and continuity of PE and of the shield bar. |
| Panel ventilation and filters | Every six months | Clean filters and inside temperature within the device range. |
| Program copy | After every change and once a year | That the copy matches the device. |
The rest of the plan, with torque-controlled re-tightening and thermography, is the one in Maintenance of electrical components.
| LED (typical names) | Usual meaning | What to do |
|---|---|---|
| RUN steady green | The CPU is running the program. | Nothing. |
| STOP yellow | The CPU is stopped. | Find out why: a command or a fault. |
| ERROR / SF red | System or module fault. | Read the diagnostic buffer with the software: it shows the module and the cause. |
| BF red | Bus or communication fault. | Check the cable, the termination and the addresses of the slaves. |
| Each channel LED | Real state of the input or output. | Compare it with the field: if the LED does not follow the sensor, the problem is before the module. |
Exact names and colours vary with the manufacturer: the reference is the device manual.
Log: every fault is recorded with date and time, symptom, LED and diagnostic code, cause, action taken and spare used. If the same module fails three times, the cause is usually outside it (supply, noise, missing suppression).
Replacement, in order: (1) stop the machine in a safe state and lock out the energy; (2) note the exact part number of the module and its version; (3) move the removable terminal blocks one at a time, without mixing them; (4) copy the jumpers or selectors of the old module to the new one; (5) energise and watch the LEDs; (6) load the configuration or program if needed; (7) test the module’s inputs and outputs as in commissioning; (8) write everything in the log. Swapping with the equipment energised is only done on systems that expressly allow it.
07In the laboratory
Materials: training PLC with a 24 V module, 24 V supply, one PNP and one NPN inductive sensor, multimeter. Steps: wire the PNP sensor first, with the module common at 0 V. With the sensor powered and the input disconnected, measure the voltage between the sensor output and 0 V with and without an object. Connect the input and check the LED and the bit. Repeat with the NPN sensor, moving the common to +24 V. Criterion: the PNP reads close to 24 V when detecting and close to 0 V with no object; the NPN, the opposite; in both cases the input LED lights only on detection. Try and explain what happens if the NPN is connected with the common at 0 V.
Materials: a 24 V relay or solenoid-valve coil, a transistor output or a switch, oscilloscope, 1N4007 diodes. Steps: at 24 V, open the output and capture the voltage across the coil without a diode (×10 probe and the scope ground on the circuit’s 0 V); repeat with the diode in anti-parallel and then with the diode reversed, only with a current-limited laboratory supply. Criterion: without the diode, a reverse voltage spike of tens or hundreds of volts; with the diode correctly fitted, the voltage at the output terminal does not go beyond about −0.7 V relative to 0 V; with the diode reversed, a short circuit shows. Also measure how long the contact takes to release with and without the diode.
Materials: loop calibrator (or a laboratory transmitter), analog module, multimeter with a current range, shielded cable. Steps: connect the two-wire loop and measure the current in series and the voltage across the measuring resistor; scale the reading to a variable (0 to 10 bar) and check 4, 8, 12, 16 and 20 mA. Cut the cable and observe the value. Program the detection: “reading below 3.6 mA → sensor fault”. Criterion: the reading follows the current with an error under 1 %; the program tells the zero of the variable (4 mA) from the cut cable (0 mA).
Materials: panel with PLC, supply, sensors and actuators, the ten-step form from section 05. Steps: follow the steps of the table in order, record every measurement and sign. The instructor introduces two wiring errors (a reversed sensor and a crossed output) that must be found with the checks and the input and output tests. Criterion: both errors found before closing the power, form complete, program copy verified and forces removed.
08Common mistakes
| Mistake | Consequence |
|---|---|
| Mixing PNP and NPN sensors on the same common | Inputs always on or never on. Solved by wiring each group with the type that applies. |
| Connecting a 4-20 mA signal to an input configured for 0-10 V (or the other way round) | Out-of-range reading, absurd values and sometimes a damaged input. |
| Leaving out the flyback diode on a DC coil, or fitting it reversed | Without it: spikes that damage the output, with intermittent faults and resets. Reversed: a short circuit. |
| A supply with no margin | Voltage dips and resets when several outputs switch on together. Faults that do not repeat when you look at them. |
| Shield grounded at both ends, or at neither | Currents in the braid or undrained noise: unstable analog readings. |
| Power and analog signal cables in the same duct | Coupled noise that no program can filter out later. |
| Energising everything at once, with no de-energised checks | A short circuit on the first connection or an actuator that moves when nobody expects it. |
| Leaving forced values on at the end of commissioning | An output that does not follow the program, or an input that hides a broken sensor. |
| Changing the program without copying the previous one first | If the change goes wrong, there is no way back. |
| Replacing the battery with the CPU off and no backup | Retentive variables, the clock and, in RAM-based devices, the program are lost. |
09Self-assessment
What is the module common tied to with PNP sensors and with NPN sensors, and why?
With PNP sensors the common goes to 0 V: the sensor delivers +24 V to the input and the current leaves through the common. With NPN sensors the common goes to +24 V: the sensor takes the input to 0 V, and the current enters through the common and leaves toward the sensor. It is decided by the polarity of the sensor output, not by the name “sinking” or “sourcing”.
Why does a DC coil get a diode, and how is it connected?
Because on opening, the coil keeps its current flowing and generates a very high voltage that destroys the output. The diode, in anti-parallel with the coil and with the cathode on the positive side, gives it a recirculation path and limits the voltage to about 0.7 V. In AC an RC snubber or a varistor is used.
A panel has a 0.30 A CPU, 10 sensors of 15 mA and 4 solenoid valves of 24 V and 3 W. What 24 V supply is needed?
Total current in the worst case, with the valves at 3 W / 24 V = 0.125 A, and a 25 % margin:
At least 1.19 A is needed: the next commercial value up is chosen.
At which end is the shield of a 4-20 mA cable grounded, and why?
At one end only, the panel end, to the shield bar bonded to earth. With both ends grounded, the potential difference between the two earths drives current through the braid and turns it into a noise source. At the transmitter end the braid is cut back and insulated.
The cable of a 4-20 mA transmitter is cut. What does the module read and what is the advantage?
The current falls to 0 mA, below the 4 mA that represents zero of the variable. The program can detect the condition (below about 3.6 mA) and declare a sensor fault instead of believing the variable is zero. That is the advantage of the “live zero” over 0-10 V.
What is tested before energising, and why are outputs forced without power first?
With no voltage, PE continuity, every conductor and the absence of a short circuit between +24 V and 0 V are checked. Outputs are first forced with the actuator power open to verify the assignment without anything moving; only then is it repeated with power, one at a time and with the area clear.
What must be done before replacing the backup battery, and what is lost if it is not?
You must have a copy of the program and of the retentive data, and replace the battery with the CPU energised if the manual allows it. If the CPU is off and the battery is removed, the retentive variables, the clock and, in RAM-based devices, the program are lost.