Instructables

Build a big crane game

FeaturedContest WinnerContest WinnerContest Winner
How to build a whole room crane game.  Based on the arcade style 'Crane Game' or 'Claw Machine'.  This is a continuation of a previus instructable titled CRANE GAME in which we built a 2-axis crane game in a door frame.  We have now added a third axis and wireless control.  And made it big.

**
October 2013
real arcade machine claw 
https://www.tindie.com/products/marc_cryan/claw/
***

*** September 2013  **
I have a project running on tindie.com   for a real claw machine kit.
****


A few technical and functional improvements:
  • Less wires - controllers and batteries move with the motors and are signaled with IR light.
  • Precision not needed - I was able to set-up a 8x10ft track without measuring anything
  • Reproducible - used standard parts, used the same components in many spots
  • Expandable - use longer tracks to make it bigger - track cost is about 50cents a foot.
  • Removable - hangs from the ceiling by 4 small hooks
  • Future?  Could be used as basis for a big 3D printer
VIDEO:


7MbrDo5RalI





Overview
  1. Materials
  2. Frame
  3. X-Axis Mechanical
  4. Y-Axis Mechanical
  5. Z-Axis Mechanical
  6. X-Axis Electronics
  7. Y-Axis Electronics
  8. Z-Axis Electronics
  9. IR Control Overview
  10. IR Receive Circuit
  11. IR Transmitter (TV remote)
  12. IR Decode Process
  13. X-Axis Control Code
  14. Y/Z - Axis Control Code
  15. What's next?
  16. Complete Wiring
  17. Complete Code
note: this still has some holes in it, feel free to ask for stuff
 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

Picture of Materials
Materials:
6 -  8' J channel
7 - Big continous servo motors  -- HobbyPartz  --- EXI-Servo-B1226
1 - Roll of electrical tape
2 - Arduino UNO boards
3 - Small peices of perferatored board
2 - IR de-modulator
1 - Universal TV remote control
1 - 25' coiled phone chord
1 - 15' straight phone chord
1 - Roll packing tape
1 - Pre-made claw with servo  -- Spark Fun ROB-10332
2 - 4 AA battery packs, rechargeable -- eneloop AA,  
6 - screw hooks
3 - Peice plywood - 2x6" each
1 - roll metal plumbers strap

Tools:
- Drill
- Computer
- Soldering iron

Step 2: Frame

Frame:

X-Axis -
-The X-Axis consists of 2 parrallel tracks mounted to the ceiling about 9' appart
Y-Axis
-One track that is supported on either end by the Y-Axis

To Make the Tracks:
- Place 2 J channels back-to-back
- Run a peice of clear tape down the top seam, and fold over
- Run a second peice of tape along the bottom

Using 6 peices of J channel, make 3 tracks

Hang X-axis
-Put 2 screw hooks in the ceiling, one at each end of the expected X tracks
-Cut 4 peices of plumbers strap, about 6 inches long
-Thread the peice of plumbers strap towards the end of each track
-Bend the plumbers strap, like an L, so that it will hold up the track
-Hang the other end of the plumbers strap on the hooks on the ceiling
-Adjust as needed

Prepare Y-axis
-The Y axis will be suspended from the motorized carriages on the X-axis
-For now, cut 2 more pieces of plumbers strap and thread through each end of Y-axis

Step 3: X - Axis Mechanical

Picture of X - Axis Mechanical
DSCF0099.JPG
DSCF0123.JPG
X-Axis Mechanica
The X axis has 2 motorized carrages

Modify servos for continous rotation
-Take the 4 screws out of the fron of the motor
-Take off the smaller part of the plastic shell
-Disassemble gears
-There is a small white disk around the shaft of the potentioometer
-Remove the smal white disk
-Re-assemble

Make plywood base
- Cut 2 pecised of 1/4 ply (used MDF) to 3x6"
- Drill/cut 2 slots in each peice - 1/4" wide, 2inch long, and 3.5" apart [CHECK THIS]

Attach Servos
-Attach a large wheel to the servo, use a screw
-Wrap wheel with something for friction (used this sticky foam)
-Put the servo Bracket in the slot
-Wrap servo and base with electrical tape to secure
-Repeat with the second servo
-When done, weels should be a little less than 1/8" appart (3/32" ?)

Hang the assembled carraiges, one on each X axis

Put an eye-hook on the bottom of each platform

Hange the Y-axis track from these hooks using plumbers strap

Step 4: Y-Axis mechanical

Picture of Y-Axis mechanical
DSCF0156.JPG
The Y axis has one carraige.

Make the carraige just like the ones for the X axis.

But -- add a third servo, tapped to the bottom of the platform.  This will control the claw (Z axis)

Step 5: Z-axis mechanical

Picture of Z-axis mechanical
DSCF0174.JPG
Tie a 8-10 ft string to the wheel on the third servo of the Y axis carriage

Assemble a claw -- used claw from sparkfun __________

Tie claw to other end of string

Step 6: X-axis electronics

Picture of X-axis electronics
DSCF0105.JPG
DSCF0096.JPG

Slave X-axis board
  • Cut a piece of proto board about 1x1"
  • Follow the schematic to solder on  2 3-pin headers and 3 screw terminals (used 4, 2 sets of 2)
  • Cut a 12' lenth of non-curly phone chord.
  • Tape cord to the bottom of the Y-axis
  • Connect 3 wires to the proto board
  • Using electrical tape, attach proto board to X-axis carraiage
Master X axis board



***
Arduino pins used:
 
D11    IR receive
D9      Servo Xa
D10    Servo Xb 

Step 7: Y axis electronics

Picture of Y axis electronics
IMAG0065.jpg
Master  X-axis board  - this attaches to an arduino, like a mini-sheild.
This board had connectors for 3 servo motors (2 for Y axis, 1 for Z).  It will also have screw terminals for power.  In addition to the connectors it will have an IR reciever, this is a special component that decodes IR signals from TV remotes and then sends them out to the arduino.
Here are the parts:
  • Cut a peice of proto boardboard about 1x3"
  • Cut 3 peices of header that are 3 pins long (these will go to servos)
  • Cut 4 pecies of header that have just one pin (these will go to control pins on arduino and to ground)
  • A 2 terminal screw terminal (for power)
See the schematic for wiring.  Here are some general things to know:
  • Arduino ground connects to battery negative
  • Servos have 3 pins; power, ground, and control.  All the grounds can be connected together, and to Arduino ground. 
  • All the power pins can be connected to the battery positive terminal.  Each control pin goes to a seperate pin on the Arduino board.
  • The IR decoder connector has 3 pins; power, ground and a data out.  Power goes to the 5V port on the arduino.  Ground goes to Arduino ground.  And Data out goes to its own pin on the Arduino.
  • When assembled the servo connectors and the screw terminals are on the top of the board.  The single pin connections come out the bottom of the board and go to the Arduino pins.

***
Aduino pins used:

D11 - IR receiver
D9     Servo Ya
D10   Servo Yb
D2     Servo Z
D6     Servo Claw

Step 8: Y and Z axis electronics

The Zaxis doesn't have it's own board.  It is just goes to one of the connectors on the Y board.  1 servo opens and clses the claw, one servo raises and loweres the claw by winding up a string on a spool.

Step 9: IR Control Overview

IR signals are send from a universal television remote control.  The signals are received by the Arduinos on the X and Y axis.
General steps:
  • build a circuit to get the signals
  • decode some signals for from the controller
  • program the Arduinos do do things when they get a signal.
Also - it is helpful to get everything working with wires first, then substitute the IR control.  I started by sending commands from a laptop over the USB ports.

Step 10: IR Receiver Circuit

Picture of IR Receiver Circuit
The circuit to recieve IR signals is pretty simple,  as long as you have right parts!  Mainly an IR receiver and demodulator.
The IR reciever has 3 pins; power (to 5V on arduino), ground (to arduino ground), and a digital output pin (sends data to a pin on the arduino).

Here is the IR receiver I am using:  IR Sensor IC 38KHZ Vishay Infrared Receivers - Mfg p/n TSOP38238SS1V - mouser p/n 782-TSOP38238SS1V  -- Pinouts are 1:data out, 2:Grnd: 3:Vs (supply Voltage, 5V).  Facing the bump pine 1 is on the left.


Step 11: IR Decode Process

Picture of IR Decode Process
IMAG0057.jpg
The buttons we are using are: up, down, left, right, select, and menu.  DVD players usually use all these buttons, so program the TV remote to send DVD signals from a DVD player that you do not have.

For the univerasal remove, have used code: 1119 which is for a ACESONIC DVD player.

(to program remote; hold setup; press dvd; 1119)

The code below will display the values that the arduino gets from the remote.

Write down the numbers for each button.   These numbers will be added to the Arduino code.

Arduino Code:

/// read IR remote

//IR  setup - stuff
#include <IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
long x = 0;
void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop(){
  // read IR buttons
  if (irrecv.decode(&results)) {
    x = results.value;
    Serial.println(results.value, HEX);   //for decoding buttons
    Serial.println(x);
    delay(100);
    irrecv.resume();
  }
}

Step 12: X-axis control code

The X axis moves in two directions.

X-axis code:

#include <Servo.h>
#include <Wire.h>
Servo XA;
Servo XB;

int dir = 0;
int oldDir = 0;

//IR stuff
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
String action;
String oldAction;
//

unsigned long time;
unsigned long timeIR;
unsigned long timeDiff;

void setup(){
  Wire.begin();
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop(){
  // read IR buttons and set the action //

  if (irrecv.decode(&results)) {
    long x = results.value;
    //Serial.println(results.value, HEX);   //for decoding buttons
    // Serial.println(x);
    timeIR = millis();     //record time of button push

    switch(x){

    case 351005205:
      action = "up arrow";
      dir = 5;
      break;

    case 350988375:
      action = "down arrow";
      dir = 6;
      break;

    case 350963895:
      action = "left arrow";
      dir = 1;
      break;

    case 350976645:
      action = "right arrow";
      dir = 2;
      break;

    case 350952165:
      action = "ok/mute";
      dir = 3;
      break;

    case 350986335:
      action = "B2";
      dir = 4;
      break;

    case 4294967295:
      break;
    }
    irrecv.resume(); // Receive the next value
  }

  timeDiff = millis() - timeIR;      
  if ((timeDiff > 200) && dir !=0) {   //if no button
    dir = 0;
    action = "none";
  }

  if(action != oldAction){
    if (action == "up arrow"){
      XA.attach(9);
      XA.write(0);
      XB.attach(10);
      XB.write(180);
      Serial.println("X go away");
      delay(100);
    }
    if(action == "down arrow"){
      XA.attach(9);
      XA.write(180);
      XB.attach(10);
      XB.write(0);
      Serial.println("X come back");
      delay(100);
    }
    if ((action == "none") && (oldDir == 5 || oldDir==6)){
      XA.detach();
      XB.detach();
      Serial.println("stop x axis");
    }
  //send commands
    Wire.beginTransmission(9);
    Wire.send(dir);
    Wire.endTransmission();
    Serial.println("send dir   ");
    Serial.print(dir);
    Serial.print("  ");
    Serial.println(action);
  }
    oldDir = dir;
    oldAction = action;
    delay(100);

}

Step 13: Y and Z axis code

The code to control the Y and Z axii are both loaded onto the same Arduino.,  So the code is all in one program.
The Y axis moves in 2 directions, the Z axis goes up and down, and the claw is opened and closed.

Arduino Code:

#include <Servo.h>
#include <Wire.h>

Servo YA;
Servo YB;
Servo Z;
Servo Claw;

//IR stuff
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
String action;
String oldAction;

unsigned long time;
unsigned long timeIR;
unsigned long timeDiff;

int dir = 0;
int oldDir = 0;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop(){
  // read IR buttons and set the action //
  if (irrecv.decode(&results)) {
    long x = results.value;
    //Serial.println(results.value, HEX);   //for decoding buttons
    //Serial.println(x);
    timeIR = millis();     //record time of button push

    switch(x){

    case 351005205:
      action = "up arrow";
      dir = 5;
      break;

    case 350988375:
      action = "down arrow";
      dir = 6;
      break;

    case 350963895:
      action = "left arrow";
      dir = 1;
      break;

    case 350976645:
      action = "right arrow";
      dir = 2;
      break;

    case 350952165:
      action = "ok/mute";
      dir = 3;
      break;

    case 350986335:
      action = "B2";
      dir = 4;
      break;

    case 4294967295:
      break;
    }
    irrecv.resume(); // Receive the next value
  }


  timeDiff = millis() - timeIR;      
  if ((timeDiff > 200) && dir !=0) {   //if no button
    dir = 0;
    action = "none";
  }


  if(action != oldAction){
    if (action == "left arrow"){
      YA.attach(9);
      YA.write(0);
      YB.attach(10);
      YB.write(180);
      Serial.println("Y go left");
      delay(100);
    }
    if(action == "right arrow"){
      YA.attach(9);
      YA.write(180);
      YB.attach(10);
      YB.write(0);
      Serial.println("Y go right");
      delay(100);
    }

    if(action == "B2"){
      Z.attach(2);
      Z.write(180); //down
      Claw.attach(6);
      Claw.write(100); // open?
      Serial.println("claw down and open");
      delay(100);
    }

    if(action == "ok/mute"){
      Z.attach(2);
      Z.write(0);    //up
      Claw.attach(6);
      Claw.write(20); //  close?
      Serial.println("claw up and close");
      delay(100);
    }


    if((action == "none") && (oldDir == 1 || oldDir == 2 || oldDir == 3 || oldDir ==4)){
      YA.detach();
      YB.detach();
      Z.detach();
      Claw.detach();
      Serial.println("all stop");
      delay(100);
    }

    Serial.print(dir);
    Serial.print("  ");
    Serial.println(action);
  }
  oldDir = dir;
  oldAction = action;
  delay(100);

}#include <Servo.h>
#include <Wire.h>

Servo YA;
Servo YB;
Servo Z;
Servo Claw;

//IR stuff
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
String action;
String oldAction;

unsigned long time;
unsigned long timeIR;
unsigned long timeDiff;

int dir = 0;
int oldDir = 0;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop(){
  // read IR buttons and set the action //
  if (irrecv.decode(&results)) {
    long x = results.value;
    //Serial.println(results.value, HEX);   //for decoding buttons
    //Serial.println(x);
    timeIR = millis();     //record time of button push

    switch(x){

    case 351005205:
      action = "up arrow";
      dir = 5;
      break;

    case 350988375:
      action = "down arrow";
      dir = 6;
      break;

    case 350963895:
      action = "left arrow";
      dir = 1;
      break;

    case 350976645:
      action = "right arrow";
      dir = 2;
      break;

    case 350952165:
      action = "ok/mute";
      dir = 3;
      break;

    case 350986335:
      action = "B2";
      dir = 4;
      break;

    case 4294967295:
      break;
    }
    irrecv.resume(); // Receive the next value
  }


  timeDiff = millis() - timeIR;      
  if ((timeDiff > 200) && dir !=0) {   //if no button
    dir = 0;
    action = "none";
  }


  if(action != oldAction){
    if (action == "left arrow"){
      YA.attach(9);
      YA.write(0);
      YB.attach(10);
      YB.write(180);
      Serial.println("Y go left");
      delay(100);
    }
    if(action == "right arrow"){
      YA.attach(9);
      YA.write(180);
      YB.attach(10);
      YB.write(0);
      Serial.println("Y go right");
      delay(100);
    }

    if(action == "B2"){
      Z.attach(2);
      Z.write(180); //down
      Claw.attach(6);
      Claw.write(100); // open?
      Serial.println("claw down and open");
      delay(100);
    }

    if(action == "ok/mute"){
      Z.attach(2);
      Z.write(0);    //up
      Claw.attach(6);
      Claw.write(20); //  close?
      Serial.println("claw up and close");
      delay(100);
    }


    if((action == "none") && (oldDir == 1 || oldDir == 2 || oldDir == 3 || oldDir ==4)){
      YA.detach();
      YB.detach();
      Z.detach();
      Claw.detach();
      Serial.println("all stop");
      delay(100);
    }

    Serial.print(dir);
    Serial.print("  ");
    Serial.println(action);
  }
  oldDir = dir;
  oldAction = action;
  delay(100);

}

Step 14: Assembly

Picture of Assembly
DSCF0123.JPG
DSCF0145.JPG
DSCF0133.JPG
X axis motors/boards things (carriages?) hang from the X-axis tracks that hang from the ceiling.

The Y axis tracks hang from the X-axis carriages.

The Y axis carriage goes on the Y axis track.

Step 15: Play with it

Picture of Play with it
DSCF0130.JPG
DSCF0125.JPG
Give the conroller to the kids and let them go nuts.  The whole thing does move a bit slowly, but that is probably for the best.

Step 16: VIDEO

Here are some more videos....

This sort of shows that a claw on a string is not a very good way to pick things up!

Fail to pick up Kermit





Fail to pick up Shoe




Fail to pick up Shoe again




Fail to pick up Sock





Cheat to pick up sock, track gets stuck




Pick up several items -- some success --- plastic bag, shoe

Step 17: What's next

A few basic things to improve:
  • Claw is not great, probably just need more power to the open/close servo
  • Batteries have to be removed and to recharge them, so that is a hassle
  • If you move to a different spot in the room the controls no longer make sense
More awsome things to do:
  • Control with SmartPhone
  • Add some automation; can some routines be preprgrammed?  
  • Add sensors/camera so the claw can find stuff on its own?
  • Maybe write a program to have the claw take stuff out of a toy box and arrange it in the room?  Could it be used to serve salad?

Step 18: Complete Wiring

Picture of Complete Wiring
Xaxis_FirstBoard.bmp
Xaxis_2ndBoard.bmp
Here is all the wiring in one place.

PDF and Eagle Schematic

Probably has errors.

*correction* - Zservo should go to D5

Step 19: Complete Code

Here is all the code in one place:
how many continous servos did you use?
And what is the IR de-modulator? could you
send a picture of it separatly?

thanks!
Tangoforce1 year ago
Ok I gotta say that is absolutely brilliant. I was fascinated by them things as a kid lol
Awesome. Big man-points score right there.
I haven't got my head around arduinos yet, but, I'm thinking about using worm driven wheels controlled by multi channel proportional radio -so does not matter.
Again, fantastic stuff. Did you ever try this set up with a more powerful claw servo by the way, how does it wok out?
marc.cryan (author)  Fingermouse1 year ago
late replay -- I haven't gotten around to adding a larger claw to the big crane game. I am expecting a giant motorized cardboard crane robot kit from kickstarter, if the claw is good I will try that.
I have my claw now and a heavy duty servo which I will need to fab up some brackets to fit it all together. It will fit -eventually :)
marc.cryan (author) 1 year ago
Awesome! Build a crane machine!

I used the servo motors because I already had them. I disabled the position feedback, so they are just small DC motors with gearboxes and control boards, in a plastic case. My thought was "What can I do with all these servo motors? Maybe I can just tape them together...."

All the Arduino stuff and IR is not really needed either. You could do this with no micros, just physical switches and wires.

I still have the thing up on the ceiling, but I made it hard to replace the batteries, and did not include an off switch, so they die over a few days even if not used.
mcsk8rg1 year ago
i had this idea since long ! m really happy to see someone else do it . i can actually see how it looks like . now i got inspiration to actually get down to make one finally.

but one question . i had normal dc motors in mind which i was going to use . i notice u used servo motors . but why is that ? what was the necessity to use servo motors
? can't accomplish the same objective by normal dc motors?
oRelyTo2 years ago
Amazing! :D
great....
SPGWhistler2 years ago
This looks amazing. Got any video?
marc.cryan (author)  SPGWhistler2 years ago
crane game video is up
marc.cryan (author)  SPGWhistler2 years ago
Thanks! -- video should be up tonight.
Nolroz2 years ago
I've been thinking that a ceiling mounted track like this could make a great foundation for a robot meant to clean a room or fold clothes.
CarlS2 years ago
Very cool!
fixitmankeith

I don't see the code or the wiring
tinker2342 years ago
very nice i saw the teddy bear pacl thing on amzon 20 dollars for5o of them
marc.cryan (author) 2 years ago
ToDo: add something so this qualifies for miss pacman contenst....
awesome build I always wanted to build one of these but I have no kids....
marc.cryan (author)  Notquitepinoy2 years ago
Maybe the next version will be able to grab beer bottles....
GRobots2 years ago
Will build this for my younger brother and marc thank you for a great pdf.
marc.cryan (author)  GRobots2 years ago
Great! Check back for updates. I'm trying to make the electronics easeir to build.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!