Introduction: Sliding Crane Arm
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).
The Sliding Crane Arm is designed to hold small metal objects and move them back and forth. The crane is controlled using an old TV remote, and uses a modular design which allows the 3D printed parts to be easily replaced and allows additional features to be added without completely redesigning the Sliding Crane Arm.
For a full video description, please watch this video.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
For this project, you will need:
- An Arduino Uno
- 2 28BYJ - 48 Stepper Motors with ULN2003 Driver
- 2 different colored pairs of LEDs (I used green and red)
- A breadboard
- 4 1 1/4 inch #6 Machine Bolts and Nuts
- 2 1 3/4 inch #6 Machine Bolts and Nuts
- 4 1/4 inch #4 Machine Bolts and Nuts
- 1 1 inch #4 Machine Bolt
- A 9 volt DC power supply
- An IR Receiver and TV remote
- A 10K Ohm Resistor
- An electronics project box
- A 0.7" Thick x 2.95" Diameter Magnet
- Soldering Iron and solder
- Screw Driver
- Hot Glue/Gorilla Glue
- Electrical Tape (To keep the wires organized)
Step 2: 3D Printed Parts
The Sliding Crane Arm, at its core, consists of only 3 printed parts: the crane arm, the motor base, and the gear heads for the stepper motors. While they are included in the main project, the other 3 parts are simply additions that play off the modular design of the core 3 parts.
The crane arm is the piece that will end up moving once everything is put together. It has a "crane-like" pattern on the side, a rack for the gears on the bottom, and a large flat end with two holes. This large flat end allows different pieces to be joined to the crane, such as the magnet holder. The magnet holder modification attaches to this end with bolts, and has a spot for a magnet, allowing small metal objects to be held by the crane.
The motor base is where the motors are held. This is the solid foundation which the crane arm is connected to. The motors inside are bolted to the frame. Each of the stepper motors has a gear attached to its head, which allows it to push the track on the crane arm. The gears are designed to perfectly fit the motor heads. When they print, they come out a little smaller, and thus fit very tightly on the motor.
The last two modifications included are the arm extension and the end cap. The arm extension is designed to fit into the end of the crane arm, giving it extra length. It is in all ways similar to the original crane arm, except the long flat area is replaced by a piece that fits into the extra holes on the back of the crane arm. The end cap is also used in this location, and it keeps the crane sturdy. The end cap can be modified to be larger and reprinted, if needed, to help balance the crane.
STL files for these parts are included below.
Step 3: The Control System
The control system for the Sliding Crane Arm can be split up into 4 sub-systems. There is the Arduino itself, the stepper motors, the IR Receiver, and the LEDs. To help understand how these different components work together, there is a system diagram, and a Fritzing diagram included.
The IR sensor allows the Arduino to receive IR input from a remote, allowing us to control the crane. The wiring for the IR sensor is fairly straightforward. Notice, though, the 10k ohm resistor.
The LEDs are also fairly simple. I used 5mm LEDs, which allowed me to use the two in series without a resistor. When making the crane, I soldered the LEDs together in pairs. The LEDs connected to pin 9 serve as a warning light, while the ones connected to 8 are an idle/ready light. I used red and green, respectively.
The stepper motors are a little more involved. Notice that the motors are wired in reverse. For example, the breadboard row connecting to the 1 IN pin on the motor driver is connected to the 4 IN pin on the other. Stepper motors, in simple terms, work by turning on electromagnets in a particular order; by wiring in reverse, the steps are run in reverse, which means the stepper runs in the opposite directions. If the motors turned the same direction, they would push in opposite directions when facing each other. By wiring them together this way, we can reliably turn on each motor at the same time and cause them to rotate in a way that pushes the crane in the same direction.
Step 4: The Code
Now lets take a look at the code for the Sliding Crane Arm, which you can find below. The code uses 2 libraries: the StepperAK library and the IRremote library. I have included both of these in the .zip file.
To help organize the code, the project has been split up into 4 tabs based on what part of the control system they interact with. Lets start by going through sliderControl.ino . This file contains the code to import and setup the necessary libraries, declares the variables that will be used throughout the program, and includes the setup and main loop. Two important things to note here are the IR codes and the main loop. The IR codes will be dependent on the remote you use; to figure out the codes for the buttons on your remote, you can use the Serial Monitor to view them. Simply uncomment two lines that mention Serial. Moving onto the main loop, the Arduino checks if it has received input from a remote. If so, it calls the decideAction() function. Otherwise, it checks whether the idle light should be turned or if the crane is loading/unloading.
Next, let's look at the IR_Codes.ino. This contains the functions related to the IR sensor. The only function inside is the rather long decideAction() function. This function performs all the logic necessary to figure out which button has been pressed and what to do. Notice the structure of this function. First, it checks if the loading/unloading buttons have been pressed. This allows the crane arm to be easily put onto or taken off the base by continuously running the motors. Next, it checks if the loading/unloading are on. If either are, no other action can be taken. This prevents the crane from possibly damaging itself by pressing a remote button while loading/unloading.
Lastly, we have the Stepper_Control.ino. This includes all the functions related to the stepper motors. These are rather simple functions, but notice each function sets stepsTaken to the new amount, which prevents the motor from overextending itself. One function that stands out in this group is the setBase() function. This resets stepsTaken to 0. This allows the crane to be "re-calibrated" after loading or unloading.
Step 5: Piecing Together the Parts
Now that you have all the parts, the control system, and the code, it's time to piece it all together. Start by assembling the crane arm. First, bolt the magnet holder to the end of the crane arm, using the #6 bolts and nuts. Place the magnet inside the circular area on the magnet holder. It will be very tight, and some force may be necessary. You may use the long #4 bolt to screw it in as well. Next, if you want to extend the length of the crane, attach the crane extender to the other end of the crane arm.
Now slide the gear attachment onto the head of the stepper motor. This will be another tight fit and the part should pop into place. To prepare the stepper motor base for use with the project box, you will want to drill 6 holes into the bottom. (The picture shown was an earlier prototype. The 7th center hole is no longer necessary). Use a 3mm drill bit. The square on the inside of the base is for the 4 LEDs. The other 2 are for the stepper motors.
Attaching the motors to the base is a bit involved. The connector on the end of the stepper motor that plugs into the driver is too large for the drilled hole. You will need to cut the wire in the middle, run it through the hole, and solder the wires back together. The motor can then be bolted to the small holders on the base and their backs gorilla glued to the base for good measure.
The LEDs are much simpler; they can simply be soldered to some wire, which can be run through the holes. Place the warning lights in opposite corners from each other, and again for the idle lights. Once the wires have been run through, fill the hole with some hot glue to hold the LED down.
Step 6: The Box
Now that all the parts are assembled, the project box can be prepared. Start by drilling matching holes from the base into the lid. Then, you will want to drill 2 more holes. One should go into the shorter side. This hole is for the IR Sensor. The other hole, on one of the longer sides, will be for the wires from the power supply.
Place the control system into the project box. The breadboard can be glued down or taped. Next, run the sensor to its hole using jumper wires and tape it into place. Make sure the sensor fits into the hole well or it may not read well. Run the power lines in and tape these down as well.
After the wires have been organized (or not), you can run the wires from the base through the lid and plug them back in to the breadboard. To neaten things, I soldered the LEDs directly to it's counterpart, connecting the positive to the negative in series. This can then be taped to the lid to keep them out of the way.
With the box complete, your Sliding Crane Arm is almost fully assemble! To get the sliding crane arm loaded onto the base, simply hit the load button you set in the code and gently guide the rack onto the motors. Once the crane has been loaded, congratulations! You have completed this Instructable. I hope you enjoy this project!