Skip to content
PLCampus
All examples

10Level 4

Sorting parts by size

Two sensors at different heights tell the large parts apart. A timer waits for the part to reach the piston, which pushes it aside. Small parts continue to the end of the belt.

The simulator is designed for computers (screens 1024 px or wider).

Virtual plant

I0.3I0.2Q0.1↓ LargeSmall →Sorted right: 0Sorted wrong: 0Q0.0

Sorted right: 0. Sorted wrong: 0

Shown at rest. In the simulator the plant moves according to your program's outputs.

Inputs and outputs

AddressNameDescription
I0.0STARTStart push button (NO)
I0.1STOPStop push button (NC: 1 at rest)
I0.2LOW_SENSORLow sensor: detects every part (plant)
I0.3HIGH_SENSORHigh sensor: only large parts reach it (plant)
Q0.0BELTBelt motor
Q0.1PISTONReject piston solenoid valve
M0.0LARGE_PARTA large part is on its way to the piston
T0T_TRAVELTime the part takes from the sensor to the piston
T1T_PUSHPiston push duration

Program

Ladder diagram (LD)

  1. Rung 1 — Belt with seal-in.

    STARTI0.0BELTQ0.0STOPI0.1BELTQ0.0
  2. Rung 2 — A part arrives: if the high sensor also sees it, it is large.

    PLOW_SENSORI0.2HIGH_SENSORI0.3SLARGE_PARTM0.0
  3. Rung 3 — Waits for the large part to reach the piston and clears the memory.

    LARGE_PARTM0.0TONT_TRAVELPT T#1s250msRLARGE_PARTM0.0
  4. Rung 4 — Piston push: a half-second pulse.

    T_TRAVELT0TPT_PUSHPT T#500msPISTONQ0.1

Step by step

  1. 1Press ▶ Run (F5) and press START. Small parts only trigger LOW_SENSOR; large ones trigger both sensors at once.
  2. 2Rung 2: on the rising edge of LOW_SENSOR, if HIGH_SENSOR is also on, LARGE_PART is stored with a Set coil.
  3. 3Rung 3: T_TRAVEL measures 1.25 s, the time the part takes to reach the piston, and then clears the memory. Rung 4: the T_PUSH pulse drives the piston for half a second.
  4. 4The plant counts parts sorted right and wrong. If you stop the belt with a large part on its way, the time keeps running and the piston misses: in industry an encoder or a sensor in front of the piston is used so the sorting does not depend on time.