Home > electrical-training-simulator > PLC programming lessons > lesson 6

PLC Programming Lesson 6: Scrap Bottle Grinder

Track damaged bottles with a BSR shift register, divert scrap, count bottles, and control the grinder

Lesson objective: Create a bottle-line scrap handling routine that identifies damaged bottles, tracks each damaged-bottle status as it moves toward the scrap diverter, removes scrap from the main line, grinds damaged bottles, and replaces the collection box after 10 bottles have been processed.

Before you begin: Access to the PLCLogix 500 or PLCLogix 5000 training simulator is required to complete the hands-on lesson series. Complete the preceding lessons first if you are new to PLCLogix. The source lesson and screenshots use PLCLogix 500. Focus: BSR shift-register tracking, diverter control, CTU counting, TON timing, conveyor control, and testing with the 3D bottling-line environment.

I/O and Application Requirements

 

Lesson 6: In this lesson we will create a bottle-line scrap handling routine. Scrap must be identified, processed, and removed from the bottle-line application. Damaged bottles are sent to a grinder, and the ground glass is collected and removed by conveyor as needed.

Physical I/O
AddressNameDevice / Function
I:1/0Stop_PBN.C. push button
I:1/1Start_PBN.O. push button
I:1/8Bottle Defect DetectorOptical sensor
I:3/2Box Position DetectorOptical sensor
I:3/3Bottle Detector (Grinder)Optical sensor
O:2/0Main ConveyorMotor control
O:2/10Run IndicatorRed bulb
O:4/1Rear Scrap ConveyorMotor control
O:4/2Exit ConveyorMotor control
O:4/3Round Box ConveyorMotor control
O:4/4Main Scrap DiverterSolenoid
O:4/7Box FeederSolenoid
O:4/8Grinder MotorMotor control

 

Data File Memory
Address RangeFilePurpose
N7:0/0-N7:0/5N7 Integer FileDamaged-bottle tracking

 

Example Requirements:

  1. The Start/Stop station starts the bottle line.
  2. The state of a bottle — damaged or not damaged — is shifted into a register as the bottle passes the damage detector. The bottle status moves down the line with the bottle toward the scrap diverter.
  3. When a damaged bottle reaches the main scrap diverter, it is pushed off the main bottle line to be scrapped.
  4. The damaged bottle drops onto the rear scrap conveyor leading to the grinder.
  5. An optical sensor detects an arriving bottle at the grinder and turns the grinder on for 3 seconds.
  6. The ground glass falls into a box on a round box-removal conveyor. The box is replaced after 10 bottles have passed through the grinder.
  7. While the scrap-glass box is being replaced, a diverter gate and rear exit conveyor divert bottles until a box is back in position. The bottle count is reset and then increments as additional bottles pass through the grinder.

Step 1: Start/Stop and Conveyor Control

 

The first task is to control the main bottle line and scrap conveyors using the Start and Stop pushbuttons in the 3D environment.

The numbered callouts identify the Start/Stop controls, Run indicator, main conveyor, and scrap conveyor used in the first two rungs.

Rung 0: Create a standard Stop/Start rung with a virtual control relay used to seal in the rung. Use the I:1/0 and I:1/1 addresses from the table with the N.C. and N.O. pushbutton switches (1). Control the O:2/10 Run Indicator (2) from this rung as well.

 

Rung 1: Use the virtual control relay to turn the main conveyor motor (3) and scrap conveyor motor (4) on and off.

Rungs 0 and 1 establish the seal-in control and run the main and scrap conveyors from the virtual control relay.

Step 2: Track Damaged Bottles with a BSR Shift Register

 

Create a BSR (Bit Shift Right) register to track a bottle as it moves down the line. The arrival of a bottle at the bottle detector (1) triggers the shift action. The bottle defect detector (2) provides a high, or “1,” at I:1/8 when a damaged bottle is detected. Use that address as the source-bit location for the shift-right register.

 

The distance between the defect detector and the O:4/4 main scrap diverter (3) is five bottle positions (4), so the register must be five bits wide to track bottle status as it moves toward the diverter.

The callouts show the detector locations, main scrap diverter, and five bottle positions represented by the shift register.

Rung 2: Use the I:1/6 bottle detector (1) to trigger the BSR instruction. Configure the instruction to use N7:0/4 through N7:0/0 as the five-bit register. Shift the source bit into the register from the I:1/8 bottle damage detector (2) input.

 

Rung 3: When a “1” representing a damaged bottle reaches N7:0/0, the normally open contact on this rung energizes the main scrap diverter (3) and pushes the damaged bottle off the line. Use the R6:0/DN bit so this action occurs only after the current bottle information has shifted into N7:0/0. The R6:0/DN bit goes high immediately after a shift occurs in the BSR instruction.

Rung 2 shifts the bottle status through N7:0, and rung 3 operates the scrap diverter when a damaged-bottle bit reaches N7:0/0.

Step 3: Bring a Scrap Box into Position

 

After a damaged bottle is removed from the main conveyor, it must be processed. Begin by ensuring a box is in position on the round box conveyor (1). Add a rung that brings a new box into position whenever no box is present at the grinder (2). Use the box feeder (3) and round conveyor (1) outputs together with the box position detector (4) input.

The callouts identify the round box conveyor, grinder area, box feeder, and box position detector used for scrap-box handling.

Rung 4: Use a normally closed contact with the I:3/2 box position detector (4) input to energize the O:4/7 box feeder (3) and O:4/3 round box conveyor (1) motor outputs. A box is brought to the grinder at startup when the virtual control relay closes.

The first version of rung 4 brings a box into position whenever the box-position detector is not made.

Steps 4 and 5: Box Replacement, Bottle Counter, and Grinder

 

Step 4: Modify the box-control rung so a new box is brought in after 10 bottles have been sent through the grinder. Add a counter that counts bottles each time one is ground. Use the counter's Done bit to bypass the I:3/2 box position detector contact on rung 4.

 

Also prevent bottles from reaching the grinder while the box is being changed. The rear exit conveyor (1) and exit diverter (2) are energized whenever there is no box at the grinder.

 

Rung 4 (updated): Add two branches: one for the input conditions and one for the additional outputs. Add the box-full flag, using the counter DN Done bit, in a branch around the box-position detector. This provides continuity when the box is full and initiates the box-change sequence.

 

Rung 5: Use the grinder motor timer Done bit to increment the bottle counter. Set the counter preset to 10. The counter must be reset each time the box is changed. At this stage of the source lesson, use the T4:0/DN address to increment the counter; the grinder timer is added in the next step.

 

Rung 6: Reset the scrap-bottle counter when the box is changed — when the box is not in position.

The updated box-control logic adds the box-full bypass and diversion outputs; rungs 5 and 6 count ground bottles and reset the count during a box change.

Step 5: Add the grinder and grinder-timing rungs so the grinder turns on when a bottle reaches the grinder bottle detector (1) and runs for 3 seconds.

The grinder bottle detector provides the brief input used to start the grinder timing sequence.

Rung 7: Add a timer for the grinder. Because the grinder bottle detector is only on briefly, use a branch with the timer's TT (Timer Timing) bit to keep the timer running until it times out.

 

Rung 8: Energize the grinder motor for the timed period determined by the T4:0 timer on rung 7.

Rung 7 times the grinder for three seconds and uses the TT bit to maintain timing; rung 8 runs the grinder motor during the timed period.

Save the file. The application is now ready for testing.

Testing the Scrap Routine

 

  1. Open the N7 Integer file so you can watch the shift-register action while the simulation runs. Position the 3D world and N7 table window so you can see both, along with the counter on rung 5.
  2. Press Start PB and watch the bottles move down the line. When a damaged bottle reaches the I:1/8 damaged bottle detector, verify that a “1” is loaded into N7:0/4. Watch the “1” shift with the bottle toward the diverter. When it reaches N7:0/0, the diverter should energize and push the scrap bottle off the main conveyor.
  3. Watch as 10 bottles are sent to the grinder. Observe the behavior of the exit conveyor and diverter while the collection box is being changed.
Arrange the N7 table, ladder logic, counter, and 3D bottling line so you can observe the shift register and scrap-handling sequence while the program runs.
Self-assessment: There is no separate online test for this lesson. Your completed PLC program and correct simulated behavior are the assessment. Verify damaged-bottle tracking through N7:0, scrap diversion, grinder timing, the 10-bottle count, counter reset, and the box-change diversion sequence.
Assigned by an instructor or supervisor? Save your finished PLC program and share it with them when you complete the lesson.

Need access to the required simulator? PLCLogix 500 Simulator   |   PLCLogix 5000 Simulator