Introduction: The Magneto Crane
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).
Ever since I was young my favorite part about going to any game arcade was the "Claw Crane Machine." I was brainstorming project ideas for about a week for my Makecourse project and couldn't come up with anything. I was at an arcade one day with my younger cousins and was teaching them how to play with the claw crane machine. Then it hit me. I decided to take a spin off of my beloved game for my project. As this was my first time dealing with 3-D modeling and 3-D printing I decided to take a more simplistic approach and make my project 2-Dimentional and with a magnet instead of a claw. However, I used the same fundamental principles for my project.
To bring my project to life, I first used Autodesk inventor to 3-D model the design. Then I 3-D printed the parts using the makerbot software. I also used an Arduino micro controller to control the motors, joystick, LCD screen and proximity sensor for my project. After a couple of months of planning, designing and implementing, "The Magneto Crane" was brought to life!
Here is a clip of my project in action. Enjoy :)
Step 1: Gathering Parts
The Parts that will be needed to complete this project are as follows:
- 1x Arduino Uno R3 Microcontroller
- 1x 2-Axis Thumb Joystick controller
- 1x HC-SR04 Ultrasonic Range Sensor
- 1x 16x2 LCD Character Display w/ I2C backpack
- 2x 28BYJ-48 Stepper motor with x113647 motor drivers
- 1 magnet with hook
- Super glue
- 1 Mini Breadboard with 2 sets of power rails
- 1 9 volt battery
- 1 9 volt battery ground and voltage connector
- Male to male jumper cables
- Female to Male jumper cables
- Rubber tube
- 3x clamps
- 1x 5 volt USB cord and wall adapter
- Wire Covers
- Fishing wire
Step 2: 3-D Parts
I designed all of my Magneto Crane parts using Autodesk Inventor Professional 2016. After I designed all of my parts, I used the 3-D printer at the AVC printing center at the University of South Florida. I have attached photos of the designed parts as well as the .stl files so you can have easy access to these parts.
The parts included and amount you will need are as follows (in order of attached photos):
- 1x pulley with hole for motor
- 1x wheel with hole for motor
- 2x support beams
- 1x control system enclosure box with holes for components
- 1x box lid with holes for beams and wiring
- 1x Y connected piece for pulley and wheel
- 1x joystick enclosure box
- 1x rectangular shaft
Step 3: Control System
In the first photo you can see that the control system becomes a bit of a jumbled mess, so I have made a Fritzing diagram to help with wiring your system. Also I have made a control system block diagram to help better visualize what each component will be doing in the system.
Now for wiring the hardware to the Arduino:
Pin 1 on driver goes to digital pin 8 on Arduino board
Pin 2 on driver goes to digital pin 10 on Arduino
Pin 3 on driver to digital pin 9 on Arduino
Pin 4 on driver to digital pin 11 on Arduino
Negative pin on driver to blue power rail on breadboard
Positive pin on driver to red power rail on breadboard
Pin 1 on driver goes to the digital pin 3 on Arduino board
Pin 2 on driver goes to digital pin 5 on Arduino
Pin 3 on driver to digital pin 4 on Arduino
Pin 4 on driver to digital pin 6 on Arduino
Negative pin on driver to blue power rail on breadboard (Same rails as other motor)
Positive pin on driver to red power rail on breadboard
Use a battery connector to plug the battery into the ground and positive power in the same power rails as the motors
Also use a jumper wire to connect a ground from the Arduino to the blue (ground) rail that the motors and battery are using.
Now it is time to switch to the other power rails. Connect ground to the blue rail and voltage to the red power rail. Connect the Echo pin to pin 12 on the Arduino and the Trigger pin to pin 13 on the Arduino. Also use a jumper wire to connect 5 volts on the Arduino to the red power rail on the breadboard and ground from the Arduino to the ground (blue) on the breadboard.
LCD with I2C bus:
Connect ground and voltage to the blue and red rails that the proximity sensor is also being powered through. Connect the SDA and SCL to the pins that are labeled SDA and SCL on the back of the Arduino board.
Connect the ground and voltage to the blue and red rails that the proximity sensor and LCD are also being powered through. Connect the x-axis pin on the joystick to the Analog 0 (A0) pin on the Arduino and the y-axis pin to the Analog 1 (A1) pin on the Arduino.
And now you have your control circuit!
Step 4: Code
I used Arduino version 1.0.6 to code this project. The first thing you are going to want to do is upload the stepper and LiquidCrystal libraries to your libraries in your Arduino sketch folder. These are needed for the code to run. Next it is as simple as uploading the sketch to your Arduino board and testing it with the hardware. The LCD screen should light up when an object is placed approximately 50 cm from the proximity sensor and should display the text "Welcome to... Magento Crane!" When an object is greater than 50 cm away from the sensor, the light on the screen will turn off. Remember in order for the motors to operate an object must remain placed in front of the proximity sensor. The x-axis stepper should only operate when you move the joystick left and right and the y-axis stepper should only operate when you move the joystick up and down.
Step 5: Assembly!
Okay now it is time to bring everything together. I am going to break down in steps what I found was the best way to assemble the Magneto Crane. Here we go!
1) Use the super glue to glue down the beams. What I did was place the lid on the beams so they would be in the correct position. Then I put some of the glue at the bottom of the beams and stuck them down at the bottom of the box. Give them time to dry so that they will be sturdy.
2) The next step of action is to insert the control system that you have assembled by this point. Stick the LCD screen into the rectangular hole at the front of the box, it will fit perfectly without any screws. Also put the proximity sensor into the two square holes in the front of the box, that will also snap fit without any extra screws. At the side of the box there will be a hole for the wires of the joystick. Fit the joystick into the small joystick enclosure that you 3-D printed. Also feed the USB cord through the hole in the back to easily plug into your laptop or wall adapter.
3) Next take some rubber tubing and fit it into the hole in the back of the wheel and pulley so that the shaft of the motor will fit snug. I have inserted a picture of my pulley with the rubber tube inserted.
4) Make sure to sand down the wheel that will rotate on the rectangular shaft. You are going to want to sand the inner parts that will have contact with the shaft so it will rotate smoothly.
5) Now first insert the shaft into the Y shaped part of the pulley and wheel connector. Then insert the wheel. This will be a tight squeeze so you may need another pair of hands to help with this step. Now place the clamps on both ends of the wheel to prevent it from sliding and then place the motor in the hole. As far as the pulley goes, insert it into it's slot on the connector. Insert the motor into the hole in the back and insert a clamp on the cylindrical part in the front to prevent sliding. The picture I have attached gives a good demonstration of how it will all look when put together.
6) This part is extremely vital to get the motors to run smoothly. Take some fishing line and wrap it a couple of times around the motor that is attached to the wheel. The point is to connect it to the post of the connector to keep the motor in place. Do the same thing with the motor attached to the pulley. Wrap it from the bottom of the motor to the Y connected piece of the post as shown in the picture.
7) Next cover the motor wires with some wire covering like I have in my photos. Then insert the motor wiring through the hole in the lid and place the shaft onto the beams.
8) The last step is to tie some fishing line to the hook on the magnet. Make the line long enough so that the magnet will have enough of a degree of freedom to release and retract. Then superglue the top end of the fishing line to the pulley. Also, screw the lid to the box to add the finishing touches to the project.
At this point the project is complete! Enjoy :)