Palletizer PLC Programming: How Palletizers Work and Are Controlled
How a palletizer works and how it's controlled by a PLC — machine types, the stacking sequence, pattern programming, servo/robot axes, and safety.
A palletizer is the final machine in an end-of-line packaging system. It takes finished cases, bags, or bundles from a discharge conveyor and stacks them onto a pallet in a precise, repeating pattern so the load can be stretch-wrapped, transported, and stored without shifting or collapsing. Every pallet that leaves a warehouse, food plant, or distribution center was almost certainly built by a machine running a sequence orchestrated by a PLC.
From the PLC's perspective a palletizer is a pattern-execution engine: the program must know which product is running, retrieve the correct layer pattern from a data table, track exactly where each case belongs within the current layer, manage the axes that move the case into position, sense when a layer is complete, insert a slip sheet if required, and then index the pallet down to accept the next layer — all while monitoring a dense network of safety interlocks that protect operators working at the end of a line running hundreds of cases per minute.
This guide covers the hardware types you will encounter, the step-by-step stacking sequence that every palletizer executes, how layer patterns are stored and retrieved in the controller, the motion architecture for both servo-driven and robotic machines, and the safety design that keeps people and equipment safe.
What a Palletizer Is
A palletizer is an automated machine that receives individual load units — cases, bags, trays, or bundles — and builds them into a stable, uniform stack on a pallet. It sits at the intersection of the packaging line and the warehouse; everything upstream produces product, and everything downstream (stretch wrapping, conveyance to a warehouse management system, forklift pickup) depends on the palletizer delivering a dimensionally correct, stable load.
The PLC is the central decision-maker. It:
- Receives a product or SKU selection from the operator or from a line MES/SCADA system
- Loads the corresponding layer pattern from a recipe table stored in controller memory
- Sequences the infeed conveyor, accumulation zone, row or sweep mechanisms, and the stacking head or robot tool
- Tracks pallet height in real time by counting completed layers and multiplying by the programmed layer height
- Manages the pallet conveyor — indexing the pallet down after each layer, ejecting full pallets, and calling for empty pallets
- Monitors every guard, safety mat, light curtain, and e-stop, and executes a safe stop on any fault
Understanding this role makes the programming approach clear: most palletizer code is sequence management and data table lookup, not continuous closed-loop control. The motion (whether pneumatic, servo, or robot) is a means of executing the sequence; the intelligence is in the PLC's pattern data and state machine.
Types of Palletizers
Conventional (Layer) Palletizers
A conventional palletizer builds one complete layer at a time before depositing that layer onto the pallet. Incoming cases travel single-file on an infeed conveyor. A row-forming station accumulates cases side by side until a full row is complete. A layer-forming table (also called a compression table or staging table) then accumulates rows until a complete layer pattern is formed. When the layer is complete, a layer transfer device — typically a set of stripper plates, a push plate, or a layer fork — moves the entire layer horizontally and deposits it onto the pallet below.
From a PLC perspective, the sequence is highly deterministic: count cases into rows, count rows into layers, transfer, index pallet. The I/O is almost entirely discrete (photo-eyes, proximity sensors, limit switches, pneumatic solenoids, motor starters). Programming is predominantly ladder logic in older installations and structured text or function block in modern Allen-Bradley, Siemens, or Beckhoff controllers. For a deeper look at the broader material handling context, see the material handling PLC programming guide.
High-Level Palletizers
A high-level palletizer builds the pallet from the top down. The pallet platform starts at the top of the machine and is driven downward (typically by a servo or chain-driven hoist) one layer height at a time. Cases arrive at the elevated infeed level and are always deposited at a consistent height, which simplifies the transfer mechanism and allows higher throughput rates.
The PLC control logic is essentially the same as a low-level conventional machine, but the pallet elevator axis becomes critical. The program must calculate the exact descent distance for each layer — which varies if the product mix changes — and confirm position before commanding the layer transfer. A servo-driven hoist with an encoder gives the PLC precise height feedback and allows recipe-driven layer heights without mechanical adjustment.
Robotic Palletizers
A robotic palletizer replaces the row/layer forming mechanics with a robot arm equipped with a gripper or vacuum tool. The robot picks individual cases (or small groups) directly from the infeed conveyor and places each one at its programmed XYZ position on the pallet. The PLC and robot controller work as a coordinated pair:
- The PLC manages infeed conveying, case singulation, pallet conveyors, slip sheet dispensing, and all safety zones
- The robot controller executes the pick-and-place motion along the path the PLC commands for each case position
The handshake between the PLC and robot is critical and is covered in detail in the Axes & Motion section below. For a comprehensive look at robot programming in this context, see the dedicated robot palletizing guide.
| Feature | Conventional (Layer) | High-Level | Robotic |
|---|---|---|---|
| Throughput | Medium–High | High | Low–Medium |
| Footprint | Large | Tall/compact | Compact |
| Flexibility (SKU mix) | Low–Medium | Low–Medium | High |
| PLC I/O density | High (discrete) | High + servo | Medium + robot |
| Pattern change method | Recipe data table | Recipe data table | Robot target array |
| Typical applications | High-volume beverage, food | High-speed beverage | Mixed SKU, fragile goods |
The Palletizing Sequence
Every palletizer — regardless of type — executes the same fundamental sequence. Understanding it end-to-end is the prerequisite for writing reliable control code.
1. Infeed and Case Detection
Cases or bags arrive from an upstream packaging machine (cartoner, case packer, bagging machine) via an end-of-line conveyor. A case present photo-eye at the infeed confirms product availability. The PLC checks that:
- The downstream accumulation zone has capacity
- The current layer is not complete (or if it is, that the transfer cycle has finished)
- No faults are active on the infeed path
If conditions are met, the infeed conveyor runs and the case advances. Case counters — typically retro-reflective photo-eyes with a defined beam-break pulse — give the PLC a running count of cases admitted to the machine. This count drives the row and layer position tracking.
2. Row Forming
In a conventional palletizer, cases are diverted or accumulated into rows. The PLC uses the current pattern data to know how many cases belong in each row for the current layer. A lane divider, pusher, or turntable orientates cases to the correct facing. When the row count equals the programmed row length, the row is complete and pushed forward onto the layer table.
Row forming is where orientation logic lives. Many layer patterns include rows that alternate 90° to improve interlocking. The PLC must track the current row number within the layer and apply the correct orientation command for that row. This is typically implemented as a row orientation array indexed by row number, read directly from the recipe data.
3. Layer Forming
The layer-forming table accumulates complete rows until the full layer count is satisfied. As each row advances onto the table, the PLC increments a row counter. When the count matches the programmed number of rows per layer, the layer is flagged as complete and the transfer sequence is initiated. No new infeed is admitted during the transfer.
For layer patterns that require rotation or offset between layers (to improve pallet stability through interlocking), the PLC alternates between two or more layer pattern variants. A layer counter modulo the number of pattern variants selects the correct pattern for the next layer.
4. Layer Transfer to the Pallet
The transfer mechanism — stripper plates, push plate, or layer fork — moves the complete layer from the forming table onto the top of the pallet stack. The exact mechanism varies by machine design, but the PLC sequence is broadly:
- Confirm pallet is present and at the correct height (position confirmed by encoder or photoeye stack)
- Extend the transfer mechanism over the pallet
- Retract the table surface (stripper plate action) or open the fork to deposit the layer
- Retract the transfer mechanism back to home
- Confirm layer is seated (pressure sensor or weight check on some machines)
- Increment the layer counter
The transfer step is the highest-risk moment for product damage. Speeds and deceleration ramps for the transfer servo or pneumatic cylinder must be tuned per product — fragile glass cases require much slower deposit speeds than stable corrugated cases.
5. Slip Sheet Dispensing
Many palletizing applications require a slip sheet (a thin cardboard or plastic sheet) between layers to prevent scratching, improve stability, or meet customer requirements. If the recipe calls for slip sheets, the PLC triggers a slip sheet dispenser after the pallet indexes down and before the next layer transfer begins.
The dispenser is typically a vacuum-cup pick-and-place mechanism with its own local pneumatic sequence. The PLC sends a slip sheet request output and waits for a slip sheet complete feedback before allowing the next layer transfer. The recipe stores a boolean flag per layer position indicating whether a slip sheet is required at that level.
6. Pallet Descent (Indexing)
After each layer is deposited, the pallet elevator or pallet conveyor must lower the pallet by exactly one layer height so the next layer can be deposited at the correct level. The PLC calculates the target position:
Target_Height = (Completed_Layers × Layer_Height_mm) + Pallet_Height_mm
Both Layer_Height_mm and Pallet_Height_mm are stored in the recipe. The servo or chain-drive hoist moves to the calculated position and confirms arrival before the next layer cycle begins. Incorrect layer height values in the recipe are the most common cause of pallet build failures — cases overhang, the transfer mechanism catches on the top layer, or the pallet collapses.
7. Full Pallet Discharge
When the layer counter reaches the programmed number of layers per pallet, the PLC initiates the pallet full sequence:
- Flag the pallet as complete (visible on HMI and reported to MES if integrated)
- Drive the pallet elevator or pallet roller conveyor to the discharge position
- Confirm the outfeed conveyor or stretch wrapper infeed has capacity
- Transfer the full pallet out of the machine
- Call for an empty pallet from the pallet magazine or dispenser
- Reset layer counter, row counter, and pallet height accumulator
- Position the new empty pallet at the start height and confirm ready
The pallet magazine that supplies empty pallets is often a separate conveyor system. The PLC handshakes with the magazine controller via discrete I/O or a fieldbus node — a pallet request output and a pallet available input form the minimum interface.
Pattern Programming
How layer patterns are defined and stored is the most important design decision in palletizer PLC programming. A poorly designed pattern data structure forces the programmer to hard-code every SKU, making recipe management a maintenance nightmare. A well-designed structure stores all pattern information in a recipe database that operators can modify through the HMI without touching the program.
Pattern Data Structure
Each layer pattern defines, for every case in the layer:
| Parameter | Description | Data type |
|---|---|---|
| Case number (index) | Sequence number within the layer | INT |
| X position (row) | Column position in the layer grid | INT |
| Y position (col) | Row position in the layer grid | INT |
| Orientation | 0° or 90° rotation flag | BOOL |
| Row group | Which row this case belongs to | INT |
In Allen-Bradley ControlLogix, this is typically implemented as a UDT (User Defined Tag) array of structures, one per case in the layer, stored within a recipe UDT that holds all parameters for a single SKU. Up to N recipe slots (commonly 50–100 in food/beverage applications) are pre-allocated in controller memory, each containing the full pattern array for one SKU.
On Siemens S7-1500 or S7-300 systems, DB (Data Block) arrays serve the same purpose. The active recipe is typically copied from a "recipe storage" DB into an "active recipe" DB at the start of a run, so the running program always reads from a single known location.
Pattern Execution Logic
The PLC maintains three state counters during a run:
- Case counter — position within the current row
- Row counter — position within the current layer
- Layer counter — position within the current pallet
On each new case entering the row-forming zone, the program looks up Pattern[Layer_mod_variants][Row_counter][Case_counter] to retrieve the orientation and lane assignment for that specific case. In pseudocode:
// Determine which pattern variant applies to this layer
Active_Variant := Layer_Counter MOD Num_Variants;
// Look up orientation for this case
Case_Orientation := Pattern[Active_Variant, Row_Counter, Case_Counter].Orientation;
// Command orientation device
IF Case_Orientation = ROTATE_90 THEN
Turntable_90.Q := TRUE;
ELSE
Turntable_90.Q := FALSE;
END_IF;
// Advance case counter
Case_Counter := Case_Counter + 1;
IF Case_Counter >= Pattern[Active_Variant, Row_Counter].Cases_Per_Row THEN
Case_Counter := 0;
Row_Counter := Row_Counter + 1;
END_IF;
This lookup approach means adding a new SKU is entirely an HMI/recipe operation — the programmer defines the pattern structure once, and operators (or a line MES) populate the data values.
Pattern Validation
Before a recipe is accepted as active, the PLC or HMI application should validate:
- Total case count per layer matches the expected footprint (length × width cases)
- Layer height value is non-zero and within machine limits
- Number of layers does not exceed the pallet height limit (usually tied to stretch wrapper capability)
- Slip sheet flags are logically consistent (e.g., not requested below layer 1)
Validation errors surfaced at recipe load time prevent run-time faults during production. This is a significant quality-of-life improvement for operators and maintenance technicians.
Axes and Motion
Servo-Driven Conventional Palletizers
Modern conventional palletizers use servo motors on two to four axes:
- X-axis — the push plate or sweep that positions the row on the forming table
- Z-axis — the pallet elevator or hoist
- Transfer axis — the layer stripper or push mechanism
Each servo axis is typically controlled through a drive (Allen-Bradley Kinetix, Siemens SINAMICS, Lenze, SEW) connected to the PLC over a motion fieldbus (EtherNet/IP with CIP Motion, PROFINET with PROFIdrive, or EtherCAT). The PLC issues move commands — absolute position targets with velocity and acceleration parameters — and monitors feedback from the drive's encoder.
For a foundational understanding of how PLC programs command servo drives and interpret position feedback, the motion control basics guide covers the core concepts in detail.
Position homing at machine startup is critical. The elevator must establish a datum (typically the fully raised or fully lowered position confirmed by a limit switch) before any production move is permitted. The program should fault if homing is not complete and any run command is issued.
Robotic Palletizers
In a robotic palletizer, the PLC does not directly control the robot's joint motion — the robot controller owns that. The PLC owns everything else: infeed conveyors, pallet handling, slip sheet dispensing, and safety. The two controllers communicate via a discrete I/O handshake or an industrial Ethernet protocol (EtherNet/IP, PROFINET, or a vendor-specific interface):
Typical PLC-to-Robot signals:
| Signal | Direction | Meaning |
|---|---|---|
| Case Ready | PLC → Robot | A case is in the pick position |
| Target Position Index | PLC → Robot | Recipe case number for this pick |
| Cycle Start | PLC → Robot | Permission to execute the pick/place |
| Auto Mode Active | PLC → Robot | PLC is in run, safe to move |
Typical Robot-to-PLC signals:
| Signal | Direction | Meaning |
|---|---|---|
| Pick Complete | Robot → PLC | Case has been picked from infeed |
| Place Complete | Robot → PLC | Case has been placed on pallet |
| Robot Ready | Robot → PLC | Ready for next cycle command |
| Robot Fault | Robot → PLC | Fault condition — PLC should stop infeed |
The PLC sends the target position index — the case number within the active recipe — and the robot program looks up the XYZ coordinates and approach orientation for that index from its own internal target table. This means both the PLC recipe and the robot target table must be kept in sync when a new SKU is commissioned. Mismatches between them are a common commissioning fault.
Robotic palletizing is closely related to other end-of-line automation tasks. For machines immediately upstream that feed the palletizer, see the packaging machine PLC programming guide and the labeling machine article for the conveyor interface patterns used at these handoffs.
Sensors and Interlocks
A palletizer has a high density of sensing because the machine must know the state of product and pallet at every station simultaneously. The following table covers the principal sensor types and their PLC function.
| Sensor | Location | PLC Function |
|---|---|---|
| Retro-reflective photo-eye | Infeed gate | Case count / case present |
| Diffuse photo-eye | Row-forming lane | Lane full / jam detect |
| Proximity sensor (inductive) | Row-forming pusher | Push complete confirmation |
| Retro-reflective photo-eye | Layer table | Layer full confirmation |
| Servo encoder | Z-axis hoist | Pallet height position |
| Retro-reflective photo-eye | Pallet infeed | Empty pallet present |
| Retro-reflective photo-eye | Pallet outfeed | Full pallet cleared |
| Load cell / pressure switch | Transfer mechanism | Layer deposit confirmation |
| Proximity sensor | Transfer home | Transfer mechanism at home |
Jam detection is especially important on the infeed. If a case fails to clear the infeed photo-eye within a timeout, the PLC should stop the infeed conveyor, generate a fault code, and display the fault location on the HMI. Clearing the jam and resetting the fault should require an operator acknowledge — automatic restart after a jam is prohibited by most machine safety standards.
Safety
Palletizer safety design is governed by ISO 10218 (robot safety, for robotic machines), ISO 13849, and regional machinery directives (EU Machinery Directive / OSHA machine guarding in North America). Key safety elements and their PLC implementation:
Perimeter Guarding and Light Curtains
The palletizer is enclosed by physical guarding with interlocked access doors. The PLC reads the door interlock safety inputs (typically dual-channel safety relay or safety PLC inputs) and implements a safety-rated stop (typically STO — Safe Torque Off) on all servo drives when a guard is open. For robotic machines, the robot controller's own safety circuit must also be triggered on guard entry.
Light curtains at the pallet discharge opening allow the operator to approach the full pallet without entering the main guarded zone. The light curtain is typically wired to a muting circuit that is only active when a full pallet is being discharged — the PLC enables the muting output only when a pallet transfer is confirmed in progress, preventing the muting circuit from masking a guard intrusion during normal stacking.
Safety Mats
Floor-level safety mats in front of access doors provide additional protection against an operator reaching into the machine without operating a door interlock. They are wired to the same safety relay chain as the door interlocks. The PLC should treat a safety mat trip identically to a guard door open: immediate category-0 or category-1 stop depending on the hazard analysis.
Two-Hand Control and Maintenance Mode
Maintenance personnel who need to jog axes with guards open must use a key-switch maintenance mode with a two-hand pendant. In maintenance mode, the PLC:
- Limits all axis speeds to a reduced safe speed (typically defined by the risk assessment, often 250 mm/s for servo axes)
- Requires the two-hand control to be held for any axis motion
- Disables automatic sequences
- Logs the entry and exit from maintenance mode with timestamp
E-Stop Zones
Palletizers at the end of a packaging line are typically part of a zoned e-stop architecture. The line e-stop chain stops all equipment; a local palletizer e-stop stops only the palletizer and its immediate infeed, allowing upstream packaging machines to continue running (with their own product buffering). The PLC must implement proper e-stop feedback monitoring — verifying that the e-stop output has de-energized the correct contactors and safety relays within the expected time — to meet IEC 60204-1 requirements.
For a broader look at conveyor and end-of-line interlock strategies, see the conveyor belt PLC programming guide.
Frequently Asked Questions
How does a palletizer work?
A palletizer receives cases or bags from an end-of-line conveyor and stacks them onto a pallet in a programmed pattern. The PLC controls the infeed, orients and accumulates cases into rows and layers, transfers each complete layer onto the pallet, indexes the pallet down by one layer height after each transfer, inserts slip sheets if required, and ejects the full pallet when the programmed number of layers is complete. The pattern — which defines each case's position and orientation within the layer — is stored as a recipe data table in the controller and selected by the operator or line MES at the start of a run.
What is the difference between a conventional and robotic palletizer?
A conventional (layer) palletizer forms a complete layer of cases on a staging table using mechanical pushers and diverters, then transfers the entire layer at once onto the pallet. It handles high-volume, single-SKU applications efficiently. A robotic palletizer uses a robot arm to pick and place individual cases at their target positions. It is slower per case but far more flexible — it can handle multiple SKUs simultaneously, accommodate irregular case sizes, and change patterns without mechanical adjustment. The PLC role in a robotic system shifts from sequencing mechanical axes to managing the infeed/pallet handling and coordinating a handshake with the robot controller.
How are palletizing patterns programmed?
Layer patterns are stored as structured data tables (UDT arrays in ControlLogix, DB arrays in Siemens S7) containing a record for each case in the layer. Each record holds the case's row position, column position, and orientation (0° or 90°). The PLC reads the active recipe at the start of a run and uses the case and row counters to index into the pattern array during production. New patterns are created in the HMI recipe manager or downloaded from a line MES — no changes to the PLC program are required for new SKUs, provided the program was written against a well-designed data structure.
What sensors does a palletizer need?
The minimum sensor set includes a case-present photo-eye at the infeed, lane-full sensors in the row-forming zone, a layer-complete sensor on the forming table, a position encoder on the pallet elevator, pallet-present sensors at the infeed and outfeed positions, and proximity sensors confirming the transfer mechanism reaches home position. Safety sensors — guard door interlocks, light curtains, and safety mats — are additional and mandatory for CE/OSHA compliance.
How is pallet height tracked?
Pallet height is tracked by multiplying the completed layer count by the programmed layer height (stored in the recipe), adding the known pallet board height. On a servo-driven elevator, this calculated value is the absolute position target sent to the drive. The drive's encoder feedback confirms arrival at the target before the next layer transfer is permitted. A discrepancy between the commanded and actual position is a fault condition that must stop the machine to prevent a collision between the transfer mechanism and the top of the pallet stack.


