PLC Programming Exercise: Automatic Bottle Filling System
PLC Programming Exercise: Automatic Bottle Filling System file FMhyHiFYiKAc5QKqFtrJjs

PLC Programming Exercise: Automatic Bottle Filling System

Introduction

In this exercise, we will program a PLC-based automatic bottle filling system. This system simulates a real-world industrial process where a bottle is filled with liquid and stops once the filling is complete. The automation process includes bottle detection, filling for a set time, and resetting for the next bottle.

This is a common use case in industries such as beverages, pharmaceuticals, and chemical manufacturing.


Learning Objectives

By completing this exercise, you will:

  • Understand how to develop PLC programs using Ladder Logic.
  • Learn to utilize timers, sensors, and actuators for automation.
  • Apply troubleshooting techniques to optimize the process.
  • Enhance skills in controlling real-world industrial systems.

Tools and Components

Hardware Requirements:

  • PLC (Siemens S7-1200, Allen-Bradley MicroLogix, or equivalent)
  • Conveyor Motor
  • Proximity Sensor (for bottle detection)
  • Solenoid Valve (to fill the bottle)
  • Full-bottle Detection Sensor
  • Start and Stop Push Buttons
  • Indicator Light

Software Requirements:

  • PLC Programming Software (e.g., Siemens TIA Portal, RSLogix 500)
  • PLC Simulation Tool (if hardware is unavailable)

System Description

The automatic bottle filling system follows these steps:

  1. Bottle Detection: The proximity sensor detects the presence of a bottle at the filling station.
  2. Filling Process: The PLC opens the solenoid valve, allowing liquid to fill the bottle for a fixed time (e.g., 5 seconds).
  3. Filling Complete: After 5 seconds, the solenoid valve closes to stop the filling.
  4. Cycle Reset: The system waits for the next bottle to be detected, repeating the process.
  5. Full Bottle Confirmation: A full-bottle sensor can provide additional confirmation before moving to the next bottle.

Step-by-Step Guide

Step 1: Define Inputs and Outputs

Before programming, assign input and output addresses for each component in your PLC:

  • Start Button (Input) – Used to start the system.
  • Stop Button (Input) – Used to stop the system.
  • Bottle Presence Sensor (Input) – Detects when a bottle is at the filling station.
  • Solenoid Valve (Output) – Controls the filling process by opening and closing.
  • Conveyor Motor (Output) – Moves the bottles through the system.
  • Indicator Light (Output) – Lights up when the system is operational.

Step 2: Develop Ladder Logic

We’ll create a simple Ladder Logic Program that uses a TON (Timer On Delay) to manage the filling process duration.

Logic Overview:

  1. Start/Stop Control: Use a latching relay to control the system’s start and stop functions.
  2. Bottle Detection: When the bottle presence sensor is activated, a timer begins to count for 5 seconds.
  3. Filling Process: The solenoid valve opens for the duration of the timer and then closes automatically.
  4. Cycle Reset: The system resets and waits for the next bottle.

Ladder Logic Code (Explanation)

  1. System Start and Stop Control
    • Start Button (I0.0) sets a memory bit (M0.0) to start the process.
    • Stop Button (I0.1) resets the memory bit to stop the process.
  2. Bottle Detection and Timer Activation
    • The bottle presence sensor (I0.2) triggers a TON (Timer On Delay) function.
    • The solenoid valve (Q0.0) remains open for 5 seconds during the timer’s duration.
  3. Timer Completion and Solenoid Valve Control
    • After the timer completes, the solenoid valve (Q0.0) turns off, stopping the filling process.

Ladder Logic Example (Pseudo-code)

Start:     I0.0 ----[ ]--------------------( Set M0.0 )   ; System starts when the start button is pressed
Stop: I0.1 ----[ ]--------------------( Reset M0.0 ) ; System stops when the stop button is pressed

System On: M0.0 ----[ ]----+-------------( Q0.2 ) ; Turn on the indicator light
|
+----[ I0.2 ]--( TON T1, 5s ) ; Bottle detected, start 5s timer

Timer Done: T1 ----[ ]--------------------( Q0.0 ) ; Turn on solenoid valve for 5 seconds

Step 3: Upload and Test the Program

  1. Connect to the PLC: Use the programming software to upload your ladder logic program to the PLC.
  2. Simulate or Test the Process: If hardware is unavailable, use the simulator.
  3. Verify the Operation: Test each component to ensure it behaves as expected—particularly the timing and sensor responses.

Testing and Debugging Tips

  • Sensor Placement: Ensure that the bottle presence sensor and full-bottle sensor are accurately positioned.
  • Adjust Timer Values: The filling duration can be changed to match the desired volume.
  • Monitor Outputs: Use the PLC’s monitoring tools to track inputs and outputs in real time.
  • Debouncing: Add debounce logic for sensors to avoid false triggers from noise.

Extensions and Advanced Modifications

  • HMI Integration: Add an HMI to display the process status and allow operators to adjust the filling time.
  • Multiple Bottle Sizes: Create a selection switch for different filling durations based on bottle size.
  • Fault Detection and Alarms: Implement error handling to detect sensor faults or empty bottles.
  • Data Logging: Record the number of filled bottles for production statistics and performance monitoring.

Conclusion

This exercise provides a hands-on introduction to PLC programming for industrial automation. By completing it, you’ll gain practical experience with timers, sensors, and actuators while preparing for more advanced automation challenges.