PLC Programming Example – Palletizer Drum Instructions

How many ways can you program the PLC for the same function? The answer is allot of different ways. You can have ten different programmers working on the same program and get ten different automatic control PLC programs. Sure they may have similarities but, they are all unique in their code within the PLC. As a system integrator you will see many different ways of programming the PLC. We will now look at reprogramming our palletizer example using drum instructions. (Sequencer)
Last time we applied the five steps to PLC program development to a palletizer example. We will review our steps and then change our programming code to incorporate the drum instructions. Like our original example we will allow the operator to change the layers of boxes you want on each skid. We will also add in this example a manual operation sequence to cycle thought each of the steps for troubleshooting the program.

Developing the PLC program is a process that can be clearly defined. In our series on the five steps to PLC program development we have done some similar practical examples.
PLC Programming Examples – Five Steps to PLC Program Development
– Press
Process Mixer
Shift Register (Conveyor Reject)
Paint Spraying
Delay Starting of 7 Motors
– Pick and Place
– Sorting Station (Shift Register)

Define the task: (1)
Watch the sequence of operation video below. This will demonstrate the pallet layer selection, running and resetting of the machine.
Watch on YouTube : PLC Programming Example – Palletizer Testing

A normally open start and normally closed stop pushbuttons are used to start and stop the process in automatic mode. Upon starting the pallet conveyors will load a pallet onto the elevator.

The elevator will move the pallet to the top of the elevator where it will be loaded with layers of boxes. Boxes are staggered on the each layer so that they will interlock with themselves. This will provide a more stable skid.

A turn device is utilized to orientate the boxes on every other layer. A pusher is used to move the rows of boxes to the plate.

Once the last row is pushed on the plate, a clamp will be used to square up the layer of boxes. The plate will then open putting the layer of boxes onto the pallet. The elevator will then move down to allow the plate to close. The next layer then can be assembled on the plate.
When the layers of boxes have been obtained, the elevator will move all the way to the bottom. This will align with the exit conveyor. The finished pallet will then move onto the exit conveyor. An empty pallet is then moved onto the load conveyor and the process will continue again.
A counter will be used to track the number of boxes that have been processed. This can be reset by hitting the reset in the manual mode.
The reset button in the manual mode will also reset the machine and move the elevator to the bottom.

Define the Inputs and Outputs: (2)
Pallet at Entry – Sensor – On/Off
Pallet at Exit – Sensor – On/Off
Pallet loaded – Sensor – On/Off
Box at Entry – Sensor – On/Off
Pusher Limit – Sensor – On/Off
Plate Limit – Sensor – On/Off
Clamped – Sensor – On/Off
Elevator Moving – Sensor – On/Off
Start Pushbutton – Normally Open – On/Off
Reset Pushbutton – Normally Open – On/Off
Stop Pushbutton – Normally Closed – On/Off
Emergency Stop – Normally Closed – On/Off
Auto / Manual – Switch – On/Off
Layers Button Pushbutton – Normally Open – On/Off

Pallet Feeder – Contactor – On/Off
Load Pallet – Contactor – On/Off
Exit Conveyor – Contactor – On/Off
Move to Limit – Contactor – On/Off
Elevator Up – Contactor – On/Off
Elevator Down – Contactor – On/Off
Box Feeder – Contactor – On/Off
Turn – Contactor – On/Off
Push – Contactor – On/Off
Load Belt – Contactor – On/Off
Clamp – Contactor – On/Off
Open Plate – Contactor – On/Off
Warning Light – Contactor – On/Off
Start Light – Contactor – On/Off
Reset Light – Contactor – On/Off
Stop Light – Contactor – On/Off
Counter – Register – 16 bits
Layers – Register – 16 bits

Develop a logical sequence of operation: (3)
A flow chart or sequence table is used to fully understand the process the needs to be controlled. It must also answer questions like the following:

What happens when electrical power and/or pneumatic air is lost? What happens when the input / output devices fail? Do we need redundancy?

This step is where you can save yourself allot of work by understanding everything about the operation. It will help prevent you from continuously re-writing the PLC logic. Knowing all of these answers upfront is vital in the development of the PLC program.
Here is our sequence of operation for our palletizer application.

If our input conditions are true then the outputs are set. It will then look at the next step for the input conditions to set the outputs. Etc.

Develop the PLC program: (4)
Writing the code for the PLC will be the next step in our program development. A quick review can be seen on our post: Buiding A PLC Program That You Can Be Proud Of
(This series takes you through using discrete inputs and outputs to control traffic lights and cylinders. As we progress we introduce additional methods to solve logic. We look at sequencers in a new way and learn how to write programs to allow users to teach the new sequence.)

This program code will use the DRUM instruction. This will simplify the programming code compared to the original program that we did for the palletizer.

The first thing in our program is to control the start and stop functions. This is done through a latching circuit.

This is the drum instruction logic for the loading and unloading of the pallets. It also includes the plate open and close to add the layers

Reset the pallet control back to step 1.
This will happen when the pallet has been filled and exited though the sequence.

Reset layer on the pallet.
This will reset to step 6. When the layer done signal is recieved, the plate will open, the elevator will move down and the plate will then close. If more layers will be added then the step is reset to 6.

Bits are used in the drum instruction. These are often used when the input is normally open and we need a normally closed or vice versa.

Loading / Unloading Pallets
A jog function is used on the outputs not associated with conveyors. (Elevator Movements)

Exit conveyor has an off-delay of 10 seconds to ensure that the skid has been moved far enough on the conveyor.

Elevator Movement

Plate Movement

Number of Layers on the Pallet
This counter will track the number of layers that we have put on the pallet.

Boxes 2X3 – Drum Instruction
This will handle the sequence of the boxes going in the layer. The arrangement of the boxes is 2 x 3.

Counter is preset to the number 2. The sequence will activate this counter three times to complete the layer.

Boxes 3X2 – Drum Instruction
This will handle the sequence of the boxes going in the layer. The arrangement of the boxes is 3 x 2.

Counter is preset to the number 3. The sequence will activate this counter two times to complete the layer.

Internal bits so the input will be normally open or closed for the drum instruction.

Turn the box output for the 3 x 2 layer.

Box feeder and load belt outputs.
These outputs will not be jogged.

Box Pusher

Clamp to straighten the boxes on the layer. The clamp will also trigger that the layer has completed for the pallet.

Layer Setting
This will set the number of layers that will be placed on the pallet.
The layers can be set between 1 and 4 when not in auto.

Box Counter
This will count the total number of boxes that have passed the sensor.
It can be reset by the reset button held for 3 seconds when in manual mode.

This is the end of our program.

Test the program: (5)
We will be using Factory IO to test the program. This communicates Modbus TCP Client (Master) to our BRX Series PLC (Modbus TCP Server (Slave)).

We will now add the inputs and outputs to our program for communication to our scene in Factory IO. The output coils from Factory IO will set the actual input addresses in our PLC. See the following post on Understanding the PLC Program Scan. This will demonstrate how we can set the actual PLC inputs.

The inputs from Factory IO will be set by the actual outputs from our PLC.

The first step in testing out the program is to ensure that the inputs and outputs of the PLC are wired correctly. We would usually turn each input on manually and see the corresponding input of the PLC turn on. The same applies to the output devices. We would turn on each of the outputs to determine if they have been wired correctly.
Next we will try our manual operations programmed into the process. If everything is working then we will start running our program in automatic mode.

Test the program for things that can go wrong. Unplug a sensor or remove a box after the sensor has seen it. The program should be able to react.

Watch the videos below to see an explanation and test of the program using Factory IO.

You can download the program and Factory IO scene here.

Watch on YouTube : PLC Programming Example – Palletizer Drum Instructions
If you have any questions or need further information please contact me.
Thank you,

If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.

Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Leave a Reply

Your email address will not be published. Required fields are marked *