PLC Program Example – Paint Spraying

We will look at a PLC basic tutorial of a paint spraying station. Following the five steps to program development, this PLC programming example should fully explain the procedure for developing the PLC program logic. Ladder logic will be our PLC programming language.

We will use the Do-more Designer software, which comes with a simulator. This fully functional program is offered free of charge at automation direct.

Define the task – PLC Paint Spraying Example.

What has to happen?
Paint Station 01 - plc example paint spraying

Paint spraying system where boxes are fed by gravity through a feeder magazine one at a time onto a moving conveyor belt. Upon the start signal, boxes are pushed towards the conveyor by valve 1. This cylinder extends and retracts; operating switches S1 and S2 respectfully. A spraying nozzle paints each box as it passes under the paint spray controlled by valve 2. A sensor (S3) counts each box being sprayed. When six boxes have been painted, valve 2 shuts off (paint spray), and valve 1 (cylinder) stops moving boxes onto the conveyor. Three seconds later, the conveyor stops moving, and the hopper with its load moves forward (valve 3), where it is emptied. Ten seconds later, the hopper returns to its original position. The cycle is then complete and waits for a start signal again.

Define the Inputs and Outputs – PLC Paint Spraying Example

Start Switch – On/Off (Normally Open) – NO
Stop Switch – On/Off (Normally Closed) – NC
S1 – Valve 1 (cylinder retract) On/Off – NO
S2 – Valve 1 (cylinder extend) On/Off – NO
S3 – Box Detected- On/Off – NO
Motor – On/Off (Conveyor Run)
Valve 1- Cylinder to feed boxes – On/Off
Valve 2- Paint Spray – On/Off
Valve 3- Cylinder to move hopper – On/Off

Develop a logical sequence of operation – PLC Paint Spraying Example
Fully understanding the logic before starting to program can save you time and frustration.

Sequence Table: The following is a sequence table for our paint spraying application.

Sequence Table - plc example paint spraying
1 – Input / Ouput ON
0 – Input / Output OFF
x – Input / Output Does not Matter
When the power goes off and comes on, the sequence will continue. This means that we must use memory retentive areas of the PLC. The stop push button will stop the sequence. The start will resume until the end.

Develop the PLC program – PLC Paint Spraying Example.

The best way to see the development of the programmable logic controller program is to follow the sequence table along with the following program. You will see the direct correlation between the two and understand the process well.

This is the main process to start and stop bit. V0:0 is used because it is memory retentive.
Ladder Logic Programming Sample Code

Control of the Motor (Conveyor) and the paint spray is done with the V0:0 contacts in front of the actual PLC output. The conveyor and paint spray will stop when timer 0 is done. This is the delay after the last box is detected to allow the box to be painted and loaded onto the hopper.
Ladder Logic Programming Sample Code

Control of the box movement onto the conveyor. As long as we have the process started and the hopper count is not complete, this will allow the cylinder to put boxes on the conveyor.
Ladder Logic Programming Sample Code

Count the number of boxes in the hopper via S3. The counter is memory retentive.
Ladder Logic Programming Sample Code

A timer to stop the conveyor and spray after the last box is detected for the hopper. This will allow time for the package to be sprayed and loaded into the hopper.
Ladder Logic Programming Code

Hopper movement to load and unload the boxes.
plc example paint spraying

The hopper unload timer is to unpack the boxes and will then trigger the reset conveyor timer, box counter, and the process start bit (V0:0).
plc example paint spraying

Test the program – PLC Paint Spraying Example.

Paint Spraying
Test the program with a simulator or actual machine. Make modifications as necessary. Remember to follow up after a time frame to see if any problems arise that need to be addressed with the program.

Watch on YouTube: PLC Programming Example – Paint Spraying

If you have any questions or need further information, please get in touch with me.
Thank you,

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

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.

3 thoughts on “PLC Program Example – Paint Spraying”

  1. I cant not understand operating theory of the valves (v1,v2) clearly ?
    But if the valves (v1,v2) changing its direction automatically then l think that the (s1,s2) most be for the v2 to indicate the end of the of unloading boxes and the v1 dose not need sensor the s3 will be enough

  2. l don’t understand the operating theory of the (v1,v2) clearly.
    (What is the benefit of using (S1,S2)?
    But if that are changing their direction automatically so the V1 doesn’t4 need for (S1,S2) the (S3 ) will be enough to controlling the entering boxes operation and we need a sensor to indicate the ending of the unloading operation by using the rising edge instruction so we don’t have to use the timer in this case which sometimes requires a complex calculation .

    • Hi Sufian,
      V0:1 is used for the conveyor motor. It is memory retentive so that if power is removed and comes back on the cycle will continue. V0:2 will control the cylinder to load the boxes. This will be able to operate as long as the count has not been complete.
      S1 and S2 are limit switches for the cylinder. It will indicate when the cylinder has fully extended and retracted. If the sensors are not made, this will stop the sequence.
      You are correct, we could just use a timer to extend and another timer to retract the cylinder with S3 for the object detection.
      It is always a good idea to use sensors on the ends of cylinders. You could time the extension and retraction to determine air pressure or cycles before maintenance is due.


Leave a Comment