Target behavior
Identify workpieces on the conveyor with two photoelectric sensors, and push out only the short ones with a cylinder to sort them
What you will learn
This model identifies workpieces on a belt conveyor with sensors and sorts them with an air cylinder.
There are two heights of workpieces, tall and short. Use the two photoelectric sensors stacked vertically to identify the height, and push the short workpieces (red ones) into the red box with the air cylinder!
| Step | Description | Condition to advance | Main outputs |
|---|---|---|---|
MR1 | Waiting to push | T0 0.5 s | - |
MR2 | Pushing | X5 cylinder extended end | Y1 ON, conveyor stopped |
MR3 | Retracting | X6 cylinder retracted end | Conveyor stopped |
Based on this approach, try writing the ladder yourself first.
In the simulator, you can create the wiring and ladder and actually run the 3D equipment model.
| Device | Comment |
|---|---|
| Inputs | |
X0 | Conveyor start button |
X3 | Photoelectric sensor (upper) |
X4 | Photoelectric sensor (lower) |
X5 | Cylinder extended end |
X6 | Cylinder retracted end |
| Outputs | |
Y0 | Conveyor (contactor) |
Y1 | Cylinder solenoid valve |
| Internal relays | |
MR0 | Tall workpiece |
MR1 | Waiting to push |
MR2 | Pushing |
MR3 | Retracting |
MR10 | Running |
| Timers | |
T0 | Time to push position |
The row numbers in the figures match the row numbers in the simulator's ladder window.
On the rising edge of X0 (start button), SET MR10 (running).
X3 is also blocked while the lower sensor X4 is blocked, SET MR0 (tall workpiece)LDF X4), if MR0 is OFF (= short workpiece), SET MR1 (waiting to push)MR0 to prepare for the next workpieceIdentification is only possible while the workpiece is passing, so the result is remembered in MR0 and judged when it has finished passing.
T0 (the time the workpiece takes to move from the sensor to the front of the cylinder)X5 turns ON, go to retractingX6 turns ON, finishY0 (conveyor): ON while running and not pushing/retracting. The conveyor is stopped while pushing.Y1 (cylinder solenoid valve): ON during the pushing stepThe sample wiring and ladder data can be downloaded fromGitHuband loaded with "Load wiring" and "Load ladder" in the simulator.
Key points
LDF X4. Because the PLC processes rows from top to bottom, MR0 is evaluated on row 006 before it is RESet on row 007, so the result is used correctly.