Popular plc programmingladder logicPLC tutorial for beginnersIEC 61131-3industrial automationPLC timers
Lesson 2 of 12

Inside a PLC: power, CPU, memory and I/O

In this lesson
  • The five building blocks of any PLC
  • What program, data and retentive memory are for
  • Relay vs transistor outputs and when to use each
  • How to read the important lines of a datasheet

Open the cabinet of almost any machine and you will see the same arrangement: a power supply, the PLC, rows of terminal blocks, and wires running out to the field. In this lesson we open up the PLC itself.

CPU Program memory Data memory (I/O, bits, timers) Inputmodule Outputmodule Buttons, sensors Contactors, valves Power supply 24 V DC Programming / network port
The building blocks of every PLC. Compact PLCs put them all in one housing; modular PLCs use a separate module for each.

1. Power supply

Most modern PLCs run from 24 V DC, supplied by a DIN-rail power supply that converts the mains (230 V AC in Kenya and most of the world, 120 V in North America). Some compact PLCs accept mains directly and even provide a small 24 V output for sensors. Check the datasheet: that sensor supply is often limited to a few hundred milliamps.

2. CPU

The CPU runs the operating system and your program. It also manages communication, keeps the clock, and watches itself: if the program takes too long or hardware fails, it stops the outputs safely and shows a fault light. The front of a CPU usually has a RUN/STOP switch and status LEDs (RUN, ERR, BAT) that are the first thing you check when a machine stops.

3. Memory

  • Program memory holds the logic you write.
  • Data memory holds the current state of every input, output, internal bit, timer and counter.
  • Retentive memory keeps chosen values (for example a production count) through a power cut, using flash, a battery or a capacitor.

You will meet the names for these memory areas in lesson 5.

4. Inputs

An input module turns a field voltage into a 1 or a 0 the CPU can read. A digital (discrete) input sees only ON or OFF: a button, a limit switch, a proximity sensor. An analog input measures a range, such as 4–20 mA from a pressure transmitter. Each input has an LED on the module, which is your quickest troubleshooting tool: if the LED is off, the problem is in the wiring or the device, not the program.

Inputs are electrically isolated from the CPU with opto-couplers, so a spike on a field cable cannot reach the processor.

5. Outputs

Digital outputs come in two main kinds, and choosing the wrong one is a classic beginner mistake.

Relay outputTransistor output
SwitchesAC or DCDC only
Typical currentAbout 2 A per pointAbout 0.5 A per point
Switching speedSlow (around 10 ms)Fast (microseconds)
LifeLimited: contacts wearVery long
Use forContactor coils, AC solenoids, mixed voltagesPulse outputs to stepper and servo drives, frequent switching

Analog outputs send a variable signal, typically 0–10 V or 4–20 mA, for example a speed reference to a variable frequency drive.

Never drive a motor directly from a PLC output. The output switches a contactor or relay coil, and the contactor switches the motor. PLC output points are rated for small loads only.

6. Communication

Every PLC has at least one port for the programming laptop (USB, Ethernet or serial). Most also talk to other devices: HMIs (touch screens), drives, remote I/O and SCADA systems, using networks such as Modbus, PROFINET, EtherNet/IP and CC-Link.

Reading a datasheet: the lines that matter

  1. Supply voltage: 24 V DC or mains?
  2. Number of inputs and outputs, and whether you can add expansion modules.
  3. Input type: sinking, sourcing or both (lesson 4 explains this).
  4. Output type: relay or transistor, and the current per point and per common.
  5. Program memory and instruction set: timers, counters, maths, PID.
  6. Communication ports built in.
  7. Software: what it costs and whether a free version exists.

Frequently asked questions

Can a relay output switch 230 V AC?

Usually yes, within the contact rating on the datasheet (often 250 V AC, 2 A). Always check the rating and the limit per common terminal, and use a contactor for motors.

What does the ERR light on a PLC mean?

The CPU has detected a fault, such as a program error, a watchdog timeout or a failed module. Connect with the programming software and read the diagnostic buffer or error code.

Knowledge check

Check your understanding

3 questions. Your best score is saved on this device.

1A machine needs to send fast pulses to a stepper drive. Which output type should you choose?
2An input LED is off even though the sensor should be on. Where is the problem most likely?
3What is retentive memory used for?