Introduction: Crane Game W/ Arduino
A crane game where the user controls the x and y axis like the carnival version, but also the z axis and open/ close of the claw(grip).
Step 1: Components Overview
-Arduino mega- has enough I/O and I had one at home.
- 2 Arcade joysticks
- 1 arcade button
-1 small servo
- 3 dc motors
-12 relays
- igus linear slider bearings and rail
- 9 meters of aluminum profile
- grip(claw)
- 6 micro switches
-LED strip
-transistors
Step 2: Size and Structure
I built 500mm x 500mm x 900mm. I chose this size based on the (idun) rail I had was1000mm, and when placed on a table I don't what to look through the top.
The frame is 20mm x20mm aluminum extrusions chosen for price, weight and strength at the chosen dimensions.
I am using the profile grooves later so I did not want to use inside corner braces so I opted for grinding down some counter sink screws and tapping the profiles. Then I printed some cover plates for esthetics.
In the bottom I cut some old scratched plexi I had laying around.
Step 3: Gantry and Drive
I had 1 meter of igus rail and 8 igus drylin bearing blocks.
I cut the profile in half to get an x and y axis. Then after mounting everything I found that the cantilever was ruining a good thing and I needed to spread out the weight. So I ripped the profile down the middle (ish) and mounted it again. This time it worked.
I am using 2 DC motors that are geared down to 150 rpm. They are controlled via relays. I printed motor mounts that screw on to the profile. Do to spacing I turned out a pair of adapters.
I printed blocks that the belt wraps around, adjustable via 2 screws through the back.
Micro switches are placed at each end of the profile along with a spring for soft stopping.
I did start by using stepper motors, that was great because of the precision but they ended up not being strong enough on their own and it was very little effort to switch over to DC motors.
Step 4: Electronics
I have a small circuit where my power source gets divided. I have this because my drivers / or relays were causing my arduino to restart. It is in- diode- capacitor loop- output.
There is a small circuit board with all the power that goes through the arduino board for simplicity's sake.
I have a relay card with 4 ports to reverse the polarity of the spool motor.
I also have and 8 relay card doing the same for the gantry motors.
My power supply is pulled from an old pc.
I printed some spacers/ mounts and was careful to keep the air vents open. I also soldered off all the wires I did not need. •Remember if you use a PC power source that connecting the green wire to a ground wire are needed to make it work.
I used this tutorial from Sparkfun to drive the LED strip.
I have separate for:
12v
9v
RGB transistors
Relays A
Relays B
Arduino grounds
Micro grounds
Step 5: Controls
The interface is two joysticks, an arcade button and piece of sheet metal I bent.
I tested my wiring with the built in LED on the arduino. Just to avoid trouble shooting in tight spaces.
I used 14 inputs between the joysticks and micro switches.
I also used 9 outputs for the motors and Led strip.
The Arduino script is mostly based off the button example.
for example joyOneLeftState is joystick one to the left, gameState is a variable that is toggled by a Start button and engages a timer function. and xEndState is the micro switch that is pushed at the end of the rail by.
"// X Axis
if (joyOneRightState == HIGH && gameState == HIGH && xEndState== LOW) {
digitalWrite (32, LOW); digitalWrite (33, LOW); }
else {
digitalWrite (32, HIGH); digitalWrite (33, HIGH); }
if (joyOneLeftState == HIGH && gameState == HIGH && xStartState== LOW) {
digitalWrite (34, LOW); digitalWrite (35, LOW); }
else {
digitalWrite (35, HIGH); digitalWrite (34, HIGH); }
"