Catto / Topic Map · Industrial Electronics II Year 7
Industrial Electronics II · 120 h · Topic 2 of 8

Structure of a programmable logic controller

On the outside it is a box with terminal blocks and lights. On the inside it is an industrial microcontroller surrounded by everything needed so that real-world signals—24 V, bouncing contacts, motor noise—can come in and go out without destroying anything.

CPU and memory Process image Digital I/O Isolation

01External structure

Power supplyCPUMemoryInputsOutputsCommunicationInternal busfield sidelogic sidegalvanic isolationPower supplyPower supplyPowers the logic and, often, the 24 V field supply.CPUCPURuns the program, manages memory and does self-diagnosis.MemoryMemoryProgram, I/O image, markers, data and retentive area.InputsInputsFilter, limit and isolate the signals coming from the field.OutputsOutputsTurn commands into power: relay, transistor or triac.CommunicationCommunicationSerial port, fieldbus or Ethernet to other devices.Internal busInternal busConnects the CPU to all the modules in the rack.Galvanic isolation between the field and the logic keeps plant noise from reaching the processor.
Figure 1. The parts of a PLC, animated. Each block fulfills a separate function, and the galvanic isolation between the field and the logic is what keeps the noise of a plant from ever reaching the processor.
BlockFunction
Power supplyPowers the internal logic and, in many units, also delivers the 24 V for the sensors. Its capacity limits how many modules can be mounted.
CPURuns the program, manages memory, handles communication and performs self-diagnosis.
Input modulesAdapt the field signals to the logic level: they filter, limit and isolate.
Output modulesConvert commands into usable power: relay, transistor or triac.
Communication modulesSerial ports, fieldbus or Ethernet, to talk to other devices and to the supervisory system.
Rack and internal busMechanical support and data bus that connects the CPU with all the modules.
Programming terminalThe PC with the manufacturer’s software. It is also used to monitor online and to force signals.
The 24 V supply is not unlimited

The 24 V output built into the PLC usually delivers only a few hundred milliamperes. Hanging twenty inductive sensors, the relay coils and the pushbutton panel lighting from it ends up loading it to the limit: the voltage drops, the sensors start to fail intermittently and the diagnosis points everywhere except at the power supply. As soon as there are several loads, an external supply is added and the common is shared.

02Memory and addressing

AreaWhat it stores
Program memoryThe user program, in non-volatile memory. It is kept without power.
Input imageThe snapshot of the state of all the inputs at the start of the cycle. It is what the program reads.
Output imageWhat the program writes, which is transferred to the terminals at the end of the cycle.
Internal markersAuxiliary bits: flags, intermediate states, comparison results. They have no physical terminal.
DataWords, integers and reals for calculations, setpoints and process values.
Timers and countersBlocks with their preset value, their current value and their output bit.
Retentive areaPart of the memory that survives a power failure: accumulated production, setpoints, machine state.
How each signal is named

The notation varies between manufacturers but the idea is the same: a type identifier, a byte and a bit. For example %I0.3 is the fourth input of the first byte, %Q1.0 the first output of the second byte, %M10.2 an internal marker and %IW64 an analog input word.

What matters is not the syntax but the discipline: every signal has a symbolic name—arranque_bomba, nivel_alto—and the program is written with those names. A program full of %I and %Q with no symbols is indecipherable for whoever comes afterwards, who is almost never the person who wrote it.

03Input modules

sensorPNP 24 VRoptocouplerinputimageno electrical connection between the two sides0Sensor not detectingNo current flows, the diode does not emit and the phototransistor is cut off: the input reads zero.1Sensor detectingCurrent flows, the diode emits, the phototransistor conducts and the input goes to one.Module LEDThe indicator of each channel shows the true state of the input: it is the first diagnostic tool.
Figure 2. Digital input with optical isolation, animated. The field signal lights a diode, the light crosses to the other side and there a phototransistor delivers the logic level: between the field and the processor there is no electrical connection.
Digital inputs
  • They typically operate at 24 V DC; 110 and 220 V AC versions also exist.
  • Each input has a filter of a few milliseconds that removes contact bounce and noise. That filter adds to the scan time.
  • One LED indicator per channel shows the true state: it is the first diagnostic tool.
  • Defined thresholds: below about 5 V is a sure zero, above about 15 V is a sure one. In between, undefined.
PNP and NPN

A PNP sensor delivers +24 V when it detects; an NPN one delivers 0 V. The input module has to be wired accordingly: common at 0 V for PNP sensors, common at +24 V for NPN.

Mixing the two types in the same group of inputs is one of the most frequent wiring mistakes, and it produces inputs that stay always on or always off.

Analog inputCharacteristics
4 to 20 mAThe industrial standard. Being a current, it is not affected by the voltage drop in the cable, and the live zero makes it possible to tell “zero of the variable” from “cable cut.”
0 to 10 VSimple and economical, but sensitive to noise and cable length. For short runs inside the panel.
Thermocouple and PT100Dedicated modules with linearization and cold-junction compensation already handled internally.
ResolutionUsually 12 to 16 bits over the range. The program receives an integer that has to be scaled to the engineering unit.
Worked example · Scaling an analog input

A pressure transmitter of 0 to 10 bar delivers 4 to 20 mA. The PLC module converts that range to an integer from 0 to 27648.

pressure = reading × 10 / 27648

With a reading of 13,824: pressure = 13,824 × 10/27,648 = 5.0 bar. And if the cable is cut, the current drops to 0 mA, the reading goes below zero and the program can detect the fault instead of believing the pressure is zero. That is the whole advantage of the live zero, and it is the reason 4-20 mA is still in use.

04Output modules

TypeCurrentSpeedWhen it is used
Relay2 to 5 Aslow (ms)The most versatile: it works for DC and AC, and with a voltage-free contact. It wears out with switching operations.
Transistor0.5 to 2 Afast (µs)DC only. For solenoid valves, signaling and PWM or pulse outputs.
Triac0.5 to 2 AmediumAC only, with no contacts to wear out. Good for loads that switch very often.
What has to be added externally
  • Flyback (freewheeling) diode across every DC coil, as close to it as possible. Without it, the turn-off spike destroys the output transistor.
  • Snubber circuit—a resistor and capacitor in series—across AC coils.
  • A fuse per group of outputs: a short circuit in the field must not take out the entire module.
  • Interposing relays or contactors for large loads. The PLC output commands, it does not supply power.
  • Respect the current per group, which is always lower than the sum of the maximum individual currents.

05In the lab

Lab 1 · Getting to know the unit

On a real PLC: identify the power supply, CPU, modules and terminal blocks; read the nameplate; determine the supply voltage, the number and type of I/O, and the current available at the 24 V output. Draw the complete terminal diagram before connecting anything.

Lab 2 · PNP and NPN

Wire a PNP inductive sensor and an NPN one to the inputs, with the correct common in each case. Then swap them on purpose and observe the behavior: inputs always on or always off. Document how each case is recognized from the module’s LEDs.

Lab 3 · Analog scaling

Connect a potentiometer or a transmitter to an analog input and read the raw value. Write the conversion to engineering units and verify it with a multimeter at several points. Add wire-break detection below 4 mA.

Lab 4 · Outputs and protection

Drive a DC solenoid valve from a transistor output, with and without a freewheeling diode, observing the turn-off spike with the oscilloscope. Measure the reverse voltage that appears without the diode: it often exceeds one hundred volts.

06Common mistakes

SymptomUsual cause
Inputs always on or always offPNP sensor wired as NPN, or common wrongly connected.
Sensors that fail intermittentlyThe internal 24 V supply is overloaded and the voltage drops.
The transistor output burns outThe freewheeling diode across the coil is missing.
Outputs in a group that do not respondGroup fuse blown, or total current above what is allowed.
Noisy analog reading0-10 V signal over a long cable or next to power wiring. Use 4-20 mA and shielded cable.
The program thinks the pressure is zeroCable cut without detection: the live zero of 4-20 mA was not used.
Data is lost when power is cutThe variables were not in the retentive area.
Program impossible to maintainSignals without symbolic names or comments.

07Self-assessment

What is the process image?

The copy in memory of the state of all the inputs, taken at the start of the cycle. The program reads from there, never from the physical terminal, and so it works on a consistent snapshot.

What is galvanic isolation used for in the I/O?

So that there is no electrical connection between the field and the logic: the noise, overvoltages and potential differences of the plant do not reach the processor.

Difference between a PNP and an NPN sensor.

The PNP delivers +24 V when activated and the NPN delivers 0 V. The input module must be wired with the corresponding common in each case.

Why is 4-20 mA preferred over 0-10 V?

Because being a current it is not affected by the voltage drop in the cable, it resists noise better, and the live zero makes it possible to tell a variable at zero from a cut cable.

Scale a reading of 6912 out of 27648 for a range of 0 to 10 bar.

6912 × 10/27,648 = 2.5 bar.

What type of output is appropriate for an AC load that switches very often?

A triac output: it has no contacts to wear out and it handles AC. A relay would pit with so many switching operations.

What is added to a DC coil driven by a transistor output?

A flyback (freewheeling) diode in antiparallel, as close to the coil as possible. Without it, the turn-off spike destroys the transistor.

What is the retentive area of memory?

The part that keeps its contents when the power is cut: accumulated production, setpoints, machine state.

Why does the input filter increase the response time?

Because the module ignores changes shorter than the filter in order to eliminate bounce and noise. That delay adds to the scan time.

Why must every signal have a symbolic name?

Because the program is the documentation of the machine, and whoever maintains it years later will not be the person who wrote it. A program full of %I and %Q with no symbols is indecipherable.

Development of the topic “Structure of programmable logic controllers” of Industrial Electronics II (Year 7), based on the “Curriculum Proposal – Second Cycle of the Technical-Vocational Track, Secondary Education – Electronics,” Ministry of Education of the Province of Córdoba, DGETyFP. Back to the Topic Map · catto.ar