Claw machine cabinet
A claw machine cabinet with the mechanism inside: gantry, winch, servo claw, prizes and a prize chute. Wire up its motors and the claw moves.
There are two: clawcabinet has a NEMA 17 stepper on each axis, for an A4988
or a DRV8825, and clawcabinetdc has a TT gear motor on each axis, for an
H bridge such as the L293D. Everything else is the same.
Pins
| Pin | What it does |
|---|---|
XA1 XA2 XB1 XB2 |
The X stepper's coils (stepper cabinet). |
YA1 YA2 YB1 YB2 |
The Y stepper's coils (stepper cabinet). |
X+ X-, Y+ Y- |
The X and Y gear motors (gear motor cabinet). Current from + to - moves away from home. |
VCC, GND |
5 V for the claw servo and the chute sensor. GND is also the home switches' common. |
W+, W- |
The winch's gear motor. Current from W+ to W- lowers the claw. |
CLAW |
The claw servo's signal. 30 degrees is open; it is shut from 90. |
XHOME |
The X home switch: closed to GND while the carriage is home. |
YHOME |
The Y home switch: closed to GND while the bridge is home. |
BEAM |
The chute sensor's output: LOW while the beam gets through, HIGH while a prize falls through it. |
The motors, the servo, the switches and the sensor are the parts a home build uses, on the same pins they have on the bench, so a sketch written for the loose parts runs the cabinet unchanged.
How it moves
Home is the front left corner, over the chute. X runs right along the bridge
and Y runs back, 200 by 160 mm by default (width and depth). Each axis is
a GT2 belt on a 20-tooth pulley, 40 mm a turn, so on the stepper cabinet a
full step is 0.2 mm and the floor is 1000 by 800 steps. On an A4988, DIR high
drives away from home.
Each axis stops hard at both ends. Past an end the belt slips and the motor
turns on without moving anything, so a sketch that has lost steps is wrong
about where the claw is until it homes again. A lever switch at each home end
closes in the last fifth of a millimeter. The cabinet's harness joins both
switches' COM to its GND, so wire XHOME or YHOME to an INPUT_PULLUP
pin and the pin reads LOW at home.
The winch pays out 63 mm of cable a turn, and drop (90 mm) puts the claw on
the floor. The claw starts at start_x and start_y, wherever the last game
left it.
Grabbing a prize
The claw picks up a prize when it shuts on the floor within reach (20 mm)
of one. How hard it holds is how far it was told to close: grip (130
degrees) or more is a strong grip, which holds anything it picked up. Less is
a gentle grip, which holds a prize only if the claw closed squarely on it and
drops it halfway up otherwise. That is how a real cabinet's payout setting
feels.
Let go over the chute, a prize falls through it and breaks the beam for about an eighth of a second on its way to the prize door. Let go anywhere else, it lands on the floor and can be grabbed again. The round arrow on the cabinet puts the prizes back, and so does every Run.
What the model gets right
- The motors are the same models as the NEMA 17 and the DC motor, and they load their drivers the same way.
- The claw is the servo model: the Arduino library's pulse window, 600 degrees a second, and no motion under 4 V.
- The switches and the beam are worked by where the mechanism is, so homing, limits and the win sensor behave as on a real cabinet.
- Everything is deterministic: the same play wins or loses the same way.
What it does not model
- The claw swinging on its cable, prizes knocked or stacked, and a prize tumbling: it lands where it was let go.
- Any load on the motors: a stepper here never stalls carrying the bridge.