Target behavior
Start a play with the Start button and move the arm left/right and back only while the buttons are held. When the button is released, the arm automatically grabs a prize, carries it to the drop chute, and releases it
What you will learn
This time you run a crane game, like the ones in arcades, with three servo axes and an air gripper.
The key is combining JOG operation, which moves an axis only while a button is held, with automatic point positioning.
How to play (how the equipment works)
Signal tower and emergency stop
I/O assignment
| Input | Description | Output | Description |
|---|---|---|---|
| X0 | Start button | Y0 | Claw (air gripper) close |
| X1 | Left-right button (→) | Y1 | Playing lamp |
| X2 | Depth button (↑) | Y2 | Prize lamp |
| X3 | Emergency stop (stays ON when pressed) | Y3 | Signal tower green |
| X4 | Reset button | Y4 | Signal tower yellow |
| X5 / X6 | Claw open / closed | Y5 | Signal tower red |
| X7 | Photoelectric sensor: prize won |
The following points are registered for the three servo motors. Left-right and depth move by JOG, so after homing they stop automatically at the ends of the stroke (software limits).
| Axis | Point No. | Position [mm] | Speed [mm/s] | Acceleration [mm/s²] | Description |
|---|---|---|---|---|---|
| Axis 1 Left-right | 1 | 0 | 200 | 800 | Above the drop hole |
| Axis 2 Depth | 1 | 0 | 150 | 600 | Above the drop hole |
| Axis 3 Up-down | 1 | 0 | 120 | 500 | Raised end |
| 2 | 150 | 120 | 500 | Lowered end (claw tips 5 mm above the floor) |
The relays used to control each of the three axes are as follows. Operation enable, forced stop, and operable are shared by all axes.
While a JOG forward / JOG reverse relay is ON, the axis moves that way at a constant speed; when it turns OFF the axis decelerates and stops (this works even before homing). As with point positioning, the unit must be operable, the servo ready, and the axis not in error.
| Name (all axes) | Direction | Relay |
|---|---|---|
| Operation enable | Output | R0 |
| Forced stop | Output | R2 |
| Operable | Input | R6600 |
| Name | Direction | Axis 1 Left-right | Axis 2 Depth | Axis 3 Up-down |
|---|---|---|---|---|
| Servo ON | Output | R305 | R705 | R1105 |
| Servo ready | Input | R6905 | R7305 | R7705 |
| Homing request | Output | R310 | R710 | R1110 |
| Homing complete | Input | R6910 | R7310 | R7710 |
| Positioning start | Output | R200 | R600 | R1000 |
| Positioning start acknowledged | Input | R6800 | R7200 | R7600 |
| Axis busy | Input | R6903 | R7303 | R7703 |
| Positioning complete | Input | R6802 | R7202 | R7602 |
| Positioning complete clear | Output | R202 | R602 | R1002 |
| Axis error | Input | R6900 | R7300 | R7700 |
| Axis error clear | Output | R300 | R700 | R1100 |
| JOG forward | Output | R206 | R606 | R1006 |
| JOG reverse | Output | R207 | R607 | R1007 |
| Axis | How it moves | Points |
|---|---|---|
| Axis 1 Left/right | JOG (R206 forward) / point operation | P1 above the chute (0 mm) |
| Axis 2 Front/back | JOG (R606 forward) / point operation | P1 above the chute (0 mm) |
| Axis 3 Up/down | Point operation | P1 raised end / P2 lowered end |
A JOG forward relay moves the axis forward at a constant speed only while it is ON, and the axis decelerates and stops when it turns OFF. It is not a rising-edge command like positioning start, so passing the button ON/OFF straight to the relay is enough to move the axis.
| Step | Description | Condition to advance | Main outputs |
|---|---|---|---|
MR0 | Preparing | R6600 ready, servo ready on 3 axes | - |
MR1 | Homing | Homing complete on 3 axes | R310/R710/R1110 ON |
MR2 | Standby | X0 Start | - |
MR3 | Left/right JOG | Falling edge of X1 (button released) | R206 ON while X1 |
MR4 | Front/back JOG | Falling edge of X2 (button released) | R606 ON while X2 |
MR5 | Lowering | Axis 3 start acknowledged and positioning complete | Axis 3 → P2 |
MR6 | Close the arm | X5 open end OFF and T0 0.5 s | Y0 SET |
MR7 | Raising | Axis 3 start acknowledged and positioning complete | Axis 3 → P1 |
MR8 | Move above the chute | Axes 1 and 2 start acknowledged and positioning complete | Axes 1 and 2 → P1 |
MR9 | Open the arm | X5 open end and T1 1 s → MR2 | Y0 RES |
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 | Start |
X1 | Left/right button (→) |
X2 | Front/back button (↑) |
X3 | Emergency stop |
X4 | Reset |
X5 | Arm open |
X7 | Photoelectric prize won |
| Outputs | |
Y0 | Arm close |
Y1 | Play lamp |
Y2 | Prize lamp |
Y3 | Tower light green |
Y4 | Tower light yellow |
Y5 | Tower light red |
| Internal relays | |
MR0 | Preparing |
MR1 | Homing |
MR2 | Standby |
MR3 | Left/right JOG |
MR4 | Front/back JOG |
MR5 | Lowering |
MR6 | Close the arm |
MR7 | Raising |
MR8 | Move above the chute |
MR9 | Open the arm |
MR20 | Prize won |
MR30 | Playing |
MR52 | Emergency stop active |
| Timers | |
T0 | Arm close wait |
T1 | Arm open wait |
T2 | Prize lamp on time |
| Positioning unit | |
R0 | Operation enable |
R2 | Forced stop |
R200 | Axis 1 Positioning start |
R206 | Axis 1 JOG forward |
R300 | Axis 1 Axis error clear |
R305 | Axis 1 Servo ON |
R310 | Axis 1 Homing request |
R600 | Axis 2 Positioning start |
R606 | Axis 2 JOG forward |
R700 | Axis 2 Axis error clear |
R705 | Axis 2 Servo ON |
R710 | Axis 2 Homing request |
R1000 | Axis 3 Positioning start |
R1100 | Axis 3 Axis error clear |
R1105 | Axis 3 Servo ON |
R1110 | Axis 3 Homing request |
R6600 | Ready |
R6800 | Axis 1 Positioning start acknowledged |
R6802 | Axis 1 Positioning complete |
R6905 | Axis 1 Servo ready |
R6910 | Axis 1 Homing complete |
R7200 | Axis 2 Positioning start acknowledged |
R7202 | Axis 2 Positioning complete |
R7305 | Axis 2 Servo ready |
R7310 | Axis 2 Homing complete |
R7600 | Axis 3 Positioning start acknowledged |
R7602 | Axis 3 Positioning complete |
R7705 | Axis 3 Servo ready |
R7710 | Axis 3 Homing complete |
| Special relays | |
CR2002 | Always ON |
CR2008 | One pulse ON at start |
The row numbers in the figures match the row numbers in the simulator's ladder window.
CR2008 (one pulse at start) SETs the first step MR0 (preparing).R0 and servo ON for the 3 axes (R305/R705/R1105).X3 SETs MR52 (emergency stop active)R2 turns ON and stops the 3 axes.X4 clears the axis errors of the 3 axesLDF), RES MR52 if the emergency stop has been releasedThe transitions, JOG, and positioning start all have an N.C. contact of MR52, so during an emergency stop the axes do not move and the process does not advance. The arm Y0 does not, so a prize being held is not dropped.
R6600) and all 3 axes are servo ready, go to homing. In this problem homing starts as soon as the PLC is put in RUN (it does not wait for the Start button).MR2At the origin (0 mm on all 3 axes), the arm is directly above the chute at the raised end.
If Start X0 is pressed during standby MR2, go to left/right JOG MR3. After each play, the sequence comes back to this MR2.
MR3, turn ON axis 1 JOG forward R206 only while the left/right button X1 is heldX1 (LDF, the moment the button is released), go to front/back JOG MR4R606 only while X2 is held, and go to lowering MR5 when it is releasedThe JOG outputs use "step AND button", so once the step has moved on, pressing the same button no longer moves the axis. The rule "left/right then front/back, once each" is achieved just by the order of the steps.
The key is using LDF X1 as the transition condition, not LD X1 (while held). With LD X1, the step would advance the moment the button is pressed, and there would be no chance to JOG.
MR5→MR6: axis 3 has reached the lowered end (P2) (R7600 and R7602)MR6→MR7: when the arm open end X5 turns OFF and 0.5 s (T0) has passed since the close command, raiseMR7→MR8: axis 3 is back at the raised end (P1)The arm is not confirmed with the closed end X6 because the claws stop against the prize and do not reach the closed end when they grab it (problem 7). To advance whether the arm grabbed a prize or missed, the condition is "left the open end AND a set time has passed".
MR8→MR9: both axis 1 and axis 2 have arrived above the chute (P1)MR9→MR2: when the arm open end X5 turns ON and 1 s (T1) has passed since the open command, return to standby MR2 and end the playAxes 1 and 2 move in the same step, so the arm returns to the chute in a straight diagonal line. Waiting 1 s after opening gives the prize time to fall.
MR5 and P1 (raised end) in raising MR7R1000MR8, set the axis 1 and axis 2 points to P1 (above the chute) and turn ON positioning start R200 and R600Wherever the JOG left the arm, point operation brings it back to P1 (0 mm) precisely. The program uses "JOG for positions the player decides" and "point operation for returning to a fixed position".
Y0 in MR6 and count 0.5 s with T0Y0 in MR9 and count 1 s with T1Because SET/RES is used, the arm stays closed while it rises and moves.
MR20 (prize won) on the rising edge (LDP) of photoelectric sensor X7T2 while MR20 is ON, then RES MR20A prize passes the sensor in an instant, so lighting the lamp with LD X7 would turn it off right away. SETting MR20 on the rising edge and RESetting it with a timer "stretches a momentary signal into a fixed lighting time".
This circuit is independent of the play steps, so it detects a prize whenever it falls.
MR30 (playing) is ON while any of MR3 to MR9 is ONY1 = MR30Y2 = MR20Y3 = playing, yellow Y4 = not playing (standby), red Y5 = emergency stop. Green and yellow have an N.C. contact of MR52, so only red lights during an emergency stop.For a state that spans several steps, such as "playing", make one internal relay with the steps in parallel; then it can be reused by several outputs such as lamps.
The sample wiring and ladder data can be downloaded fromGitHuband loaded with "Load wiring" and "Load ladder" in the simulator.
Key points