Premium Membership ♕

Save 50% on all Video Courses with Enterprise Membership Plan and study specialized LV/MV/HV technical articles and guides.

Home / Technical Articles / PLC implementation of the bottle-filling application

Detection of position

In this example (see Figure 1), we will implement a control program that detects the position of a bottle via a limit switch, waits 0.5 seconds, and then fills the bottle until a photosensor detects a filled condition.

PLC implementation of the bottle-filling application
PLC implementation of the bottle-filling application

After the bottle is filled, the control program will wait 0.7 seconds before moving to the next bottle. The program will include start and stop circuits for the outfeed motor and the start of the process. Table 1 shows the I/O address assignment, while Tables 2 and 3 present the internal and register assignments, respectively.

These assignments include the start and stop process signals.

Bottle-filling system
Figure 1 – Bottle-filling system

Table 1 – I/O address assignment

 I/O Address 
Module TypeRackGroupTerminalDescription
Input000Start process PB1
001Stop process PB2 (NC)
002Limit switch (position detect)
003Photoeye (level detect)
Output030Feed motor M1
031Outfeed motor M2 (system ON)
032Solenoid control

Table 2 – Internal output assignment

Timer1001Timer for 0.5 sec delay after position detect
Timer1002Timer for 0.7 sec delay after level detect
1003Bottle filled, timed out, feed motor M1

Table 3 – Register assignment

4000Preset value 5, time base 0.1 sec (1001)
4001Accumulated value for 1001
4002Preset value 7, time base 0.1 sec (1002)
4003Accumulated value for 1002

Figure 2 illustrates the PLC ladder implementation of the bottle-filling application. Once the start push button is pushed, the outfeed motor (output 031) will turn ON until the stop push button is pushed.

The feed motor M1 will be energized once the system starts (M2 ON); it will stop when the limit switch detects a correct bottle position. When the bottle is in position and 0.5 seconds have elapsed, the solenoid (032) will open the filling valve and remain ON until the photoeye (PE) detects a proper level.

The bottle will remain in position for 0.7 seconds, then the energized internal 1003 will start the feed motor. The feed motor will remain ON until the limit switch detects another bottle.

PLC implementation of the bottle-filling application
Figure 2 – PLC implementation of the bottle-filling application

Reference: Introduction to PLC Programming and Implementation – from relay logic to PLC logic –

Premium Membership

Get access to premium HV/MV/LV technical articles, electrical engineering guides, research studies and much more! It helps you to shape up your technical skills in your everyday life as an electrical engineer.
More Information

Edvard Csanyi

Electrical engineer, programmer and founder of EEP. Highly specialized for design of LV/MV switchgears and LV high power busbar trunking (<6300A) in power substations, commercial buildings and industry facilities. Professional in AutoCAD programming.


  1. Steyer Zalán
    Jul 09, 2019

    Üdv Edvárd!
    Úgy örülök, hogy megtaláltam ezt az oldalt.
    Dear Edvard!
    I am glad to find this website. I am a teacher in Hungary and I have become infected with automation in Taiwan, so I am 47 and I now start to study this beautiful part of electrical engineering.
    Steyer Zalán

  2. Mario Lluch
    Jul 01, 2019

    I maintain a water bottling facility using krones equipment a German manufacturer plant is based in the US experiencing malfunction that could be attributed to discrepancies between NEC wiring methods and European ones could shed some light on the subject.

  3. Bharat Paliwal
    Apr 08, 2019

    Nice Explained

  4. patrick
    Feb 04, 2018

    thanks for these refreshments education i value them.

  5. pazhanisamy
    Aug 17, 2017

    Ver useful site
    Thank you verymuch

  6. asdasf
    Nov 22, 2015

    why ls002 in last line ?

  7. melkamu
    Nov 28, 2014

    i like this website very much.thank u

  8. William
    Jul 21, 2014

    Im having trouble programming my project for collage. It is a pick and place arm using two stepper motors, im using a mitsubishi FX 1s 30mt transistor output but I cant seem to get it to work. Im not sure about the bandwidth and pulses any help would be great

    • xelalem
      Aug 16, 2014

      hi. explain ur problem in detail. zen may be we can help u.

  9. guest
    Apr 03, 2014

    Can anyone please just take one minute and reply me?

    • Free soul
      Apr 07, 2014

      line 2 the invers contact of LS is used= when LS detect a buttle it will be ‘1’ , but its invers contact will be ‘0’ , So M1 is off unless 1003 will be ‘1’

      • guest
        Apr 07, 2014

        Yes, Free Soul you are right but looking at the symbol of the limit switch (again line 2) you can see that it’s normally closed. So when a bottle is detected the LS instead of 1 will be 0. That’s why I ask if it should be the opposite

        • guest
          Apr 07, 2014

          Ok, you’re right. The symbol says it’s normally open. I’m sorry it’s my mistake.

  10. guest
    Mar 28, 2014

    Is this right that the feed motor M1 runs when the limit switch is closed (from the symbol here the limit switch closes on limit, so the bottle is in the position) or the bottle is full and the other motor M2 is running. Shouldn’t the limit switch LS002 be open then and not closed?

Leave a Comment

Tell us what you're thinking. We care about your opinion! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let's have a professional and meaningful conversation instead. Thanks for dropping by!

8  ⁄    =  one

Learn How to Design Power Systems

Learn to design LV/MV/HV power systems through professional video courses. Lifetime access. Enjoy learning!

Subscribe to Weekly Newsletter

Subscribe to our Weekly Digest newsletter and receive free updates on new technical articles, video courses and guides (PDF).
EEP Academy Courses - A hand crafted cutting-edge electrical engineering knowledge