You've heard of cranes!
You've heard of electromagnets!
You've heard of sensors!
Now we'll introduce to you, for the first time ever (possibly not the first time ever), an electromagnetic crane that senses things, the Electromagnetic Crane 2000!
Essentially, we will need a sensor to detect the object and its color, an electromagnet to pick up the metal objects, a motor to move the electromagnet up and down, a servo to sweep the electromagnet, and a platform to hold it all together.
Specifically, we'll need:
Many jumper wires
Hot glue gun (optional)
1 Foam board
2 small breadboards
1 Arduino Uno microcontroller
2 PNP BJT transistor TIP 125
2 NPN BJT transistor TIP 120
1 100 Ohm Resistor
1 300 Ohm Resistor
1 330 Ohm resistor
1 10k Ohm resistor
1 10 microfarad capacitor
1 IR emitter
1 IR receiver
1 Standard Servo
1 Standard Motor
1 Magnetic Nail
1 9 Volt battery
99-feet of galvanized copper wire (or similar)
Step 1: Building the Platform
The platform will consist of one circular rotating upper piece, a circular stationary lower piece, an "arm," and braces. All the pieces are made from foam board.
The circular pieces have a 20cm diameter. Be sure to mark the center of the circular pieces.
The crane's "arm"can be created by first cutting a (1.4 x 21.4)cm rectangle out. Then, cut two angled pieces that makes a 135 degree angle with respect to the foam board piece (or a 45 degree angle with respect to the piece being cut off). Alternatively measure and mark 1.4cm from the edge on one corner. Cut from the 1.4cm mark on the corner to the adjacent other corner to make the angle described perviously. Two of these pieces will be needed for the arm
The braces are not a specific size and are just two rectangles that hold the "arm" pieces.
Step 2: Making the Electromagnet
The electromagnet was made by using a magnetic screw and 99-feet of galvanized copper wire. Simply wrap the wire, carefully, with the 99-feet of copper wire, making tight loops. Be sure to leave some slack on the wire at the ends, to solder regular wire to and connect to a breadboard. Once the nail is looped with the copper wire, use electrical tape to secure the copper wire on the nail. Solder on wires to the ends of the electromagnet. We needed a minimum of 6 volts to be able to pick up what we wanted, so we used a 9 volt battery. A switch was added to the circuit, so that we could control the electromagnet and so the battery wouldn't run out as fast.
Step 3: Building the Bi-directional Motor
In order to move the electromagnet up and down, we used an H-bridge to move a motor in two directions. The H-Bridge schematic is shown in the Figure above. It consists of two PNP BJT transistors, specifically TIP 125, two NPN BJT transistor, specifically TIP 120, and a standard motor. Q1-Q4 are signal inputs connected to the Arduino Uno. The 5 volts will come from the Arduino Uno. The Arduino Uno will be responsible for controlling the motor. Alternatively, add gears to slow down how fast the electromagnet is raised and lowered. Another option is using a level shifter to control the speed of the motor, which will not be discussed because we decided on gears to slow down the motor.
Step 4: Building the IR Sensor
The IR sensor will be used to sense if something is placed in front of the crane. It will consist of an IR emitter (Black looking LED), IR receiver (Clear looking LED), 1 100 Ohm resistor, 1 10k Ohm resistor, and a 10 microfarad capacitor. The schematic above shows how to connect everything. Note that the cathodes for these are the longer leads.
To make the breadboarding easier and cleaner PCB's can be made of specific parts of the electromagnetic crane, for our convenience we made a PCB of the IR Sensor.
Step 5: Color Sensor
The color sensor will detect the color of the object and determine where to drop said object based on the color. It will consist of a phototransistor, 1 330 Ohm resistor, 1 300 Ohm resistor, and a tri-color LED. We will only use two of the colors on the tri-color LED, thus only using 3 of the 4 leads on the LED.
As shown in the schematic, the phototransistor will be connects to a 3.3V power source (coming from the Arduino) on one end, and both the analog pin on the Arduino Uno and a resistor of 300 Ohms. The cathode of the tri-color LED will be connected to the 330 Ohm resistor and then to ground. The other leads will be connected to digital pins on the Arduino Uno.
Step 6: Step 6: Building the Servo
The servo motor will control the platforms movement. It is simply connected to the 5 volts pin from the Arduino Uno, ground, and a signal pin on the Arduino Uno.
Step 7: Assembling the Electromagnetic Crane 2000
Assemble the crane's "arm" as shown in the picture, with hot glue and/or masking tape. To add extra security add legs made from foam board to the bottom of the rotating platform after the servo is attached.
The main breadboard will be placed on the topside of the rotating platform along with the Arduino. Tape these securely on to the top of the rotating platform so they don't slide around.
The servo will be secured on the stationary platform on the flat end, while the rotating end of the servo will be attached to the rotating platform by either hot glue, and/or masking tape.
The motor will be secured with masking tape on the top of the rotating platform right behind the crane's "arm." Fishing line will be attached to the motor, will go through an axle placed at the top of the "arm", and will hold the electromagnet securely.
The IR and color Sensors will be placed directly underneath the electromagnet on the rotating platform. A breadboard was taped upside down on the rotating platform that connected all the sensor circuitry, and had jumper cables connecting it to the main breadboard and Arduino Uno on the top side of the rotating breadboard. Be sure to face the sensors out as shown in the picture above. Add (if needed) foam board walls to the sides of the IR sensor to avoid interference by the color sensor, and also to avoid early detection of objects.
Step 8: Coding
Attached is the code that makes the electromagnetic crane work. It consists of various functions that control different parts of the electromagnet. The only part that is manually controlled through a switch is the electromagnet.
For a live demo of how and why the Electromagnetic Crane 2000 works see: https://www.youtube.com/watch?v=PeNeHbHoRuI