PLC Structured Text Program for Marking Machine

In this post, we will write a sample logic for a marking machine using structured text language.

Marking Machine

Let us first understand the case scenario. Refer to the below image. There are the following components used – start push button, stop push button, conveyor, bottle sensor, cylinder, cylinder up sensor, and cylinder down sensor.

The conveyor is a DOL starter. When the user presses the start button, the conveyor starts to run at a fixed speed (because there is no VFD). The conveyor is carrying bottles on it. When a bottle is sensed near the bottle sensor point, the conveyor stops.

The bottle comes just below the cylinder. When the cylinder up position is active, then the cylinder comes down till the down sensor is sensed. When the down sensor is sensed, after a time delay, the cylinder moves up until the up sensor is sensed. When the up sensor is sensed, the cylinder output stops. After a time delay, the conveyor starts again and the cycle continues.

Program Interlocks

Following are the interlocks for running the conveyor – the up sensor must be sensed, the conveyor must be healthy and not tripped, and the bottle sensor must not be sensed.

If any of the above conditions fails, then the conveyor will not run.

Following is the only interlock for operating the cylinder – the conveyor should be in stop condition.

Inputs and Outputs

Following are the PLC IO’s according to our requirement:

  1. Digital inputs – start PB, stop PB, conveyor run feedback, bottle sensor, up sensor, and down sensor.
  2. Digital outputs – conveyor and cylinder.
Marking Machine

PLC Structured Text Program

Let us write the logic now. We are using Rockwell PLC (Studio 5000) for practicing this. Refer to the below image. We will now study the logic line by line and see how it is in line with our requirements.

First, we will write the logic for interlocking the conveyor. As you can see, if the system is not running or there is no up sensor or the conveyor is tripped or the bottle is sensed, then the conveyor will not run.

Secondly, we will write the logic for interlocking the cylinder. As you can see, if the system is not running or the conveyor is on, then the cylinder will not operate.

PLC Structured Text Program for Marking Machine

Next, we start and stop the system according to the push buttons pressed. On pressing start, we latch the system running bit, and on pressing stop, we unlatch the system running bit.

Then, we start the conveyor. If there is no conveyor interlock, then the conveyor will turn on, else it will remain off.

Now, we have to stop the conveyor from sensing a bottle. So, as the bottle is sensed, we turn on a bit named bottle sensed and stop the conveyor written earlier. You can see in the first image the distance between bottle sensor and cylinder. This is because the conveyor will not stop immediately; it will take 2-3 seconds. So, the cylinder is placed in the position where the bottle will reach exactly after stopping the run command of the conveyor.

Now, we operate the cylinder in the down direction after a delay of 5 seconds. So, if there is no cylinder interlock present and the bottle is sensed and the down sensor is not active, then we take the cylinder down.

When the down sensor is sensed, then we turn on a bit named down sensed for turning off the cylinder down action.

Now, we operate the cylinder in the up direction after a delay of 5 seconds. So, if there is no cylinder interlock present and the bottle is sensed and the down sensor is sensed and no up sensor is sensed, then we take the cylinder up.

When the up sensor is sensed, then we turn on a bit named up sensed for turning off the cylinder up action.

With this action, after a delay of 5 seconds, we reset all the logic and restart the conveyor once again to mark the bottles by cylinder action.

In this way, we saw how to write a PLC program for a marking machine using structured text.

Read Next:

Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address

Leave a Comment

Share via
Follow us and never miss an update!