BOTTLE FILLING PROCESS
WITH REJECT BUTTON
USING PLC AUTOMATION
Kuncoro D. Wijono, Electrical Engineering, David James. Mechatronics Engineering
Southern Polytechnic State University – Kennesaw State University
I. INTRODUCTION
PLC automation has had a notable impact in a wide range of industries such as
manufacturing. Automation plays an increasingly important role in the world economy,
especially in the soft drink and other beverage industries. For example, the Coca-Cola
Company requires a bottles or cans to be filled with a particular liquid with a continuous
automation solution. Therefore, the goal in this project is to design PLC schematic for
simulating an automated bottle filling process.
In this project, the heart of the system is a SIEMENS PLC trainer as a machine that is
used to prepare the automatic filling process. The system sequence of operation is designed
by ladder diagram, and the programming of this project is designed by using the SIEMENS
Totally Integrated Automation (TIA) portal.
A start button, a pause button, and a photoelectric sensor are the input signals
which are used as references to determine the output signals based on the user’s
requirements. In a real situation, the outputs are electronics and electric devices that are
controlled by the PLC, such as a motor, pump, conveyor belt, buzzer, and led lights.
However, in this simulation, the stepper motor is utilized as a stand-in for the conveyor
motor. The HMI touch-screen monitor functions as both an output display and the 3 input
buttons mentioned before, which can be operated by the user. The monitor, also, has an
optional button to decline unwanted bottles if the operator visually detects any problems.
The technique applied to develop the automated control process is a state-machine method
with 3 digits binary.
II. METHODS
A. THE CONCEPT OF PROJECT ARCHITECTURE
The original method of bottle filling involves placing bottles onto a conveyor and
filling only one bottle at a time. To be more specific, when an empty bottle is placed on the
conveyor belt, which is the stepper motor in the simulation, the bottle starts moving with
the belt until the bottle comes in front of an external photoelectric detector. The position
when bottle blocks the sensor is the filling position and, and the sensor also triggers a timer
to start the filling process. This filling time and position are indicated by a red LED light
illuminating on the PLC trainer. As long as the LED is on, the filling valve is open. After
filling time is done and the LED turns off, a paddle is used to automatically eject the bottle.
If the operator notices an error with any inspected bottles, a manual reject button on HMI
monitor is available to refuse bottles with possible defects. Starting at the center proximity
switch sensor as home and with the paddle in the vertical position, the paddle will rotate
clockwise until it reaches the left proximity sensor, waits for one second, and rotates
counter-clockwise back to the home position if the system is under regular ejecting mode;
conversely, the paddle will rotate counterclockwise to the right proximity sensor, wait for
one second, and rotate clockwise back to the home position when the system is under
rejecting mode. After the rejecting/ejecting process finishes, the conveyor belt will start
back up to carry another bottle and the filling process will repeat the loops until the pause
button is pushed. For an extra control feature, filling time and conveyor belt speed are both
adjustable using two analog dial knobs. Both values, then, are calibrated into a certain
range of number so specifically that the stepper motor (belt) slowest speed is between 1
in/s and 5 in/s or that the fastest filling time has a shortest possible length of 2 seconds
and the longest filling time will be limited to 8 seconds. On the HMI display, there are two
separate ejected and rejected bottle counts with reset button for each.
B. DESCRIPTION OF PLC AND HMI TAGS
Before explaining the solution by using a state machine method, characteristics of every
input, output, and memory state is introduced first as a clarification to understand the
whole process of how the PLC design controls the automation of the bottle filling system:
INPUTS:
START: A normally openbutton onthe HMI whichisusedto setthe programintorun mode.
PAUSE: A normallyopen button(originallyanormallyclosed button,butthiswaschangedinan
attemptto fix a bugcausedby the HMI settingthe PAUSEtag to true initially,evenwithoutinput.
Thisdidnot fix the bug,but wasleftunchangedinthe final projectasit was functionallythe same
eitherway) onthe HMI, usedto take the programout of run mode.
TESTLIGHT: connectedtothe switchat %I0.0, usedas a stand infor the light sensor.
LIGHT: The tag actuallyusedforthe lightsensor.
LEFT: the leftlimitswitch,%I8.1.
RIGHT: The rightlimitswitch,%I8.2.
HOME: The center,top,vertical limitswitch,%I8.0.
REJECT: Normallyopenpushbuttonfromthe HMI usedto selectabottle forrejection.
OUTPUTS:
PADDLE: usedtorun the paddle motor,%Q0.3
DIR: Usedto change the directionthe paddle motortravels,%Q8.0
LED: The pilotlightonthe PLC, %Q0.2
The steppermotordoesnot have an outputcoil associatedwithit,insteadithastwotechnology
objects;MC_Power_DBand MC_MoveJog_DB.
MEMORY:
RUN: A latchedmemorybitusedtorememberwhetherthe programisinrun mode or not.
Q0: a memorybitusedinthe state machine approachas most significantbit(MSB)
Q1: a memorybitusedinthe state machine approachas secondbit
Q2: a memorybitusedinthe state machine approachas leastsignificantbit(LSB)
Q0*: a memorybitusedto update Q0.
Q1*: a memorybitusedto update Q1.
Q2*: a memorybitusedto update Q2.
EJECTING: A memorybitusedto designate whenthe programshouldbe ejectingabottle.
REJECTING: A memorybitusedto designate whenthe programshouldbe rejectingabottle.
CONVEYING:A memorybitusedto designate whetherthe steppershouldbe running ornot.
FILLING:Memory bitusedto designate whenthe bottleshouldbe gettingfilled,alsousedtoturnon
the LED.
EJECTING:
NEWEJECTED: A memorybitusedto designate whetherabottle issetto be ejected,settotrue
whenthe filltimercompletesand the bottle hasn’tbeenrejected.
EJECTED: Memory bitsetto true whena bottle hasbeensuccessfullyejected.
EGO: A memorybitusedto rememberwhenthe programisinthe EJECTING state and isgoing
clockwise towardthe leftlimitswitch.
ERETURN: A memorybitusedto rememberwhenthe programisinthe EJECTING state and isgoing
counterclockwise,returningfromthe leftlimitswitchtothe top,vertical,HOMElimitswitch.
EJECTTALLY(1): Usedto store the currentvalue fromthe EJECTTALLIER CTU counter andto display
thison the HMI.
ERESET: Connectedtothe normallyopen“RESETEJECT COUNT” buttonon the HMI, andusedto
resetthe EJECTTALLIER CTU counter(restoringthe CV to0).
REJECTING:
NEWREJECTED: SimilartoNEWEJECTED, but usedtoremember whetherabottle hasbeenselected
for rejection.
REJECTED: Similartothe EJECTED tag, usedwhena bottle issuccessfullyrejected.
RGO: SimilartoEGO, a memorybitusedtorememberwhenthe programisinthe REJECTING state
and isgoingcounterclockwise towardthe rightlimitswitch.
RRETURN: SimilartoERETURN, a memorybitusedto rememberwhenthe programisinthe
REJECTING state and isgoingclockwise,returningfromthe rightlimitswitchtothe top,vertical,
HOME limitswitch.
REJECTTALLY: Used to store the current value fromthe REJECTTALLIER CTU counterand to display
thison the HMI.
RRESET: Connectedtothe normallyopen“RESET REJECT COUNT” buttonon the HMI, and usedto
resetthe REJECTTALLIER CTU counter(restoringthe currentvalue to0).
FILLING:
FILLTIMER: Connectedtothe outputof a TON timer,setto true whenthe timerfinishescountingor
whenthe rejectbuttonispressed.Usedtotell whenthe programshouldexitthe FILLINGstate.
FILLED: A memorybitusedto rememberwhetherornota bottle hasbeenfilled.
STEPPER MOTOR SPEED CONTROL:
BELTSPEED: An inputwordconnectedtoone of the analogdials,%IW66.
BSINT:BELTSPEED convertedintointegerform.
BSMX: A real numbery,where y=0.0001299(BSINT)
BSPENULTIMATE: the secondto last stepfor BELTSPEED, equal toBSMX+1.
BSFINAL:Equal to BSPENULTIMATE, butwitha limitedrange from1.0 to 5.0, to preventanalog
interference causingthe numbertofluctuate tonumberseitherhigherorlowerthanthe intended
maximumorminimumvelocitiesforthe steppermotorinthe program.Thisnumberisboth
displayedonthe HMI,as well asfedintothe velocityinputforthe MC_MoveJog_DBobject.
LENGTH OF FILL TIME CONTROL:
FILLSPEED: Aninputwordconnectedtoone of the inputdials,%IW64.
FSINT:FILLSPEED convertedintointegerform.
FSMX: A real numbery,where y=0.0001949(FSINT)
FSPENULTIMATE: The secondto laststepfor FILLSPEED,equal to FSMX+2
FSFINAL:Equal to FSPENULTIMATE,but witha limitedrange from2.0 to 8.0, to preventanalog
interference causingthe numbertofluctuate tonumberseitherhigherorlowerthanthe intended
fill time lengths.Thisnumberisdisplayedonthe HMI.
FSDINT1: equal toFSFINALmultipliedby1000.
FSDINT:ConvertsFSDINT1froma real to a double int.Thisis the numberusedasthe PT inputinthe
FILLTIME TON timer.
C. STATE MACHINE METHOD
Compared to an Ad-hoc solution, the State-Machine solution has less guesswork to
changing state of filling system. There are 5 states in this state machine diagram:
 Paused State
 Conveying State
 Rejecting State
 Filling State
 Ejecting State
Figure 1.1 Bottle filling system State-Machine Diagram
Q0 Q1 Q2 Transition Equation Q0* Q1* Q2*
0 0 1 RUN•LIGHT•NEWREJECTED 1 0 0
0 1 1 REJECT 1 0 0
1 0 0 REJECTING•(RUN+RGO) 1 0 0
0 0 0 RUN•LIGHT•NEWREJECTED 1 0 0
0 1 1 FILLING•L̅I̅G̅H̅T̅ 1 0 0
0 0 0 RUN•LIGHT•NEWEJECTED 0 1 0
0 0 0 RUN•LIGHT•N̅E̅W̅E̅J̅E̅C̅T̅E̅D̅•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 1
0 0 1 RUN•LIGHT•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 1
0 1 0 EJECTING•RUN+EJECTING•RUN•EGO 0 1 0
0 1 1 RUN•FILLTIMER•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 0
0 1 1 FILLING•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 0
0 0 0 RUN•L̅I̅G̅H̅T̅ 0 0 1
0 0 1 RUN•CONVEYING 0 0 1
0 1 0 RUN•EJECTED 0 0 1
0 1 1 FILLING•F̅I̅L̅L̅T̅I̅M̅E̅R̅•LIGHT 0 0 1
1 0 0 RUN•REJECTED 0 0 1
0 1 1 RUN•L̅I̅G̅H̅T̅•F̅I̅L̅L̅T̅I̅M̅E̅R̅ 0 0 1
0 0 0 R̅U̅N̅ 0 0 0
0 0 1 R̅U̅N̅ 0 0 0
0 1 0 R̅U̅N̅•EJECTED 0 0 0
0 1 1 R̅U̅N̅•FILLTIMER 0 0 0
1 0 0 R̅U̅N̅•REJECTED 0 0 0
State machine transitions can be seen in the diagram table 1 above, and are derived
from our diagram solution (see figure 1.1). Since zeros on table 1 covers the most part in
three leftmost columns (Q0*, Q1* and Q2*), only one value will be chosen to update the
state machine for every cycle (see figure 1.2-1.4 below), as follow:
𝑄0 ∗= ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + ( 𝑄0̅̅̅̅∗ 𝑄1 ∗ 𝑄2 ∗ 𝑅𝐸𝐽𝐸𝐶𝑇)
+ [ 𝑄0 ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝐸𝐽𝐸𝐶𝑇𝐼𝑁𝐺 ∗ ( 𝑅𝑈𝑁 + 𝑅𝐺𝑂)]
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷)
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2 ∗ 𝐹𝐼𝐿𝐿𝐼𝑁𝐺 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅)
𝑄1 ∗= ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷)
+ ( 𝑄0̅̅̅̅∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅)
+ ( 𝑄0̅̅̅̅∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅)
+ [ 𝑄0̅̅̅̅∗ 𝑄1 ∗ 𝑄2̅̅̅̅ ∗ 𝐸𝐽𝐸𝐶𝑇𝐼𝑁𝐺 ∗ { 𝑅𝑈𝑁 + ( 𝐸𝐺𝑂 ∗ 𝑅𝑈𝑁)}] + 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2
∗ 𝑅𝑈𝑁 ∗ 𝐹𝐼𝐿𝐿𝑇𝐼𝑀𝐸𝑅 ∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + (𝑄0̅̅̅̅∗ 𝑄1 ∗ 𝑄2 ∗ 𝐹𝐼𝐿𝐿𝐼𝑁𝐺
∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅)
Table 1. State machine transition diagram
Figure 1.2 Q0* diagram
Figure 1.3 Q1* Diagram
Figure1.4 Q2* diagram
𝑄2 ∗= ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇)
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝑁𝐸𝑊𝑅𝐸𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅)
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝐶𝑂𝑁𝑉𝐸𝑌𝐼𝑁𝐺)
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅)
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝐸𝐽𝐸𝐶𝑇𝐸𝐷)
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2 ∗ 𝐹𝐼𝐿𝐿𝐼𝑁𝐺 ∗ 𝐹𝐼𝐿𝐿𝑇𝐼𝑀𝐸𝑅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇)
+ ( 𝑄0 ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷)
+ ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝐹𝐼𝐿𝐿𝑇𝐼𝑀𝐸𝑅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅)
These three starred memory bits will automatically update their next cycle memory
after all the processing, and executing finish running, as shown in figure 1.5 below, which is
the last part of state machine design.
D. DESCRIPTION OF MEMORY STATES
1) RUN MEMORY STATE
From figure 2.1 above, as long as the machine has not started yet, the system is in
the paused state as the default reset mode or state 000. Whenever the start button is
pushed and pause button is not pushed, the system will be set in run (mode) memory.
However, if pause button is pushed on run mode, it will reset the run memory (see figure
2.1):
1. The machine will stop conveying when it was on conveying state and return
back to paused state.
2. When system is in ejecting or rejecting state, it will wait for the paddle
motion to finish and then directly return to the paused mode.
Figure 2.1 Start&pause button controlling run mode
Figure 1.5 State machine update
3. If the system is currently filling a bottle and the pause button is pushed, the
machine will continue filling the bottle until the value set by the FILLSPEED
analog dial is reached, then return to the paused state.
2) CONVEYING (MEMORY) STATE
When the sensor is
not blocked by either an
empty or a filled bottle or
in either the ejecting or
rejecting mode, the
conveyor moves empty
bottles as long as run
memory is on, and this
state is called conveying;
or state 001. From bottom
part of figure 2.2, double
word memory (MD40),
has BSFINAL PLC tag is
the adjustable belt speed
control that is controlled
by analog dial knob (see
HMI and PLC tags
subchapter).
Figure 2.2. Conveying state PLC diagram
3) FILLING (MEMORY) STATE
After the conveyor belt (stepper motor) finishes carrying an empty bottle to the filling
position, the photo sensor is blocked, and state machine will change from the conveying
state (001 state) into the filling state (011 state).
Figure 2.3 Filling (memory) state and its related controlling memory
From figure 2.3 above, the system will stay filling even if the pause button is pressed
(run mode off). The red LED light indicating that the bottle filling operation is still active is
turned on or off depending on whether the FILLTIMER memory tag (M2.3) is true after the
calibrated FSDINT memory (MD22) value is reached or when the operator presses the
reject button. While this is true, the system is still in the FILLING state, and the TESTLIGHT
(photo sensor) is blocked. Also, when the FILLTIMER tag is TRUE (not done filling or
rejected by the operator), the FILLING state is not finished (not FILLED); after the paddle
hits the left proximity sensor, FILLING is done, which means that FILLED is, also, done.
4) EJECTING (MEMORY) STATE
Figure 2.4-12. Ejecting state and other ejecting related input memories for paddle motion and counters
If the operator doesn’t press the REJECT button, the system is under the EJECTING
state or state 010 (see figure 1.1). After the machine finishes filling the bottle and the pause
button has not been pressed (RUN mode on), the paddle will rotate clockwise to push the
filled bottle off of the belt (ejecting motion), which makes the light sensor unblocked and
returns the system back to the CONVEYING state.
Before explaining, it is strongly recommended to skim through EJECTING part of
HMI and PLC tags on page 4. Relating to the explanation of the EGO memory bit as the reset
to the FILLED memory bit, the EGO state describes paddle direction when ejecting in a
clockwise motion until the paddle reaches the left proximity switch; then the left proximity
switch resets the EGO state. Following the finish of the EGO state, the paddle will stay on
the left proximity switch for one second by using the paddle-motor ladder logic (see figure
2.4-2) to make sure the bottle is totally ejected from conveyor belt.
For the paddle returning motion to the home position after the one second delay on
the left proximity sensor, the ERETURN memory bit is used to control the paddle’s counter-
clockwise movement. As long as the system is under the EJECTING mode or the pause
button has been pressed with rejecting button is not pushed, the system will finish the
motion by reaching the middle sensor (HOME). The above algorithm is specifically
designed to avoid any input interruption that might stop the paddle returning back to the
HOME position.
Furthermore, the EJECTED memory bit is used to make a counter count up after
every ejecting motion is finished; meanwhile, the NEWEJECTED memory bit is a safety
memory bit to determine that a bottle is going to ejected after FILLTIMER completes and
bottle is under RUN mode on and REJECTED button is not pressed.
Figure 3. Paddle-motor ERETURN AND RRETURN schematic
5) REJECTING (MEMORY) STATE
Figure 4.5. REJECTING state schematic and
other rejecting related input memories for paddle motion and counters
Once the operator visually detects a defect on any given bottle, the REJECT button
on the HMI display can be pushed and the system will run into the REJECTING mode, or
state 100 (see figure 1.1). Inside the REJECTING state, everything is very similar to
EJECTING mode with inverse directions.
On figure 2.5 above, RGO works similar to how EGO works, explained on page 15;
however, instead of using the left sensor (LEFT), RGO is finalized by reaching the right
proximity sensor (RIGHT). Then, the paddle will stay for one second (see figure 2.4-2).
RRETURN, REJECTED, and NEWREJECTED memory each work exactly the same as their
counterpart in ERETURN, EJECTED, and NEWEJECTED from the EJECTING mode.
6) EJECT AND REJECT COUNTER MEMORY
From figure 2.6 to the right, the type
of counter used for both EJECTING and
REJECTING mode is an Up Counter (CTU).
The reset input signal is ERESET, connected
to the normally open “RESET REJECT
COUNT” button or RRESET, connected to
the “RESET EJECT COUNT” button on HMI
display (see figure 3.1). Preset Value is set
to 100 as a acceptable limit for simulation
purpose, though the output for these
Figure 5. Eject and reject tally schematic
counters is never used, so the Preset Value doesn’t actually matter.
7) CONVEYOR BELT SPEED MEMORIES
The BELTSPEED analog input
signal needs to be modified to meet an
acceptable range for the user;
therefore, a certain algorithm is
required to achieve a better control on
belt speed.
First, the input is in a 16 bit string,
which needs to be converted to an
integer. The new converted integer
value (BSINT) is altered with an
arithmetic algorithm, as follow:
BSFINAL = (BSINT ∗ 0.0001299)+ 1
On bottom part of figure 2.7, BSFINAL is the final result with a limiter with range from
1.0 to 5.0 for the calculated value of above equation. The limiter is used to prevent analog
noise causing the output to swing out of the intended velocities for the stepper motor.
BSFINAL value is an input to the MC_MOVEJOG_DB speed controller (see page 12).
Figure 6. Belt speed controller memories schematic
8) FILLING SPEED MEMORIES
To be clearer with memories on the
right, please read “LENGTH OF FILL
TIME CONTROL” subsection on page 5.
Very similar to the belt speed
memories on the previous page,
FILLSPEED input analog signal is
converted to integer memory, FSINT.
By following the below equation,
FSFINAL can be calculated with range
from 2.0 to 8.0 as an output on the HMI
display:
FSFINAL = (FSINT ∗ 0.0001949)+ 2
Because On Timer (TON) for
FILLTIME memory in FILLING state
(page 13) requires double integer and
the default unit for TON is millisecond,
FSFINAL needs to multiplied by 1000
to range between 2 seconds and 8
seconds and, then, to be converted
into double integer type. This value, FSDINT is used to control the length of time the
FILLTIME timer uses as it’s preset value.
Figure 7.1 Filling speed controller memories schematic
9) PHOTOELECTRIC SENSOR
In this project, the LIGHT memory bit,
which is connected to a photo sensor, is
operated with a VEX brand light sensor. A simple
diagram can be seen on figure 9; red cable needs a +5V DC input and the black cable is
grounded. The output ranges from very small voltage, which is close to 0 V, to 3 V DC.
However, the PLC trainer machine requires a voltage close to 15 V in order to be
considered as an input signal [3].
Therefore, an OP-AMP amplifier is required to obtain the desired output signal
strength. An LM 358-N Amplifier was provided and was sufficient enough to increase
sensor output voltage [2]. From the pin configuration of the amplifier (see figure 2.9-3),
necessary power supply for amplifier is 15 V DC so maximum output of boosted light
sensor output value Is less than 15 Volts. By using a voltage divider method, a 2000 Ω
resistor is wired between V- and ground; while a resistor with 10,000 Ω resistance is wired
between V- and Vout.
Figure 8. VEX light sensor
Figure 9 VEX light sensor schematic
Then, 3V voltage from light sensor output is increased into approximately 14.5 V DC
when light sensor is unblocked (bright) and 200 mV when the light sensor is blocked
(dark).
To achieve +5V DC input on light sensor red cable from the same power supply,
another voltage divider method is used by using 220 Ω resistor with 470 Ω resistor in
series. By calculating 220 divided by (220+470), 31% of 15 Volt power supply (4.78 V DC)
is adequate to power the light sensor on properly without getting another power supply.
Overall wire connection can be seen on figure 3.2.
Figure 10. Pin configuration for LM 358-N OP-AMPS
10) HMI-PLC Interconnection
The HMI screen interconnects with several of the PLC tags, as has been tangentially
mentioned in the other subsections of the paper. These tags include the START tag,
which for the PLC is a memory bit, but in the HMI, sets the PLC START memory bit when
the button is pressed, and resets the bit when the button is released. The PAUSE,
REJECT, ERESET, and RRESET tags work the same way with the PAUSE, REJECT, RESET
EJECT COUNT, and RESET REJECT COUNT buttons respectively. Finally, the EJECT
COUNT, REJECT COUNT, Fill Time Length (s), and Belt Speed (in/s) fields are all output
fields which pull their values from the EJECTTALLY(1), REJECTTALLY, FSDINT, and
BSFINAL PLC tags, respectively. By communicating between the PLC CPU and the HMI,
values are able to be updated as the program runs, and different input and output types
can be used.
III. RESULTS
All of the systems of the desired project are implemented and the results of the
system illustrated on figure 3.1. During the operation, all activities that occur can be
observed by the debugging program, symbolized by glasses with a green play button, inside
the TIA interface online mode. The bottle filling system will start when green START button
is pressed and the stepper motor will start running until the light sensor is blocked. If the
operator doesn’t press the REJECT button, the paddle will rotate clockwise and finish
ejecting motion; if the REJECT button is pressed, the paddle will rotate counter-clockwise
and finish rejecting motion. Afterwards, EJECT COUNT will count as 1 or REJECT COUNT
value will be 1 if the system rejects the bottle. Fill time length ranges from 2 seconds to 8
seconds, while belt speed ranges from 1 to 5 speed value.
Figure 11 Final HMI display
A DC 15V power supply is also required for powering up the light sensor and
its related components. The wiring system is based on the PLC electrical wiring concept
on pages 22 and 23. The output of the amplifier is then connected to PLC I/O expansion
module, input number 4, and expansion module input number 3 is connected to
GROUND (see figure 3.2)
Figure 3.2 Light sensor wiring connections
IV. CONCLUSION AND RECOMMENDATION
An automatic bottle filling simulation system using SIEMENS PLC Trainer TIA
program has been successfully built and designed by utilizing the State Machine concept,
mixed with a little Ad-Hoc method for the internal functions of some of the states. The
system can be smoother if some of electrical devices and system are upgraded and
improved without any errors, especially with the stepper motor.
The theory and concept of automatic bottle filling system with reject feature is
based on criteria of user expectations by following SIEMENS manual specs [1]. Features
and functions of the electrical components are required to determine system requirement.
In programming side, understanding of the desired system and how to use state machine
diagram to comprehend the machine sequence of operation are the most important parts.
The main goal of this project, which is to design PLC program to fill and eject/reject bottle
automatically, is successfully done as planned.
REFERENCES
[1] Siemens. ‘Basic Of PLCs’ STEP 2000 series, Siemens Technical
Education Program.
[2] LMx58-N Low-Power, Dual-Operational Amplifiers. Texas Instrument,
January 2000. http://www.ti.com/lit/ds/symlink/lm158-n.pdf.
[3] Light Sensor. VEX: ROBOTICS DESIGN SYSTEM.
http://www.vexrobotics.com/wiki/index.php/Light_Sensor.

JamesWijonoPLCBottleFilling

  • 1.
    BOTTLE FILLING PROCESS WITHREJECT BUTTON USING PLC AUTOMATION Kuncoro D. Wijono, Electrical Engineering, David James. Mechatronics Engineering Southern Polytechnic State University – Kennesaw State University I. INTRODUCTION PLC automation has had a notable impact in a wide range of industries such as manufacturing. Automation plays an increasingly important role in the world economy, especially in the soft drink and other beverage industries. For example, the Coca-Cola Company requires a bottles or cans to be filled with a particular liquid with a continuous automation solution. Therefore, the goal in this project is to design PLC schematic for simulating an automated bottle filling process. In this project, the heart of the system is a SIEMENS PLC trainer as a machine that is used to prepare the automatic filling process. The system sequence of operation is designed by ladder diagram, and the programming of this project is designed by using the SIEMENS Totally Integrated Automation (TIA) portal. A start button, a pause button, and a photoelectric sensor are the input signals which are used as references to determine the output signals based on the user’s requirements. In a real situation, the outputs are electronics and electric devices that are controlled by the PLC, such as a motor, pump, conveyor belt, buzzer, and led lights. However, in this simulation, the stepper motor is utilized as a stand-in for the conveyor motor. The HMI touch-screen monitor functions as both an output display and the 3 input buttons mentioned before, which can be operated by the user. The monitor, also, has an optional button to decline unwanted bottles if the operator visually detects any problems.
  • 2.
    The technique appliedto develop the automated control process is a state-machine method with 3 digits binary. II. METHODS A. THE CONCEPT OF PROJECT ARCHITECTURE The original method of bottle filling involves placing bottles onto a conveyor and filling only one bottle at a time. To be more specific, when an empty bottle is placed on the conveyor belt, which is the stepper motor in the simulation, the bottle starts moving with the belt until the bottle comes in front of an external photoelectric detector. The position when bottle blocks the sensor is the filling position and, and the sensor also triggers a timer to start the filling process. This filling time and position are indicated by a red LED light illuminating on the PLC trainer. As long as the LED is on, the filling valve is open. After filling time is done and the LED turns off, a paddle is used to automatically eject the bottle. If the operator notices an error with any inspected bottles, a manual reject button on HMI monitor is available to refuse bottles with possible defects. Starting at the center proximity switch sensor as home and with the paddle in the vertical position, the paddle will rotate clockwise until it reaches the left proximity sensor, waits for one second, and rotates counter-clockwise back to the home position if the system is under regular ejecting mode; conversely, the paddle will rotate counterclockwise to the right proximity sensor, wait for one second, and rotate clockwise back to the home position when the system is under rejecting mode. After the rejecting/ejecting process finishes, the conveyor belt will start back up to carry another bottle and the filling process will repeat the loops until the pause button is pushed. For an extra control feature, filling time and conveyor belt speed are both adjustable using two analog dial knobs. Both values, then, are calibrated into a certain range of number so specifically that the stepper motor (belt) slowest speed is between 1 in/s and 5 in/s or that the fastest filling time has a shortest possible length of 2 seconds and the longest filling time will be limited to 8 seconds. On the HMI display, there are two separate ejected and rejected bottle counts with reset button for each.
  • 3.
    B. DESCRIPTION OFPLC AND HMI TAGS Before explaining the solution by using a state machine method, characteristics of every input, output, and memory state is introduced first as a clarification to understand the whole process of how the PLC design controls the automation of the bottle filling system: INPUTS: START: A normally openbutton onthe HMI whichisusedto setthe programintorun mode. PAUSE: A normallyopen button(originallyanormallyclosed button,butthiswaschangedinan attemptto fix a bugcausedby the HMI settingthe PAUSEtag to true initially,evenwithoutinput. Thisdidnot fix the bug,but wasleftunchangedinthe final projectasit was functionallythe same eitherway) onthe HMI, usedto take the programout of run mode. TESTLIGHT: connectedtothe switchat %I0.0, usedas a stand infor the light sensor. LIGHT: The tag actuallyusedforthe lightsensor. LEFT: the leftlimitswitch,%I8.1. RIGHT: The rightlimitswitch,%I8.2. HOME: The center,top,vertical limitswitch,%I8.0. REJECT: Normallyopenpushbuttonfromthe HMI usedto selectabottle forrejection. OUTPUTS: PADDLE: usedtorun the paddle motor,%Q0.3 DIR: Usedto change the directionthe paddle motortravels,%Q8.0 LED: The pilotlightonthe PLC, %Q0.2
  • 4.
    The steppermotordoesnot havean outputcoil associatedwithit,insteadithastwotechnology objects;MC_Power_DBand MC_MoveJog_DB. MEMORY: RUN: A latchedmemorybitusedtorememberwhetherthe programisinrun mode or not. Q0: a memorybitusedinthe state machine approachas most significantbit(MSB) Q1: a memorybitusedinthe state machine approachas secondbit Q2: a memorybitusedinthe state machine approachas leastsignificantbit(LSB) Q0*: a memorybitusedto update Q0. Q1*: a memorybitusedto update Q1. Q2*: a memorybitusedto update Q2. EJECTING: A memorybitusedto designate whenthe programshouldbe ejectingabottle. REJECTING: A memorybitusedto designate whenthe programshouldbe rejectingabottle. CONVEYING:A memorybitusedto designate whetherthe steppershouldbe running ornot. FILLING:Memory bitusedto designate whenthe bottleshouldbe gettingfilled,alsousedtoturnon the LED. EJECTING: NEWEJECTED: A memorybitusedto designate whetherabottle issetto be ejected,settotrue whenthe filltimercompletesand the bottle hasn’tbeenrejected. EJECTED: Memory bitsetto true whena bottle hasbeensuccessfullyejected.
  • 5.
    EGO: A memorybitusedtorememberwhenthe programisinthe EJECTING state and isgoing clockwise towardthe leftlimitswitch. ERETURN: A memorybitusedto rememberwhenthe programisinthe EJECTING state and isgoing counterclockwise,returningfromthe leftlimitswitchtothe top,vertical,HOMElimitswitch. EJECTTALLY(1): Usedto store the currentvalue fromthe EJECTTALLIER CTU counter andto display thison the HMI. ERESET: Connectedtothe normallyopen“RESETEJECT COUNT” buttonon the HMI, andusedto resetthe EJECTTALLIER CTU counter(restoringthe CV to0). REJECTING: NEWREJECTED: SimilartoNEWEJECTED, but usedtoremember whetherabottle hasbeenselected for rejection. REJECTED: Similartothe EJECTED tag, usedwhena bottle issuccessfullyrejected. RGO: SimilartoEGO, a memorybitusedtorememberwhenthe programisinthe REJECTING state and isgoingcounterclockwise towardthe rightlimitswitch. RRETURN: SimilartoERETURN, a memorybitusedto rememberwhenthe programisinthe REJECTING state and isgoingclockwise,returningfromthe rightlimitswitchtothe top,vertical, HOME limitswitch. REJECTTALLY: Used to store the current value fromthe REJECTTALLIER CTU counterand to display thison the HMI. RRESET: Connectedtothe normallyopen“RESET REJECT COUNT” buttonon the HMI, and usedto resetthe REJECTTALLIER CTU counter(restoringthe currentvalue to0). FILLING: FILLTIMER: Connectedtothe outputof a TON timer,setto true whenthe timerfinishescountingor whenthe rejectbuttonispressed.Usedtotell whenthe programshouldexitthe FILLINGstate. FILLED: A memorybitusedto rememberwhetherornota bottle hasbeenfilled. STEPPER MOTOR SPEED CONTROL: BELTSPEED: An inputwordconnectedtoone of the analogdials,%IW66.
  • 6.
    BSINT:BELTSPEED convertedintointegerform. BSMX: Areal numbery,where y=0.0001299(BSINT) BSPENULTIMATE: the secondto last stepfor BELTSPEED, equal toBSMX+1. BSFINAL:Equal to BSPENULTIMATE, butwitha limitedrange from1.0 to 5.0, to preventanalog interference causingthe numbertofluctuate tonumberseitherhigherorlowerthanthe intended maximumorminimumvelocitiesforthe steppermotorinthe program.Thisnumberisboth displayedonthe HMI,as well asfedintothe velocityinputforthe MC_MoveJog_DBobject. LENGTH OF FILL TIME CONTROL: FILLSPEED: Aninputwordconnectedtoone of the inputdials,%IW64. FSINT:FILLSPEED convertedintointegerform. FSMX: A real numbery,where y=0.0001949(FSINT) FSPENULTIMATE: The secondto laststepfor FILLSPEED,equal to FSMX+2 FSFINAL:Equal to FSPENULTIMATE,but witha limitedrange from2.0 to 8.0, to preventanalog interference causingthe numbertofluctuate tonumberseitherhigherorlowerthanthe intended fill time lengths.Thisnumberisdisplayedonthe HMI. FSDINT1: equal toFSFINALmultipliedby1000. FSDINT:ConvertsFSDINT1froma real to a double int.Thisis the numberusedasthe PT inputinthe FILLTIME TON timer.
  • 7.
    C. STATE MACHINEMETHOD Compared to an Ad-hoc solution, the State-Machine solution has less guesswork to changing state of filling system. There are 5 states in this state machine diagram:  Paused State  Conveying State  Rejecting State  Filling State  Ejecting State Figure 1.1 Bottle filling system State-Machine Diagram
  • 8.
    Q0 Q1 Q2Transition Equation Q0* Q1* Q2* 0 0 1 RUN•LIGHT•NEWREJECTED 1 0 0 0 1 1 REJECT 1 0 0 1 0 0 REJECTING•(RUN+RGO) 1 0 0 0 0 0 RUN•LIGHT•NEWREJECTED 1 0 0 0 1 1 FILLING•L̅I̅G̅H̅T̅ 1 0 0 0 0 0 RUN•LIGHT•NEWEJECTED 0 1 0 0 0 0 RUN•LIGHT•N̅E̅W̅E̅J̅E̅C̅T̅E̅D̅•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 1 0 0 1 RUN•LIGHT•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 1 0 1 0 EJECTING•RUN+EJECTING•RUN•EGO 0 1 0 0 1 1 RUN•FILLTIMER•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 0 0 1 1 FILLING•N̅E̅W̅R̅E̅J̅E̅C̅T̅E̅D̅ 0 1 0 0 0 0 RUN•L̅I̅G̅H̅T̅ 0 0 1 0 0 1 RUN•CONVEYING 0 0 1 0 1 0 RUN•EJECTED 0 0 1 0 1 1 FILLING•F̅I̅L̅L̅T̅I̅M̅E̅R̅•LIGHT 0 0 1 1 0 0 RUN•REJECTED 0 0 1 0 1 1 RUN•L̅I̅G̅H̅T̅•F̅I̅L̅L̅T̅I̅M̅E̅R̅ 0 0 1 0 0 0 R̅U̅N̅ 0 0 0 0 0 1 R̅U̅N̅ 0 0 0 0 1 0 R̅U̅N̅•EJECTED 0 0 0 0 1 1 R̅U̅N̅•FILLTIMER 0 0 0 1 0 0 R̅U̅N̅•REJECTED 0 0 0 State machine transitions can be seen in the diagram table 1 above, and are derived from our diagram solution (see figure 1.1). Since zeros on table 1 covers the most part in three leftmost columns (Q0*, Q1* and Q2*), only one value will be chosen to update the state machine for every cycle (see figure 1.2-1.4 below), as follow: 𝑄0 ∗= ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + ( 𝑄0̅̅̅̅∗ 𝑄1 ∗ 𝑄2 ∗ 𝑅𝐸𝐽𝐸𝐶𝑇) + [ 𝑄0 ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝐸𝐽𝐸𝐶𝑇𝐼𝑁𝐺 ∗ ( 𝑅𝑈𝑁 + 𝑅𝐺𝑂)] + ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2 ∗ 𝐹𝐼𝐿𝐿𝐼𝑁𝐺 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅) 𝑄1 ∗= ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + ( 𝑄0̅̅̅̅∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅) + ( 𝑄0̅̅̅̅∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅) + [ 𝑄0̅̅̅̅∗ 𝑄1 ∗ 𝑄2̅̅̅̅ ∗ 𝐸𝐽𝐸𝐶𝑇𝐼𝑁𝐺 ∗ { 𝑅𝑈𝑁 + ( 𝐸𝐺𝑂 ∗ 𝑅𝑈𝑁)}] + 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝐹𝐼𝐿𝐿𝑇𝐼𝑀𝐸𝑅 ∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + (𝑄0̅̅̅̅∗ 𝑄1 ∗ 𝑄2 ∗ 𝐹𝐼𝐿𝐿𝐼𝑁𝐺 ∗ 𝑁𝐸𝑊𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅) Table 1. State machine transition diagram
  • 9.
    Figure 1.2 Q0*diagram Figure 1.3 Q1* Diagram
  • 10.
    Figure1.4 Q2* diagram 𝑄2∗= ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇) + ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝑁𝐸𝑊𝑅𝐸𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅) + ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝐶𝑂𝑁𝑉𝐸𝑌𝐼𝑁𝐺) + ( 𝑄0̅̅̅̅ ∗ 𝑄1̅̅̅̅ ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇 ∗ 𝑁𝐸𝑊𝐸𝐽𝐸𝐶𝑇𝐸𝐷̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅) + ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2 ∗ 𝐹𝐼𝐿𝐿𝐼𝑁𝐺 ∗ 𝐹𝐼𝐿𝐿𝑇𝐼𝑀𝐸𝑅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇) + ( 𝑄0 ∗ 𝑄1̅̅̅̅ ∗ 𝑄2̅̅̅̅ ∗ 𝑅𝑈𝑁 ∗ 𝑅𝐸𝐽𝐸𝐶𝑇𝐸𝐷) + ( 𝑄0̅̅̅̅ ∗ 𝑄1 ∗ 𝑄2 ∗ 𝑅𝑈𝑁 ∗ 𝑇𝐸𝑆𝑇𝐿𝐼𝐺𝐻𝑇̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ∗ 𝐹𝐼𝐿𝐿𝑇𝐼𝑀𝐸𝑅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅) These three starred memory bits will automatically update their next cycle memory after all the processing, and executing finish running, as shown in figure 1.5 below, which is the last part of state machine design.
  • 11.
    D. DESCRIPTION OFMEMORY STATES 1) RUN MEMORY STATE From figure 2.1 above, as long as the machine has not started yet, the system is in the paused state as the default reset mode or state 000. Whenever the start button is pushed and pause button is not pushed, the system will be set in run (mode) memory. However, if pause button is pushed on run mode, it will reset the run memory (see figure 2.1): 1. The machine will stop conveying when it was on conveying state and return back to paused state. 2. When system is in ejecting or rejecting state, it will wait for the paddle motion to finish and then directly return to the paused mode. Figure 2.1 Start&pause button controlling run mode Figure 1.5 State machine update
  • 12.
    3. If thesystem is currently filling a bottle and the pause button is pushed, the machine will continue filling the bottle until the value set by the FILLSPEED analog dial is reached, then return to the paused state. 2) CONVEYING (MEMORY) STATE When the sensor is not blocked by either an empty or a filled bottle or in either the ejecting or rejecting mode, the conveyor moves empty bottles as long as run memory is on, and this state is called conveying; or state 001. From bottom part of figure 2.2, double word memory (MD40), has BSFINAL PLC tag is the adjustable belt speed control that is controlled by analog dial knob (see HMI and PLC tags subchapter). Figure 2.2. Conveying state PLC diagram
  • 13.
    3) FILLING (MEMORY)STATE After the conveyor belt (stepper motor) finishes carrying an empty bottle to the filling position, the photo sensor is blocked, and state machine will change from the conveying state (001 state) into the filling state (011 state). Figure 2.3 Filling (memory) state and its related controlling memory From figure 2.3 above, the system will stay filling even if the pause button is pressed (run mode off). The red LED light indicating that the bottle filling operation is still active is turned on or off depending on whether the FILLTIMER memory tag (M2.3) is true after the
  • 14.
    calibrated FSDINT memory(MD22) value is reached or when the operator presses the reject button. While this is true, the system is still in the FILLING state, and the TESTLIGHT (photo sensor) is blocked. Also, when the FILLTIMER tag is TRUE (not done filling or rejected by the operator), the FILLING state is not finished (not FILLED); after the paddle hits the left proximity sensor, FILLING is done, which means that FILLED is, also, done.
  • 15.
  • 16.
    Figure 2.4-12. Ejectingstate and other ejecting related input memories for paddle motion and counters If the operator doesn’t press the REJECT button, the system is under the EJECTING state or state 010 (see figure 1.1). After the machine finishes filling the bottle and the pause button has not been pressed (RUN mode on), the paddle will rotate clockwise to push the filled bottle off of the belt (ejecting motion), which makes the light sensor unblocked and returns the system back to the CONVEYING state. Before explaining, it is strongly recommended to skim through EJECTING part of HMI and PLC tags on page 4. Relating to the explanation of the EGO memory bit as the reset to the FILLED memory bit, the EGO state describes paddle direction when ejecting in a clockwise motion until the paddle reaches the left proximity switch; then the left proximity switch resets the EGO state. Following the finish of the EGO state, the paddle will stay on the left proximity switch for one second by using the paddle-motor ladder logic (see figure 2.4-2) to make sure the bottle is totally ejected from conveyor belt.
  • 17.
    For the paddlereturning motion to the home position after the one second delay on the left proximity sensor, the ERETURN memory bit is used to control the paddle’s counter- clockwise movement. As long as the system is under the EJECTING mode or the pause button has been pressed with rejecting button is not pushed, the system will finish the motion by reaching the middle sensor (HOME). The above algorithm is specifically designed to avoid any input interruption that might stop the paddle returning back to the HOME position. Furthermore, the EJECTED memory bit is used to make a counter count up after every ejecting motion is finished; meanwhile, the NEWEJECTED memory bit is a safety memory bit to determine that a bottle is going to ejected after FILLTIMER completes and bottle is under RUN mode on and REJECTED button is not pressed. Figure 3. Paddle-motor ERETURN AND RRETURN schematic
  • 18.
    5) REJECTING (MEMORY)STATE Figure 4.5. REJECTING state schematic and other rejecting related input memories for paddle motion and counters
  • 19.
    Once the operatorvisually detects a defect on any given bottle, the REJECT button on the HMI display can be pushed and the system will run into the REJECTING mode, or state 100 (see figure 1.1). Inside the REJECTING state, everything is very similar to EJECTING mode with inverse directions. On figure 2.5 above, RGO works similar to how EGO works, explained on page 15; however, instead of using the left sensor (LEFT), RGO is finalized by reaching the right proximity sensor (RIGHT). Then, the paddle will stay for one second (see figure 2.4-2). RRETURN, REJECTED, and NEWREJECTED memory each work exactly the same as their counterpart in ERETURN, EJECTED, and NEWEJECTED from the EJECTING mode. 6) EJECT AND REJECT COUNTER MEMORY From figure 2.6 to the right, the type of counter used for both EJECTING and REJECTING mode is an Up Counter (CTU). The reset input signal is ERESET, connected to the normally open “RESET REJECT COUNT” button or RRESET, connected to the “RESET EJECT COUNT” button on HMI display (see figure 3.1). Preset Value is set to 100 as a acceptable limit for simulation purpose, though the output for these Figure 5. Eject and reject tally schematic
  • 20.
    counters is neverused, so the Preset Value doesn’t actually matter. 7) CONVEYOR BELT SPEED MEMORIES The BELTSPEED analog input signal needs to be modified to meet an acceptable range for the user; therefore, a certain algorithm is required to achieve a better control on belt speed. First, the input is in a 16 bit string, which needs to be converted to an integer. The new converted integer value (BSINT) is altered with an arithmetic algorithm, as follow: BSFINAL = (BSINT ∗ 0.0001299)+ 1 On bottom part of figure 2.7, BSFINAL is the final result with a limiter with range from 1.0 to 5.0 for the calculated value of above equation. The limiter is used to prevent analog noise causing the output to swing out of the intended velocities for the stepper motor. BSFINAL value is an input to the MC_MOVEJOG_DB speed controller (see page 12). Figure 6. Belt speed controller memories schematic
  • 21.
    8) FILLING SPEEDMEMORIES To be clearer with memories on the right, please read “LENGTH OF FILL TIME CONTROL” subsection on page 5. Very similar to the belt speed memories on the previous page, FILLSPEED input analog signal is converted to integer memory, FSINT. By following the below equation, FSFINAL can be calculated with range from 2.0 to 8.0 as an output on the HMI display: FSFINAL = (FSINT ∗ 0.0001949)+ 2 Because On Timer (TON) for FILLTIME memory in FILLING state (page 13) requires double integer and the default unit for TON is millisecond, FSFINAL needs to multiplied by 1000 to range between 2 seconds and 8 seconds and, then, to be converted into double integer type. This value, FSDINT is used to control the length of time the FILLTIME timer uses as it’s preset value. Figure 7.1 Filling speed controller memories schematic
  • 22.
    9) PHOTOELECTRIC SENSOR Inthis project, the LIGHT memory bit, which is connected to a photo sensor, is operated with a VEX brand light sensor. A simple diagram can be seen on figure 9; red cable needs a +5V DC input and the black cable is grounded. The output ranges from very small voltage, which is close to 0 V, to 3 V DC. However, the PLC trainer machine requires a voltage close to 15 V in order to be considered as an input signal [3]. Therefore, an OP-AMP amplifier is required to obtain the desired output signal strength. An LM 358-N Amplifier was provided and was sufficient enough to increase sensor output voltage [2]. From the pin configuration of the amplifier (see figure 2.9-3), necessary power supply for amplifier is 15 V DC so maximum output of boosted light sensor output value Is less than 15 Volts. By using a voltage divider method, a 2000 Ω resistor is wired between V- and ground; while a resistor with 10,000 Ω resistance is wired between V- and Vout. Figure 8. VEX light sensor Figure 9 VEX light sensor schematic
  • 23.
    Then, 3V voltagefrom light sensor output is increased into approximately 14.5 V DC when light sensor is unblocked (bright) and 200 mV when the light sensor is blocked (dark). To achieve +5V DC input on light sensor red cable from the same power supply, another voltage divider method is used by using 220 Ω resistor with 470 Ω resistor in series. By calculating 220 divided by (220+470), 31% of 15 Volt power supply (4.78 V DC) is adequate to power the light sensor on properly without getting another power supply. Overall wire connection can be seen on figure 3.2. Figure 10. Pin configuration for LM 358-N OP-AMPS
  • 24.
    10) HMI-PLC Interconnection TheHMI screen interconnects with several of the PLC tags, as has been tangentially mentioned in the other subsections of the paper. These tags include the START tag, which for the PLC is a memory bit, but in the HMI, sets the PLC START memory bit when the button is pressed, and resets the bit when the button is released. The PAUSE, REJECT, ERESET, and RRESET tags work the same way with the PAUSE, REJECT, RESET EJECT COUNT, and RESET REJECT COUNT buttons respectively. Finally, the EJECT COUNT, REJECT COUNT, Fill Time Length (s), and Belt Speed (in/s) fields are all output fields which pull their values from the EJECTTALLY(1), REJECTTALLY, FSDINT, and BSFINAL PLC tags, respectively. By communicating between the PLC CPU and the HMI, values are able to be updated as the program runs, and different input and output types can be used. III. RESULTS All of the systems of the desired project are implemented and the results of the system illustrated on figure 3.1. During the operation, all activities that occur can be observed by the debugging program, symbolized by glasses with a green play button, inside the TIA interface online mode. The bottle filling system will start when green START button is pressed and the stepper motor will start running until the light sensor is blocked. If the operator doesn’t press the REJECT button, the paddle will rotate clockwise and finish ejecting motion; if the REJECT button is pressed, the paddle will rotate counter-clockwise and finish rejecting motion. Afterwards, EJECT COUNT will count as 1 or REJECT COUNT
  • 25.
    value will be1 if the system rejects the bottle. Fill time length ranges from 2 seconds to 8 seconds, while belt speed ranges from 1 to 5 speed value. Figure 11 Final HMI display
  • 26.
    A DC 15Vpower supply is also required for powering up the light sensor and its related components. The wiring system is based on the PLC electrical wiring concept on pages 22 and 23. The output of the amplifier is then connected to PLC I/O expansion module, input number 4, and expansion module input number 3 is connected to GROUND (see figure 3.2) Figure 3.2 Light sensor wiring connections
  • 27.
    IV. CONCLUSION ANDRECOMMENDATION An automatic bottle filling simulation system using SIEMENS PLC Trainer TIA program has been successfully built and designed by utilizing the State Machine concept, mixed with a little Ad-Hoc method for the internal functions of some of the states. The system can be smoother if some of electrical devices and system are upgraded and improved without any errors, especially with the stepper motor. The theory and concept of automatic bottle filling system with reject feature is based on criteria of user expectations by following SIEMENS manual specs [1]. Features and functions of the electrical components are required to determine system requirement. In programming side, understanding of the desired system and how to use state machine diagram to comprehend the machine sequence of operation are the most important parts. The main goal of this project, which is to design PLC program to fill and eject/reject bottle automatically, is successfully done as planned.
  • 28.
    REFERENCES [1] Siemens. ‘BasicOf PLCs’ STEP 2000 series, Siemens Technical Education Program. [2] LMx58-N Low-Power, Dual-Operational Amplifiers. Texas Instrument, January 2000. http://www.ti.com/lit/ds/symlink/lm158-n.pdf. [3] Light Sensor. VEX: ROBOTICS DESIGN SYSTEM. http://www.vexrobotics.com/wiki/index.php/Light_Sensor.