Introduction: Model Tower Crane Project

The purpose of this project is to create a design to explore an electromechanical design based on a computer generated image. The image we generated was of a junkyard with a large tower crane in the background. 

For this project our group has decided to build a 1:64 scale version of a junkyard car tower crane. We will utilize match box cars to simulate real world cars. We will also be using a storage box to demonstrate an end destination of the match box cars. 

The junkyard tower crane will utilize both mechanical and electrical elements. Pulleys will be utilized to ascend and descend cars from the crane. This is vital to the project as it will serve as the main pulley to “grab” the cars. An electromagnet will work alongside the pulley to grab and release cars. This is also essential to the project as this acts as our “grabber.”

The project will also use elements from software. This will include programming a microcontroller to control a motor in the crane. The microcontroller will also be used to program LEDs to distinguish operations within the project.

Supplies

  • Frame Construction
  • 1/4" x 1/4" wood
  • Hot glue
  • Electronics
  • Arduino Mega
  • Continuous Servo x 2
  • LEDs x 3
  • Jumper Wires
  • Miscellaneous
  • Lifting wire
  • Spool / Gears

Step 1: Cutting Wood Into Segments

The first step for this project is to cut the wood into the lengths that are required for the project.

  • Base Truss Construction
  • 4 pieces at 12"
  • 8 pieces at 2"
  • 4 pieces at 12.125"
  • Mast Construction
  • 2 pieces at 10"
  • 8 pieces at 1"
  • 2 pieces at 5.25"
  • 6 pieces at 0.75"
  • 4 pieces at 4.5"

Step 2: Constructing the Base

First hot glue one of the 2" pieces to the bottom of one of the 12" pieces. Then add another 12" piece to the other side of the 2" piece. Finally complete the box by adding the final 2" segment on the opposite end of the 12" pieces. Complete this step one more time in order to have both sides of the truss. Next, add two of the 12.125" pieces diagonally into the boxes to create the truss elements. The next step is to glue the remaining 4 pieces that were cut at 2" vertically onto the corners of one of the truss elements. Once the hot glue has dried the final step in constructing the base is to add the other truss element on top of the 2" pieces. After the glue has hardened the final base truss can be stood up and is completed.

Step 3: Constructing the Mast

The first step in assembling the mast is to lay out the bottom layer. The two 10" pieces are layed parallel with 5 of the 1" pieces as cross bars spaced evenly throughout. Then add the 1" pieces as supporting uprights for the spool and servo.

Step 4: Adding Triangular Support Trusses

Once the mast has been hot glued together and dried the next step is to add the triangles that create the upper frame. These are created using the 0.75" pieces at an angle and topped with the 5.25" pieces. After these have been secured down to the frame then the large upper support triangles can be added. These are created by similarly gluing them together at an angle and gluing them down to the base.

Step 5: Adding the Spool, Cabling, and Electromagnet

Now that both of the assemblies have been created next step is to add the spooling axle and whatever gear train is necessary for connecting the axle to the servo. Once this piece has been added then the cable can be threaded through the crane and spooled back onto the spindle. At the end of the cabling the electromagnet can be secured.

Step 6: Adding the Servos

Each servo is supported by at least one 1" piece which can be fixed to the servo and then glued down once the servo is in position. The first servo is placed inside the top square of the base truss. This servo will be used in order to rotate the mast left and right. The second servo is the Mast servo. Once the servo has been secured to the support post it can be glued into position to properly mesh with the spool.

Step 7: Designing the Wiring

The wiring diagram consists of the Arduino Atmega2560 as the micro-controller. Inputs are to the left that sends the commands to the controller. The outputs are to the right. These are the tangible visual displays of the signals being sent out of the micro-controller.

Step 8: Implementing the Wiring

Now it's time to implement our wiring onto a breadboard. Bus the 5V and Ground connections to the breadboard. Now connect the LED signals to the 330 ohm resistor that is in series with the cathode of its respective LED. Now connect the anodes of all the LEDs to ground. This completes the LED circuit. Now connect the servo motor signal to the signal input of the servo. Connect the servo to 5V and Ground from the Arduino. Now to wire our inputs. Connect the joystick to the 5V and Ground bus. Next make a connection from x,y, and button inputs into its respective input on the arduino.The wiring is now complete.

Step 9: Implementing the Code

First download the Arduino suite from https://www.arduino.cc/en/software and complete the installation procedures. Then connect the board to a computer with a USB-A cord and select the correct COM port and board. The COM port and board used in this example is an Arduino Uno connected with COM3.

Step 10: The Final Code

#include <Servo.h>
// Assign a pin number to each LED
int redLed = 52;   // Signifies the base is rotating
int grnLed = 51;   // Signifies crane is stationary
int ylwLed = 53;   // Signifies the crane is reeling
// Assign a pin number to each server
Servo baseServo;
int basePin = 9;
Servo craneServo;
int cranePin = 10;
// Initializing Joystick variables and set the value to middle position (512)
int joyX = 512;
int joyY = 512;
int butPin = 4;
int magPin = 31;
// Vars to store the adjusted joystick values
int xVal;
int yVal;
char label;
// Vars to store the motor's current speed
int reelVal;
int baseVal;

void setup() {
  // Set the LED and Servo pins as OUTPUTS
  pinMode(redLed, OUTPUT);
  pinMode(grnLed, OUTPUT);
  pinMode(ylwLed, OUTPUT);
  pinMode(butPin, INPUT);
  pinMode(magPin, OUTPUT);
  baseServo.attach(basePin);
  craneServo.attach(cranePin);
  // Begin Serial Communication
  Serial.begin(9600);
}


void loop() {
  // Joysitck Y direction controls reeling
  // 512 is middle postion
  joyY = analogRead(A1);
  yVal = map(joyY, 0, 1023, 0, 180);
  //print_val("Y VAL: ", yVal);
   
  // Joystick X direction controls rotation
  // 512 is middle postion
  joyX = analogRead(A0);
  xVal = map(joyX, 0, 1023, 0, 180);
  //print_val("X VAL: ", xVal);
  digitalWrite(grnLed, HIGH);


  // Send the joystick values to the motors
  reelVal = reel_crane(yVal);
  baseVal = rotate_base(xVal);
  int butState = digitalRead(butPin);
  Serial.println(butState);
  if(butState == HIGH){
    digitalWrite(magPin, HIGH);
  }else{
    digitalWrite(magPin, LOW);
  }
  delay(10);
}

int rotate_base(int pos){
  int currentPosition;
  int finalPos;
  //Continous rotation servos
    // 90 deg keeps the motor still
    // pos<90 moves the servo CCW
    // pos>90 moves the servo CW
    // |pos-90| sets the speed


  // If the base is rotating turn the redLED on
 
  if(pos > 87 && pos < 93){
    digitalWrite(redLed, LOW);
    digitalWrite(grnLed, HIGH);
  }else{
    digitalWrite(redLed, HIGH);
    digitalWrite(grnLed, LOW);
  }
  finalPos = 90 + ((90-pos)/2);
  baseServo.write(finalPos);
  currentPosition = baseServo.read();
  return currentPosition;
}


int reel_crane(int pos){
  int currentPosition;
  int finalPos;
  //Continous rotation servos
    // 90 deg keeps the motor still
    // pos<90 moves the servo CCW
    // pos>90 moves the servo CW
    // |pos-90| sets the speed
   
  // If the base is rotating turn the redLED on
  if(pos > 87 && pos < 93){
    digitalWrite(ylwLed, LOW);
    digitalWrite(grnLed, HIGH);
  }else{
    digitalWrite(ylwLed, HIGH);
    digitalWrite(grnLed, LOW);
  }


  finalPos = 90 + ((90-pos)/2);
  craneServo.write(finalPos);
  currentPosition = craneServo.read();
  return currentPosition;
}

// Function to print "Label: VAL" pair
int print_val(char label, int val){
  Serial.print(label);
  Serial.println(val);
}