Fareed Mohmed← Project library

Engineering · PLC · Project 12 of 15 · Process and level · Level 2

Bottle filling station

Place a bottle, press START, the valve opens for 3 seconds and a DONE lamp lights until you remove the bottle.

▶ Run it in the simulator

Virtual machine for Bottle filling station: buttons, lamps and the process it controls
Learning model only. This page teaches the program logic. A real machine needs a proper control panel with an isolator, fuses, motor protection and a hard-wired emergency stop. Mains and motor wiring is for qualified electricians. A PLC output never drives a motor directly.

You will learn

SET and RESET coils: DONE is switched on by one rung and only cleared by another. This is another way to remember an event, and it is the form used in alarm and batch programs.

How it works

  • Click the bottle to place it under the nozzle.
  • Press START. The valve opens for 3 s and the bottle fills.
  • DONE lights. Remove the bottle to clear it.

In real life

Bottling lines, dosing machines, sauce and oil fillers.

Inputs, outputs and addresses

The same signals on seven PLC brands. Inputs and outputs are numbered in order; check your own hardware and software, because addresses depend on the model and module position.

NameWhat it isTypeSiemens
S7-1200
Allen-Bradley
CompactLogix
Mitsubishi
iQ-F FX5U
Delta
DVP / AS
Omron
CP2E
Schneider
M241
Inovance
H5U
STARTSTART push-buttonInput%I0.0Local:1:I.Data.0X0X00.00%IX0.0X0
STOPSTOP push-button (N.C.)Input%I0.1Local:1:I.Data.1X1X10.01%IX0.1X1
BOTTLEBottle present sensorInput%I0.2Local:1:I.Data.2X2X20.02%IX0.2X2
VALVEFilling valveOutput%Q0.0Local:2:O.Data.0Y0Y0100.00%QX0.0Y0
DONEDone lampOutput%Q0.1Local:2:O.Data.1Y1Y1100.01%QX0.1Y1

Ladder diagram (shown for Siemens, live state)

Green wires carry power in the moment captured below. Switch the brand and the language in the simulator.

Rung 1 Fill while the bottle is presentSTART%I0.0FILLING%M0.0STOP%I0.1BOTTLE%I0.2DONE%Q0.1FILLING%M0.0Rung 2 Fill time (3 s)FILLING%M0.0"T1"TONINPT T#3sQETET = 1760 msRung 3 Open the valveFILLING%M0.0VALVE%Q0.0Rung 4 Set DONE when the time is upTimer 1 done"T1".QSDONE%Q0.1Rung 5 Clear DONE when the bottle is removedBOTTLE%I0.2RDONE%Q0.1

Structured text, Siemens SCL

(* Siemens S7-1200, CPU 1214C DC/DC/DC - TIA Portal - SCL *)
(* Rung 1: Fill while the bottle is present *)
"FILLING" := ("START" OR "FILLING") AND "STOP" AND "BOTTLE" AND NOT "DONE";
(* Rung 2: Fill time (3 s) *)
"T1"(IN := "FILLING", PT := T#3s);
(* Rung 3: Open the valve *)
"VALVE" := "FILLING";
(* Rung 4: Set DONE when the time is up *)
IF "T1".Q THEN "DONE" := TRUE; END_IF;
(* Rung 5: Clear DONE when the bottle is removed *)
IF NOT "BOTTLE" THEN "DONE" := FALSE; END_IF;

Structured text, Allen-Bradley

(* Allen-Bradley CompactLogix 5069 (L306ER) - Studio 5000 Logix Designer - Structured Text *)
(* Rung 1: Fill while the bottle is present *)
FILLING := (START OR FILLING) AND STOP AND BOTTLE AND NOT DONE;
(* Rung 2: Fill time (3 s) *)
Timer1.PRE := 3000;   (* ms *)
Timer1.TimerEnable := FILLING;
TONR(Timer1);
(* Rung 3: Open the valve *)
VALVE := FILLING;
(* Rung 4: Set DONE when the time is up *)
IF Timer1.DN THEN DONE := TRUE; END_IF;
(* Rung 5: Clear DONE when the bottle is removed *)
IF NOT BOTTLE THEN DONE := FALSE; END_IF;

Try this

Parts to buy

The links open a search on each store, so you see what is in stock today. Check the model, voltage and price before you order.

#ItemBuy / compare
1PLCAmazon.in · IndiaMART · Robu.in
2Bottle sensorAmazon.in · IndiaMART · Robu.in
3Solenoid valveAmazon.in · IndiaMART · Robu.in
4START and STOP buttonsAmazon.in · IndiaMART · Robu.in
← 11. Oven temperature on / off controlAll projects13. Alarm with acknowledge →

This is a learning tool. It teaches the logic, not the exact keystrokes of each vendor’s software. Check the manual of your own PLC.