Walkthrough: Problem 14: Cover Assembly

Difficulty

Target behavior

Start automatic operation with the Start button: move each base from the supply conveyor to the jig, put a cover on it, and send it out on the discharge conveyor. Repeat for 5 bases

What you will learn

  • Coordinating multiple units (conveyors, loader, cover transfer)
  • Running two motions at the same time to cut waiting time
  • Switching point numbers with comparison instructions (=)
  • Fault detection (timeout) and resuming after an emergency stop

Problem

This equipment puts a cover on a base workpiece.

You need to coordinate three units in the right order: two conveyors, a loader, and a cover transfer. Take it on as a wrap-up of all the previous problems!


How the equipment works

  1. The supply conveyor carries a base (gray) and stops when photoelectric sensor 1 detects it.
  2. The loader (axis 1 traverses, an air slide moves it up and down, an air gripper holds the work) moves the base to the jig.
  3. The jig clamp cylinder fixes the base, and a proximity sensor confirms that it is there.
  4. The cover transfer (axes 2 and 3 with a suction pad) picks the covers (orange) from the top of the magazine one by one and puts them on the base. The five covers are 12 mm thick each, so axis 3 has to go 12 mm lower for every cover (points 2 to 6).
  5. Photoelectric sensor 2 confirms the cover is on, then the clamp is released.
  6. The loader grips the base and cover together and moves them to the discharge conveyor. Workpieces that fall into the OK box at its end disappear.
  7. Repeat this for all five bases.

Control panel

  • Start begins automatic operation (the first time, the axes return to origin first). Light the run lamp and the green tower light while running.
  • Stop finishes discharging the workpiece being assembled, then stops. Light the yellow tower light while stopped.
  • The emergency stop stops the conveyors and the three axes (forced stop) and keeps the sequence from advancing. The air cylinders, the gripper, and the suction keep their current state (so that a held workpiece is not dropped). After releasing it, press Reset to resume from where it stopped. Light the error lamp and the red tower light during an emergency stop.

I/O assignment

InputDescriptionOutputDescription
X0 / X1 / X2Start / Stop / ResetY0Supply conveyor
X3Emergency stop (stays ON when pressed)Y1Loader up/down (ON = down)
X4Photoelectric sensor 1: base arrivedY2Air gripper (ON = close)
X5 / X6Loader raised / loweredY3Jig clamp (ON = clamp)
X7 / X8Gripper open / closedY4Suction (vacuum valve)
X9 / X10Clamp retracted / extendedY5Vacuum break valve
X11Proximity sensor: base in the jigY6Discharge conveyor
X12Photoelectric sensor 2: cover presentY7 / Y8Run lamp / Error lamp
X13Proximity sensor: covers in the magazineY9 / Y10 / Y11Signal tower green / yellow / red
X14Suction confirmed (pressure switch)
X15Photoelectric sensor 3: exit

The following points are registered for the three servo motors.

AxisPoint No.Position [mm]Speed [mm/s]Acceleration [mm/s²]Description
Axis 1 Loader15200800Above the supply conveyor (base pick-up position)
2100200800Above the jig
3200200800Above the discharge conveyor
Axis 2 Cover Y10200800Above the magazine
2150200800Above the jig
Axis 3 Cover Z10100400Raised end (travel height)
235100400Pick up the 1st cover / place a cover on the base in the jig
347100400Pick up the 2nd cover
459100400Pick up the 3rd cover
571100400Pick up the 4th cover
683100400Pick up the 5th cover

The relays used to control each of the three axes are as follows. Operation enable, forced stop, and operable are shared by all axes.

See the description of Problem 12 for how to use each relay. In the U_WRPPNT and U_RDAERC instructions, specify 1 to 3 as the axis number.

Name (all axes)DirectionRelay
Operation enableOutputR0
Forced stopOutputR2
OperableInputR6600
NameDirectionAxis 1 LoaderAxis 2 Cover YAxis 3 Cover Z
Servo ONOutputR305R705R1105
Servo readyInputR6905R7305R7705
Homing requestOutputR310R710R1110
Homing completeInputR6910R7310R7710
Positioning startOutputR200R600R1000
Positioning start acknowledgedInputR6800R7200R7600
Axis busyInputR6903R7303R7703
Positioning completeInputR6802R7202R7602
Positioning complete clearOutputR202R602R1002
Axis errorInputR6900R7300R7700
Axis error clearOutputR300R700R1100

Target behavior (video)

Approach

As in problem 13, the program is a sequence that advances one step at a time. There are more than 30 steps, but each step only does one thing: "command one motion and confirm that it has finished". The flow for one workpiece is "carry on the supply conveyor → move to the jig with the loader → clamp → put on a cover → check the cover → unclamp → move to the discharge conveyor with the loader → discharge". This flow is repeated 5 times while the workpiece number DM0 goes from 1 to 5.

Axes and points

AxisRolePoints
Axis 1 Loader traverseMoves the loader left and rightP1 above supply conveyor / P2 above jig / P3 above discharge conveyor
Axis 2 Cover transfer YCarries the suction pad between the magazine and the jigP1 above magazine / P2 above jig
Axis 3 Cover transfer ZMoves the suction pad up and downP1 raised end / P2 to P6 pick-up height of covers 1 to 5 (P2 is also the height for placing on the jig)

The loader up/down (Y1) and the chuck (Y2) are air cylinders. Their motion is confirmed with auto switches (X5 to X8).

Process table (steps)

StepDescriptionCondition to advanceMain outputs
MR0PreparingMR50 automatic operation, R6600 ready, servo ready on 3 axes-
MR1HomingHoming complete on 3 axesR310/R710/R1110 ON
MR2Cycle startMR50 automatic operation (DM0 +1)-
MR3Waiting for baseX4 photoelectric 1Y0 supply conveyor
MR4Loader to supply pick-upAxis 1 start acknowledged and positioning completeAxis 1 → P1
MR5Supply pick-up: loweringX6 lowered endY1 ON
MR6Supply pick-up: grippingX7 and X8 OFF and T0 0.5 sY1 ON, Y2 SET
MR7Supply pick-up: raisingX5 raised end-
MR8Loader to jigAxis 1 start acknowledged and positioning completeAxis 1 → P2
MR9Place on jig: loweringX6 lowered endY1 ON
MR10Place on jig: releaseX7 chuck openY1 ON, Y2 RES
MR11Place on jig: raisingX5 raised end-
MR12Clamp / loader retreatX10 forward end, X11 present, axis 1 completeY3 SET, axis 1 → P1
MR13Cover transfer to magazineAxis 2 start acknowledged and positioning completeAxis 2 → P1
MR14Cover pick-up: loweringAxis 3 start acknowledged and positioning completeAxis 3 → P[DM0+1]
MR15Cover suctionX14 suction confirmedY4 SET
MR16Cover pick-up: raisingAxis 3 start acknowledged and positioning completeAxis 3 → P1
MR17Cover transfer to jigAxis 2 start acknowledged and positioning completeAxis 2 → P2
MR18Cover place: loweringAxis 3 start acknowledged and positioning completeAxis 3 → P2
MR19Cover place: releaseT1 0.5 s and X14 OFFY4 RES, Y5 ON
MR20Cover place: raisingAxis 3 start acknowledged and positioning completeAxis 3 → P1
MR21Cover checkX12 photoelectric 2 (MR41 fault if not detected within 2 s)-
MR22Unclamp / cover transfer retreatX9 retracted end, axis 2 completeY3 RES, axis 2 → P1
MR23Loader to jigAxis 1 start acknowledged and positioning completeAxis 1 → P2
MR24Jig pick-up: loweringX6 lowered endY1 ON
MR25Jig pick-up: grippingX7 and X8 OFF and T3 0.5 sY1 ON, Y2 SET
MR26Jig pick-up: raisingX5 raised end-
MR27Loader to discharge conveyorAxis 1 start acknowledged and positioning completeAxis 1 → P3
MR28Discharge place: loweringX6 lowered endY1 ON
MR29Discharge place: releaseX7 chuck openY1 ON, Y2 RES
MR30Discharge place: raisingX5 raised end-
MR31Waiting to pass photoelectric 3Falling edge of X15Y6 discharge conveyor
MR32Waiting for dropT4 1 s → MR2 if DM0 is 1 to 4 / MR40 if 5Y6 discharge conveyor
MR40All workpieces done--

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.

Try it in the simulator
Show the sample ladder and explanation(click to open)

Devices used

DeviceComment
Inputs
X0Start
X1Stop
X2Reset
X3Emergency stop
X4Photoelectric 1 base arrived
X5Loader raised end
X6Loader lowered end
X7Chuck open
X8Chuck closed
X9Clamp retracted end
X10Clamp forward end
X11Proximity jig workpiece present
X12Photoelectric 2 cover present
X14Suction confirmed
X15Photoelectric 3 discharge
Outputs
Y0Supply conveyor
Y1Loader down
Y2Chuck close
Y3Jig clamp
Y4Vacuum valve
Y5Vacuum break valve
Y6Discharge conveyor
Y7Run lamp
Y8Error lamp
Y9Tower light green
Y10Tower light yellow
Y11Tower light red
Internal relays
MR0Preparing
MR1Homing
MR2Cycle start (waits here when stopped)
MR3Supply conveyor: waiting for base
MR4Loader to supply pick-up
MR5Supply pick-up: lowering
MR6Supply pick-up: gripping
MR7Supply pick-up: raising
MR8Loader to jig
MR9Place on jig: lowering
MR10Place on jig: release
MR11Place on jig: raising
MR12Clamp / loader retreat
MR13Cover transfer to magazine
MR14Cover pick-up: lowering
MR15Cover suction
MR16Cover pick-up: raising
MR17Cover transfer to jig
MR18Cover place: lowering
MR19Cover place: release
MR20Cover place: raising
MR21Cover check
MR22Unclamp / cover transfer retreat
MR23Loader to jig
MR24Jig pick-up: lowering
MR25Jig pick-up: gripping
MR26Jig pick-up: raising
MR27Loader to discharge conveyor
MR28Discharge place: lowering
MR29Discharge place: release
MR30Discharge place: raising
MR31Discharge: waiting to pass photoelectric 3
MR32Discharge: waiting for drop
MR40All workpieces done
MR41Missing-cover fault
MR50Automatic operation
MR52Emergency stop active
Timers
T0Supply pick-up: grip wait
T1Cover place: release wait
T2Cover check timeout
T3Jig pick-up: grip wait
T4Discharge: drop wait
Data memory
DM0Workpiece number
Positioning unit
R0Operation enable
R2Forced stop
R200Axis 1 Positioning start
R300Axis 1 Axis error clear
R305Axis 1 Servo ON
R310Axis 1 Homing request
R600Axis 2 Positioning start
R700Axis 2 Axis error clear
R705Axis 2 Servo ON
R710Axis 2 Homing request
R1000Axis 3 Positioning start
R1100Axis 3 Axis error clear
R1105Axis 3 Servo ON
R1110Axis 3 Homing request
R6600Ready
R6800Axis 1 Positioning start acknowledged
R6802Axis 1 Positioning complete
R6905Axis 1 Servo ready
R6910Axis 1 Homing complete
R7200Axis 2 Positioning start acknowledged
R7202Axis 2 Positioning complete
R7305Axis 2 Servo ready
R7310Axis 2 Homing complete
R7600Axis 3 Positioning start acknowledged
R7602Axis 3 Positioning complete
R7705Axis 3 Servo ready
R7710Axis 3 Homing complete
Special relays
CR2002Always ON
CR2008One pulse ON at start

Ladder explanation

The row numbers in the figures match the row numbers in the simulator's ladder window.

1InitializationRows 001–006

  • Row 002: CR2008 (one pulse at start) SETs the first step MR0 (preparing).
  • Rows 003–006: always ON, output operation enable R0 and servo ON for the 3 axes (R305/R705/R1105).

2Emergency stop and resetRows 007–014

  • Row 008: the emergency stop X3 SETs MR52 (emergency stop active)
  • Row 009: while the emergency stop is pressed, forced stop R2 turns ON and stops the 3 axes.
  • Rows 010–013: the reset button X2 clears the axis errors of the 3 axes and also clears the missing-cover fault MR41.
  • Row 014: when the reset button is released (LDF, falling edge), RES MR52 if the emergency stop has been released

Every step transition has an N.C. contact of MR52, so the process does not advance during an emergency stop. The conveyor and positioning start outputs also have an N.C. contact of MR52 so that they stop.

On the other hand, the loader up/down, chuck, clamp, and suction do not use MR52. If the emergency stop also returned the pneumatic devices, the loader would drop the workpiece it is holding.

3Automatic operation and cycle stopRows 015–017

MR50 (automatic operation) latches with Start X0, and the latch is broken by the N.C. contacts of Stop X1, emergency stop MR52, and all-done MR40.

MR50 is only checked in two places: "preparing → homing" and "cycle start → next workpiece". So even if Stop is pressed midway, the machine finishes discharging the workpiece being assembled and then stops at the cycle start (MR2) (cycle stop). After resuming from an emergency stop with Reset, it also stops once the current workpiece is discharged; press Start again to continue.

4Preparing and homingRows 018–025

  • Rows 019–020: if Start is pressed while preparing, the unit is ready (R6600), and all 3 axes are servo ready, go to homing
  • Rows 021–022: when all 3 axes have completed homing, go to the cycle start
  • Rows 023–025: during the homing step, turn ON the homing requests of the 3 axes

5Cycle start and base supplyRows 026–032

  • Rows 027–029: at the cycle start, if in automatic operation, go to waiting for base MR3 and at the same time add 1 to the workpiece number with INC DM0.
  • Rows 031–032: go on when photoelectric sensor 1 X4 detects the base. The supply conveyor Y0 runs only during MR3 (row 135), so it stops as soon as the step advances.

6Loader: move the base to the jigRows 033–049

  • MR4→MR5: the loader has arrived above the supply conveyor (axis 1 P1) (R6800 and R6802)
  • MR5→MR6: lowered end X6 → grip
  • MR6→MR7: when chuck open X7 and chuck closed X8 are both OFF and 0.5 s (T0) has passed since the close command → raise
  • MR7→MR8→MR9: at raised end X5, move above the jig (axis 1 P2), then lower
  • MR9→MR10→MR11→MR12: release at the lowered end, confirm chuck open X7, then raise

A chuck that has gripped a workpiece stops against it and never reaches the closed end X8 (problem 7). So the grip is judged by three conditions: "left the open end, has not reached the closed end, and 0.5 s has passed". If the closed end turns ON, the chuck missed the workpiece and closed on nothing, so the step does not advance.

7Clamp on the jig (the loader retreats at the same time)Rows 050–052

In MR12, the jig clamp Y3 is SET and, at the same time, the loader returns above the supply conveyor (axis 1 P1). The cover transfer will come above the jig, so the loader has to get out of the way.

The step advances when all three are in place: clamp forward end X10, workpiece present on the jig X11, and the loader move complete. As in problem 13, doing two unrelated motions in the same step shortens the cycle time.

8Cover transfer: take a cover from the magazine and put it on the baseRows 053–069

  • MR13→MR14: axis 2 has arrived above the magazine (P1)
  • MR14→MR15: axis 3 has lowered to the height of cover N
  • MR15→MR16: when suction confirmed X14 turns ON, raise
  • MR16→MR17→MR18: return to the raised end (axis 3 P1), then carry above the jig with axis 2 (P2)
  • MR18→MR19: lower axis 3 to the place height (P2)
  • MR19→MR20: when the vacuum break has run for 0.5 s (T1) and suction confirmed is OFF, raise (same as problem 9)
  • MR20→MR21: back at the raised end → cover check

Axis 2 (horizontal) only moves while axis 3 is at the raised end (P1). Moving sideways while lowered would make the suction pad or the cover hit the magazine or the base.

9Cover check and unclampRows 070–076

  • Rows 071–072: when photoelectric sensor 2 X12 detects the cover, go to unclamp.
  • Row 073: if it is not detected within 2 s (T2) of entering the cover check step, SET the missing-cover fault MR41. The error lamp Y8 and the red tower light Y11 turn on, and the process stays at the cover check.
  • Rows 075–076: in MR22, RES the clamp Y3 and at the same time move the cover transfer (axis 2) back above the magazine. Advance when clamp retracted end X9 and the axis 2 move are both complete.

Detecting a fault because "a condition was not met within a set time" is called a timeout. Add one to steps that wait for a sensor, in case the condition never comes; when the machine stops, the cause is clear right away.

10Loader: move the assembled workpiece to the discharge conveyorRows 077–093

This is the same flow as moving the base to the jig (MR4 to MR11), but this time the loader grips above the jig (axis 1 P2) and releases above the discharge conveyor (axis 1 P3).

  • MR23 to MR26: move above the jig → lower → grip (T3 0.5 s) → raise
  • MR27 to MR30: move above the discharge conveyor → lower → release → raise

The grip waiting time is split between T0 and T3 because using TMR on the same timer in two places would be a double coil.

11Discharge and next workpieceRows 094–102

  • Rows 095–096: run the discharge conveyor Y6 and advance on the falling edge (LDF) of photoelectric sensor 3 X15, which catches the moment the workpiece has passed the sensor.
  • Rows 097–100: 1 s (T4) later, if DM0 is 1 to 4, go back to the cycle start MR2 for the next workpiece
  • Rows 101–102: if DM0 is 5, go to all-done MR40. MR40 ends automatic operation MR50.

Row 097 connects the comparison instructions = DM0 1 to = DM0 4 in parallel (OR) with vertical lines.

12Axis 1 loader traverseRows 103–113

  • Rows 104–108: set the axis 1 point to P1 (above supply conveyor) / P2 (above jig) / P3 (above discharge conveyor) depending on the step. P1 is used for picking up (MR4) and for retreating (MR12); P2 is used in MR8 and MR23.
  • Rows 109–113: during the axis 1 move steps, turn ON positioning start R200.

The start output has an N.C. contact of MR52, so R200 turns OFF during an emergency stop. When the machine resumes after Reset, R200 turns ON again and its rising edge restarts the move to the same point. This is how the machine "resumes from where it stopped".

13Axis 2 cover transfer YRows 114–120

  • Rows 115–117: set P1 in MR13 (to the magazine) and MR22 (retreat), and P2 in MR17 (to the jig)
  • Rows 118–120: during the three move steps, turn ON positioning start R600

14Axis 3 cover transfer Z: choose the point with comparison instructionsRows 121–133

  • Rows 122–126: when lowering to pick up a cover (MR14), check the value of DM0 with comparison instructions and set P2 for cover 1, P3 for cover 2, … P6 for cover 5.
  • Rows 127–129: P1 for raising (MR16, MR20) and P2 for lowering to place (MR18)
  • Rows 130–133: during the four move steps, turn ON positioning start R1000

The covers are stacked 12 mm each, so the lowering distance must grow by 12 mm for every cover taken. In problem 13 the workpiece number was used directly as the point number, as in U_WRPPNT 1 DM0. Here, P1 is used for the raised end, so the point number is one more than the workpiece number. The ladder therefore splits the cases with = DM0 n and writes U_WRPPNT 3 n+1.

15Conveyors, loader up/down, and air chuckRows 134–153

  • Row 135: supply conveyor Y0 ON while waiting for the base (MR3)
  • Rows 136–137: discharge conveyor Y6 ON during discharge (MR31, MR32)
  • Rows 139–146: loader down Y1 ON during the 8 steps of lowering and working at the lowered end (grip, release). In all other steps it is OFF and the loader rises.
  • Rows 148–151: SET Y2 (chuck close) in the two grip steps and RES it in the two release steps
  • Rows 152–153: timers T0 and T3 count the grip waiting time

16Jig clamp, suction pad, and timersRows 154–164

  • Rows 155–156: SET the clamp Y3 in MR12 and RES it in MR22
  • Row 158: SET the vacuum valve Y4 in cover suction MR15
  • Rows 159–161: in cover place release MR19, RES Y4, turn ON the vacuum break valve Y5, and count 0.5 s with T1
  • Row 163: cover check timeout T2 (2 s)
  • Row 164: discharge conveyor drop wait T4 (1 s). It has an N.C. contact of MR52 so that it does not count during an emergency stop.

17Lamps and tower lightsRows 165–170

OutputLights when
Y7 Run lampAutomatic operation MR50
Y8 Error lamp / Y11 redEmergency stop MR52 or missing-cover fault MR41
Y9 greenAutomatic operation, with no emergency stop and no fault
Y10 yellowNot in automatic operation, with no emergency stop and no fault (stopped)

Rows 167–168 branch one circuit to two coils, Y8 and Y11.

The sample wiring and ladder data can be downloaded fromGitHuband loaded with "Load wiring" and "Load ladder" in the simulator.

Key points

  • Even with more units, each step is still written as "current step AND completion condition → SET the next step, RES the current one". First make a step table (like the one above) and decide, for each step, what to move and how to confirm completion; then turn it into ladder.
  • Motions that cannot collide, such as clamping while the loader retreats, or unclamping while the cover transfer retreats, can run in the same step; waiting for both to finish saves time.
  • Before any horizontal move (axis 1, axis 2), always have a step that confirms the vertical part (loader, axis 3) is at the raised end. The order of the steps itself works as an interlock that keeps the mechanisms from colliding.
  • For an emergency stop, separate "what to stop" (motors, conveyors) from "what to hold" (a chuck or suction that is holding a workpiece). Turning everything OFF is not always the safe choice.