Hub · Interactive
How a PLC Runs a Machine
Nearly every automated machine we build has a PLC in its control panel. This page explains what it does, with a few small simulations you can click through. Nothing to install.
Start here
1What a PLC is
A PLC (programmable logic controller) is a computer made to live in a control cabinet. It runs on 24 V DC, has no fan or hard drive, puts up with heat and the electrical noise from motors and welders, and runs the same program for years without a restart. Its job is narrow: read the switches and sensors wired to it, decide what should happen, and switch the valves, motors and lamps wired to its outputs.
Sensor → PLC input → program decides → PLC output → actuator moves
Built for the panel
Usually rated for 0–55 °C and vibration. No operating system updates halfway through a shift.
Predictable timing
It reads every input and updates every output in a fixed loop, typically every 1–20 ms. Same inputs, same outputs.
Expandable
I/O, motion, safety and network modules clip onto the rack. A table-top machine may need a dozen I/O points; a production line, thousands.
PLCs came out of the car industry. In 1968 General Motors asked for a programmable replacement for the walls of relays that ran its lines, and the Modicon 084 was one of the first answers. Common brands today include Mitsubishi, Omron, Siemens, Keyence and Allen-Bradley.
Hardware
2What’s in the panel
CPU
Stores and runs the program in a loop called the scan. Has the RUN/STOP switch and the status LEDs you check first when something’s wrong.
Power supply
Turns the plant’s 230 V AC into the 24 V DC that the PLC and most sensors run on.
Input modules
Where pushbuttons, limit switches, photoelectric and proximity sensors connect. Analog inputs read pressure or temperature as 4–20 mA or 0–10 V.
Output modules
Switch solenoid valves, relays, contactors, lamps and buzzers. Relay outputs handle mixed loads; transistor outputs switch faster and last longer.
Communications
Networks such as EtherNet/IP, PROFINET, EtherCAT, CC-Link and Modbus TCP connect the PLC to the HMI, servo drives, robots or a plant system.
HMI
The touchscreen on the machine. Operators start and stop, pick a recipe, and read alarms in words instead of LED codes.
Core idea · Interactive
3The scan cycle
A PLC doesn’t react the instant an input changes. It works in a loop: read every input, run the program top to bottom, write every output, then handle communications. Step through it below.
- 1. Read inputsCopy every sensor state
- 2. Run the programSolve each rung
- 3. Write outputsSwitch the actuators
- 4. HousekeepingHMI, network, watchdog
Ready. On a small PLC the whole loop takes a few milliseconds.
LOOP FOREVER: inputs = read_all_inputs() // START=1, STOP=1, PART=1 outputs = solve_program(inputs) write_all_outputs(outputs) // MOTOR=ON update(HMI, network, watchdog) // a few ms in total
Why it matters: the loop is short and the same length every time, so you can rely on it. That’s how a machine times a dispense, or refuses to cycle a press until the guard switch is made, the same way on every cycle.
Wiring · Interactive
4Inputs and outputs
A small machine: a conveyor, a pneumatic press and a stack light. Press START, then switch the part sensor on and off. Press STOP to shut it down.
Inputs (into the PLC)
START and STOP are momentary: they spring back when released.
Outputs (from the PLC)
Conveyor motor OFF
Press valve OFF
Stack light RED
The conveyor stays on after START is released, until STOP. The press only fires while the conveyor runs and a part is present.
Programming · Interactive
5Ladder logic
Ladder logic is drawn like the relay diagrams it replaced. Power flows from the left rail to the right; if there’s an unbroken path, the coil at the end turns on. Click START, then PART, then STOP.
The lower contact on the first rung is the seal-in. Once the motor is on, its own contact keeps the rung powered after START is released. Only STOP breaks it.
// The same logic in Structured Text Y0 := (X1 OR Y0) AND X0; // motor with seal-in; X0 is the NC stop Y1 := Y0 AND X2; // press only while running with a part present
Applications
6Where PLCs show up in our builds
Table-top machines
Part loaded, sensor confirms it, press cycles, part released. The PLC handles the sequence and the timers.
Semi-automated jigs
The operator loads and unloads. The press won’t move until the clamp and part sensors confirm the part is seated.
Dispensing and process
Grease dispensed by time or volume, a drum shaken for a set cycle, pumps and fans switched by level or pressure.
Motion
Servo and stepper drives for indexing, positioning and pick-and-place, commanded by the PLC.
Safety
E-stops, door switches, light curtains and two-hand controls. On higher-risk machines these go through a safety relay or safety PLC, not ordinary inputs.
Data
Cycle counts, alarm history and reject counts, shown on the HMI or passed to a plant system.
Choosing
7PLC or something else?
| Controller | Good for | Watch out for |
|---|---|---|
| PLC | Production machines, long shifts, safety interlocks, maintenance by plant electricians | Costs more up front than a hobby board |
| Relays and timers | One or two simple functions | Every change means rewiring; fault-finding gets hard quickly |
| Arduino or similar | Prototypes and test rigs | Not built for plant noise or 24 V I/O; no safety rating |
| Industrial PC | Vision, heavy data logging, databases | Usually works alongside a PLC rather than replacing it |
| DCS | Refineries and chemical plants | Far more than a single machine needs |
Check yourself
8Quick quiz
1. What order does the scan run in?
2. A sensor that detects a part is wired to…
3. Why does the motor rung need a seal-in contact?
Score: 0 / 3