Learn PLCs free
Technical Guides12 min read5 149 words

Filling Machine PLC Control: How Liquid Fillers Work and Are Programmed

How a filling machine works and how a PLC controls it — filler types (volumetric, gravimetric, flow-meter), the fill sequence, dosing accuracy, and reject handling.

IAE
Senior PLC Programmer
15+ years hands-on experience • 50+ automation projects completed
PLC
Programming Excellence

How a Filling Machine Works — and How a PLC Controls It

A filling machine dispenses a measured quantity of liquid, paste, or powder into a container. The PLC controls every step of that process: detecting whether a bottle is present, opening a valve or driving a piston for exactly the right duration or volume, verifying the result, and routing rejects off the line. Understanding those control loops — and why each technology exists — is the foundation for commissioning, troubleshooting, and programming any liquid filler.

This guide covers the five main filler technologies from the PLC's perspective, walks through the full fill sequence, explains how dosing accuracy is achieved in closed-loop control, and details no-bottle-no-fill interlocks, CIP automation, and safety design. For the broader packaging context see the packaging machine PLC programming guide and, for beverage lines, the bottling line PLC programming guide.


What a Filling Machine Is

A filling machine is an industrial device that meters and deposits a controlled amount of product into a container. In a liquid packaging line the filler sits between the container infeed (rinser or air conveyor) and the capper or sealer. Its sole job is to repeat the same dose — within a defined tolerance — hundreds or thousands of times per hour.

From the PLC's perspective, a filling machine is a metered dispensing system with three control problems to solve:

  1. Detect that a container is in position and that all safety conditions are met.
  2. Dispense the correct quantity using the appropriate sensing technology (time, volume, weight, flow, or level).
  3. Verify and act — confirm the dose was delivered, flag any out-of-tolerance fills, and route them to a reject station.

Everything else — valve types, nozzle designs, rotary versus linear indexing — is mechanical detail built around those three control tasks.

Filling machine PLC fill sequence: detect, dispense, verify, accept or reject Horizontal flow diagram showing the PLC-controlled fill sequence for a liquid filling machine: container detect, nozzle lower, coarse fill, fine fill, close valve, verify dose, and accept or reject routing. DETECT Container Photo sensor Tare weight No bottle? → No fill COARSE Fill Fast Valve open Full flow rate Monitor PV ~80–90% dose FINE Fill Slow Throttle valve Pre-close pt In-flight comp Last grams CLOSE Valve Valve shut Nozzle raise Settle timer Read final PV VERIFY Dose Check Weight / pulses vs target ± tol Timeout fault Pass / Fail flag ROUTE Accept / Reject Pass → conveyor Fail → FIFO reject Shift register tracks position to actuator Filling machine PLC state machine — detect → coarse fill → fine fill → close → verify → accept/reject
Filling machine PLC fill sequence: from container detection through two-stage coarse and fine fill, valve close, dose verification, and accept or reject routing via shift register.

Filler Types: Five Technologies and How the PLC Sees Each

1. Volumetric / Piston Filler

A piston filler uses a servo-driven or pneumatic cylinder to draw a fixed stroke of product from a feed cylinder and push it into the container through a fill nozzle. The volume dispensed equals the cylinder bore area multiplied by the piston stroke.

PLC control view:

  • Stroke length is a recipe parameter stored in a data block (e.g., DB_Recipe.StrokeLength_mm).
  • A servo axis drives the piston; the PLC sends a motion command and reads encoder position to confirm completion.
  • Pneumatic piston fillers use a timed output with a flow-control valve; the dose is adjusted by tuning the stroke limiter, not the PLC timer.
  • Product inlet and outlet valves are sequenced: inlet opens on the draw stroke, outlet opens on the fill stroke — never both simultaneously.

Best for: viscous products (sauces, creams, gels), products with particulates. Accuracy typically ±0.5 % to ±1 % of dose.

Filling machine type accuracy comparison: gravimetric vs Coriolis vs piston vs flow-meter vs time-pressure Horizontal bar chart comparing typical dosing accuracy for five filling machine technologies: gravimetric weigh filler at ±0.1–0.3%, Coriolis flow meter at ±0.2–0.5%, piston volumetric at ±0.5–1%, magnetic flow meter at ±0.2–0.5%, and time-pressure at ±1–3%. Filler Technology — Typical Dosing Accuracy (% of dose) Gravimetric (weigh) ±0.1–0.3 % — most accurate Coriolis flow meter ±0.05–0.1 % — custody transfer Flow-meter (mag) ±0.2–0.5 % Piston (volumetric) ±0.5–1 % Time-pressure ±1–3 % 0 % 1 % 2 % 3 %
Filling machine dosing accuracy by technology: gravimetric and Coriolis fillers deliver the highest accuracy; time-pressure fillers are least accurate and most sensitive to product viscosity changes.

2. Gravimetric / Weigh Filler

A weigh filler places the container on a load cell and fills until the target net weight is reached. The PLC reads the load cell signal in real time and closes the fill valve when the setpoint is hit — accounting for in-flight product (the product still in the air between valve and container after the valve closes).

PLC control view:

  • The load cell signal comes in as an analog input (typically 4–20 mA or via a weighing module) and is scaled to grams or kilograms.
  • A two-stage fill is standard: coarse fill at full flow until a pre-close weight (setpoint minus in-flight compensation), then fine fill at reduced flow for the last few grams.
  • The in-flight compensation value is auto-tuned: the PLC compares the final settled weight against the target after each fill and adjusts the pre-close weight over a rolling average (typically 5–20 fills).
  • Tare is zeroed with an empty container before the fill valve opens.

Best for: high-value or regulated products where net weight must be guaranteed. Accuracy typically ±0.1 % to ±0.3 % of dose — the highest of any filler technology for liquids.

Parameter Typical tag name Notes
Target fill weight DB_Recipe.TargetWeight_g Set per SKU
Pre-close weight DB_Filling.PreClose_g Auto-tuned
Fine fill flow DB_Recipe.FineFlow_pct % of max valve opening
In-flight average DB_Filling.InFlight_g Rolling average, 10 fills

3. Flow-Meter / Totalizer Filler

A flow-meter filler uses a Coriolis or magnetic flow meter installed in the fill line. The PLC opens the valve, accumulates pulses from the flow meter, and closes the valve when the accumulated pulse count (totalizer) equals the setpoint volume.

PLC control view:

  • The flow meter outputs pulses (frequency output) or communicates via PROFIBUS/EtherNet/IP. Each pulse represents a fixed volume (e.g., 0.1 mL per pulse).
  • The PLC program increments a counter (Fill_Totalizer) on each pulse while the fill valve is open.
  • The fill valve closes when Fill_Totalizer >= DB_Recipe.TargetPulses.
  • A two-stage approach mirrors gravimetric control: at TargetPulses - InFlightPulses the valve throttles to a slow-close position, then closes fully.
  • After each fill the residual (final totalizer minus target) is logged for SPC.

Best for: free-flowing liquids, water, juice, edible oil, chemicals. Accuracy typically ±0.2 % to ±0.5 % depending on meter type and product viscosity. Coriolis meters add density measurement and can work with the gravimetric principle simultaneously.


4. Level Filler (Gravity / Vacuum)

A level filler fills to a fixed liquid level in the container, not to a fixed volume. This is natural for carbonated beverages and glass bottles: the fill tube is inserted to the target height, product flows until the liquid rises to the tube tip and blocks flow.

PLC control view:

  • Control is primarily mechanical (the fill tube length sets the level), but the PLC manages:
    • Valve timing — fill valve opens for a minimum time, then a timeout triggers a fault if no fill-complete signal is received.
    • Counter-pressure sequencing for carbonated products: pre-pressurize bottle with CO₂ → open fill valve → vent excess gas → release bottle.
    • Level sensor outputs (some machines use optical or capacitive level probes to confirm fill level before bottle release).

Best for: carbonated beverages, glass bottles, products where headspace consistency matters more than absolute volume. Speed-optimized for high-speed rotary lines.


5. Time-Pressure Filler

A time-pressure filler holds the product reservoir at a constant pressure and opens the fill valve for a timed interval. Dose = flow rate × time, so accuracy depends on maintaining stable upstream pressure.

PLC control view:

  • Fill time is a recipe parameter (DB_Recipe.FillTime_ms).
  • A pressure transmitter on the reservoir feeds a PID loop controlling a pressure regulator or pump speed. If pressure deviates more than a configurable tolerance, the fill is flagged as suspect.
  • Simplest of all filler types to program; lowest capital cost; most sensitive to product viscosity and temperature changes.

Best for: non-critical applications, thin free-flowing liquids, laboratories, pilot lines. Accuracy typically ±1 % to ±3 %.


The Fill Sequence: Step by Step

Regardless of filler technology, most liquid fillers execute the same logical sequence. The PLC implements this as a state machine — each step is a numbered state, and a transition condition must be true before moving to the next state.

State Name Entry condition Actions Exit condition
0 Idle Machine stopped All outputs off Start command
1 Container index Start commanded Conveyor/index drive active Bottle-present sensor TRUE
2 Nozzle lower Bottle present Nozzle cylinder extend Nozzle-down limit switch
3 Pre-fill check Nozzle down Verify tare (weigh) or zero totalizer Check complete
4 Coarse fill Pre-fill OK Open fill valve (fast) Pre-close threshold reached
5 Fine fill Pre-close reached Throttle valve to slow-close Target reached
6 Fill complete Target reached Close fill valve Settle timer elapsed
7 Nozzle raise Settle done Nozzle cylinder retract Nozzle-up limit switch
8 Weight/level check Nozzle up Read final weight or level sensor Tolerance check pass/fail
9 Accept / reject Check result Set accept or reject flag Container indexed out

On a rotary filler all of these states run in parallel on different filling heads simultaneously. The PLC (or a distributed I/O node per head) executes the sequence independently for each head, synchronized by the rotary encoder position.


Achieving Dosing Accuracy

Dosing accuracy is the defining performance metric for any filling machine. The PLC contributes to accuracy through three mechanisms:

Closed-Loop Feedback

For weigh and flow-meter fillers, the PLC continuously compares actual dispensed quantity against the target during the fill. This is not a simple on/off control — it is a two-stage valve sequence with feedback correction:

IF Fill_Totalizer >= (TargetPulses - InFlightPulses) THEN
    Set Fill_Valve_Slow := TRUE;    (* throttle to fine-fill position *)
    Set Fill_Valve_Fast := FALSE;
END_IF;

IF Fill_Totalizer >= TargetPulses THEN
    Set Fill_Valve_Slow := FALSE;   (* close completely *)
    Fill_Done := TRUE;
END_IF;

In-Flight / Drop Compensation

Product continues to flow for a short time after the valve closes due to residual pressure and pipe volume. The PLC calculates a running average of the overshoot across the last N fills and subtracts it from the pre-close threshold automatically. This self-tuning keeps accuracy stable as product temperature and viscosity drift during a production run.

Recipe Management and Changeover

Every SKU has its own recipe stored in a data block or database:

  • Target weight or volume
  • Coarse-fill flow rate or valve opening percentage
  • Fine-fill threshold
  • Settle time (for gravimetric)
  • In-flight compensation seed value
  • Fill timeout (fault if target not reached within this time)

When the operator selects a product on the HMI, the PLC downloads the recipe in a single block write. No manual setpoint entry is required, eliminating operator error as a source of dosing variance.


No-Bottle-No-Fill and Reject Logic

No-Bottle-No-Fill Interlock

The most critical safety interlock on any filler is no-bottle-no-fill: the fill valve must not open unless a container is confirmed present at the fill station. Dispensing product into an empty station floods the machine, contaminates product, and creates a slip hazard.

The interlock is implemented with a redundant presence check:

  • A diffuse photoelectric sensor or fiber-optic sensor at the fill station confirms a container is present.
  • On weigh fillers a minimum tare weight threshold provides a second confirmation.
  • Both conditions must be TRUE before the fill valve output is permitted to energize.

In ladder logic this appears as a series contact ahead of the fill valve coil:

---[Bottle_Present]---[Fill_Permitted]---[NOT Fill_Fault]---( Fill_Valve )---

Any break in that series — missing bottle, safety fault, or e-stop — de-energizes the valve immediately.

Reject Handling

After every fill the PLC evaluates the result:

  • Weigh filler: final net weight is compared to TargetWeight ± Tolerance_g. Out-of-tolerance containers are flagged.
  • Flow-meter filler: final totalizer count is compared to TargetPulses ± TolerancePulses.
  • Any filler: a fill timeout fault (fill valve open longer than FillTimeout_ms without reaching target) triggers a reject flag.

The reject flag activates a downstream reject station — typically a pneumatic pusher, diverter gate, or air jet — timed to the container's position as it travels down the conveyor. The PLC tracks each container's reject flag through a shift register or FIFO queue synchronized to the conveyor encoder so the reject actuator fires at exactly the right position regardless of line speed.

(* Shift reject flag downstream with conveyor position *)
Reject_FIFO[0] := Fill_RejectFlag;     (* loaded at fill station *)

(* Each encoder pulse shifts the FIFO by one position *)
IF Encoder_Pulse THEN
    FOR i := Reject_FIFO_Length - 1 TO 1 BY -1 DO
        Reject_FIFO[i] := Reject_FIFO[i-1];
    END_FOR;
END_IF;

(* Fire reject actuator when flag reaches reject station position *)
Reject_Actuator := Reject_FIFO[Reject_Station_Offset];

Rejected containers are counted and the count is logged against the batch record for traceability. Consecutive reject counters alert operators to process drift before it becomes a quality event.


CIP and Changeover

Filling machine no-bottle-no-fill interlock and reject shift register PLC logic Two-panel diagram: left panel shows the ladder logic series contact interlock for no-bottle-no-fill preventing the fill valve output unless bottle present and fill permitted; right panel illustrates the FIFO shift register tracking the reject flag downstream to the reject actuator position. No-Bottle-No-Fill Interlock Bottle Present Fill Permitted NOT Fill Fault VALVE Any break in series → valve de-energised Missing bottle, safety fault, e-stop all prevent fill valve output Reject FIFO Shift Register [0] fill stn [1] [2] [N] [R] reject stn Each encoder pulse shifts flag → Reject actuator fires when flag reaches position [R] offset Works at any line speed No-bottle-no-fill ladder interlock (left) and encoder-tracked reject FIFO shift register (right)
Filling machine PLC safety logic: no-bottle-no-fill series contact interlock prevents fill valve output; the reject FIFO shift register tracks each container's pass/fail flag from fill station to reject actuator position.

Clean-in-Place (CIP) Integration

Food, beverage, and pharmaceutical fillers must be cleaned and sanitized between product runs without dismantling the machine. The PLC controls the clean-in-place sequence by switching fill valves, nozzles, and product lines from production mode to CIP mode through a dedicated valve manifold.

A typical CIP sequence from the PLC's perspective:

  1. Drain — open drain valve, run product lines empty using low-pressure air purge.
  2. Pre-rinse — circulate water at high velocity to remove product residue.
  3. Caustic wash — circulate NaOH solution at target temperature and concentration for a programmed dwell time. Temperature and conductivity are monitored in real time.
  4. Intermediate rinse — flush caustic to drain, confirm rinse water conductivity drops below threshold.
  5. Acid wash (where required) — circulate acid solution for mineral scale and biofilm control.
  6. Final rinse — flush to drain, confirm conductivity at near-water level.
  7. Sanitize — circulate sanitizer or perform steam sterilization.
  8. Air blow-out — purge moisture before production restart.

Each step has a minimum time and process validation conditions (temperature, conductivity, flow rate). The step does not advance until both the time and the process conditions are met. CIP records are time-stamped and logged to the batch record for regulatory audit trails.

Recipe Changeover

Changing from a 500 mL dose to a 1 L dose on the same filler is a recipe switch, not a mechanical change. The operator selects the new product on the HMI, the PLC prompts for any required mechanical adjustments (nozzle height, conveyor guide width), waits for operator confirmation, then loads the new data block. Total changeover time for a single-SKU filler with servo-adjusted nozzle height is typically under five minutes.

Changeover is recorded in the batch record with operator ID, timestamp, and before/after recipe names to maintain traceability.


Safety Design for Filling Machines

Filling machine CIP clean-in-place PLC sequence: drain, pre-rinse, caustic wash, acid wash, final rinse, sanitize Horizontal flow diagram of the PLC-controlled clean-in-place CIP sequence for a liquid filling machine, showing seven phases from drain through final sanitize with process validation conditions at each step. DRAIN Open drain Air purge Product out → Pre-rinse PRE-RINSE Water circt High velocity Remove residue Time validated CAUSTIC NaOH solution Temp + conc monitored live Dwell timer INT RINSE Flush caustic Conductivity drops below threshold ACID WASH Acid solution Scale + biofilm control Where required FINAL RINSE Flush to drain Conductivity near water level SANITIZE Sanitizer circ or steam steril Air blow-out Log to batch rec Each phase: minimum time AND process conditions (temp, conductivity, flow) must be met before advancing Total CIP cycle: 45 min – 2 hours · Records time-stamped automatically for regulatory audit Filling machine CIP PLC sequence — each phase validated by time and process condition before step advance
Filling machine CIP sequence controlled by PLC: drain, pre-rinse, caustic wash, intermediate rinse, acid wash, final rinse, and sanitize — each phase advances only when time and conductivity conditions are met.

Filling machines introduce several hazard categories that require specific PLC safety architecture:

Trapped-key and guard interlock: Access panels protecting nozzle and valve areas must be interlocked to a safety relay or safety PLC input. Opening a guard door removes the fill-permitted signal and triggers a controlled stop. The machine must not restart until the door is closed and a deliberate reset is performed.

Emergency stop: The e-stop circuit de-energizes all fill valves and any indexing drives simultaneously. For weigh fillers the load cell is sampled one final time so the last fill result can be evaluated for accept/reject.

Pressure relief: If the product feed is pump-driven, a pressure relief valve in the feed line protects nozzles and valves from overpressure. A pressure transmitter feeds a PLC alarm: if feed pressure exceeds a threshold the fill valve is inhibited and an alarm is raised.

Drip detection: A drip tray level sensor (float switch or conductivity probe) detects spillage below the fill station. Persistent drip triggers a maintenance alarm rather than an immediate stop, but a high-high level triggers a line stop to prevent slip hazards.

Safety PLC architecture: For machines in SIL-rated applications (e.g., pharmaceutical, flammable liquids), safety functions — e-stop, guard interlock, valve de-energize — are implemented on a dedicated safety PLC (e.g., Siemens F-CPU, Allen-Bradley GuardLogix) separate from the standard PLC running the fill sequence. This ensures a PLC application fault cannot prevent a safety function from executing.

For an applied view of these principles in a complete packaging context see the food processing PLC programming guide.


Filling Machine on a Complete Packaging Line

The filler is one station on a line that typically includes:

  • Bottle rinser or depalletizer (upstream)
  • Capper or sealer (immediately downstream)
  • Labeling machine (downstream of capper)
  • Vision inspection, checkweigher, case packer (further downstream)

The PLC at each machine communicates with a line controller (or a coordinating PLC) over PROFINET or EtherNet/IP. The filler reports its current speed, reject count, and fault status upstream; the line controller sends a line-speed reference so the filler indexes at the correct rate to stay synchronized with the capper.

Backpressure management is critical: if the capper jams and its infeed accumulation fills up, the capper signals the filler to hold. The filler completes the current fill cycle, then stops indexing. Bottles already filled wait in a short accumulation lane rather than being filled and left uncapped. This avoids product wastage and contamination.


Frequently Asked Questions

How does a filling machine work?

A filling machine places a container at a fill station, opens a valve or drives a piston, deposits a metered quantity of product, then closes the valve and indexes the container out. The PLC controls the sequence by reading a bottle-present sensor, executing the fill via a timed, volumetric, weight-based, or flow-meter method, and then evaluating the result to accept or reject the filled container.

What is the most accurate filling method?

Gravimetric (weigh) filling is the most accurate method, typically achieving ±0.1 % to ±0.3 % of dose. Accuracy depends on load cell resolution, settle time, and the quality of the PLC's in-flight compensation algorithm. Coriolis flow-meter fillers approach comparable accuracy for free-flowing liquids without requiring the settle-time delay that weigh filling imposes on cycle time.

How does a PLC control fill volume?

Depending on filler type: (1) on a piston filler the PLC sends a servo position target for stroke length; (2) on a weigh filler the PLC reads a load cell analog input and closes the valve when the accumulated weight meets the target minus in-flight compensation; (3) on a flow-meter filler the PLC increments a pulse counter and closes the valve when the totalizer reaches the target pulse count. All three approaches use two-stage valve control — fast fill then slow-close — to minimize overshoot.

What is no-bottle-no-fill?

No-bottle-no-fill is a safety and quality interlock that prevents the fill valve from opening unless a container is confirmed present at the fill station. It is implemented in PLC logic as a series contact (presence sensor + safety conditions) ahead of the fill valve output. Without it, product would be dispensed into the machine, causing waste, contamination, and slip hazards.

How long does a filling machine CIP cycle take?

A typical liquid filler CIP cycle runs between 45 minutes and 2 hours depending on the cleaning chemistry, pipe volume, and regulatory requirements. The PLC enforces minimum dwell times for each phase (pre-rinse, caustic wash, acid wash, final rinse, sanitize) and validates temperature and conductivity at each step before advancing. The completed record is logged automatically for traceability.


Summary

A filling machine PLC program is a state machine that wraps a metering technology — piston stroke, load cell weight, flow-meter totalizer, level, or timed pressure — in a repeatable, fault-tolerant sequence. The key design decisions are:

  • Choose the metering technology matched to product characteristics and accuracy requirements.
  • Implement two-stage fill (coarse + fine) with in-flight compensation to minimize dosing error.
  • Enforce no-bottle-no-fill as a hardwired or series-contact interlock, not just a software flag.
  • Use a shift register or FIFO to track reject flags downstream at line speed.
  • Automate CIP with process validation (temperature, conductivity, time) and automatic logging.
  • Separate safety functions onto a safety-rated PLC or safety relay circuit independent of the standard fill sequence logic.

For a broader treatment of the machines that surround the filler on a production line, see the packaging machine PLC programming guide and the bottling line PLC programming guide.

#fillingmachine#liquidfiller#plcprogramming#packaging#dosing#gravimetricfilling
Share this article:

Related Articles