P ROJECT #6: E LECTROMAGNETIC C RANE Teacher’s Notes The Project Time Frame: 2-3 weeks Materials: • • • • • • Bolt (1”-2” Long) 22-24 Gauge Magnet wire (regular solid core copper wire will work) Available at Electrosonic, see suppliers $10 for approx. 200’ 20+ paperclips 2 bowls 4.5V – 6V battery Construction materials for the physical crane set-up Description: This is a difficult project. This project would be appropriate at the grade 11 or 12 level. The students are required to interface a stepping motor, a DC motor (using an H-Bridge), an LED and an electromagnet. www.claasictechnology.ca has an excellent picture on how to set-up the H-bridge motor. The goal is to move paperclips from one bowl to another bowl through a 90° rotation. The crane starts with the magnet up& above the first bowl. When the program starts: • LED at the top of the crane starts to flash (crane is moving, Watch out!) • The crane drops the magnet into the bowl. • The magnet turns on & collects the paperclips. • The crane lifts the magnet and paperclips. • The crane moves through the 90° rotation. • The crane lowers the magnet and clips into the second bowl • The magnet shuts off, releasing the paperclips • The crane lifts the magnet back up • The crane rotates back to the first bowl • The LED turns off when the crane stops moving. Warning!!! This should not be the first interfacing activity. This project is too difficult to try without attempting some of the previous activities. Suggested Usage of Pins The following is a suggesting representation of which pins to use for each control. Lights Electromagnet Flashing Light DC – Motor Control 1 DC – Motor Control 2 Stepper Motor Control 1 Stepper Motor Control 2 Stepper Motor Control 3 Stepper Motor Control 4 Output / Pin # D0 / Pin 2 D1 / Pin 3 D2 / Pin 4 D3 / Pin 5 D4 / Pin 6 D5 / Pin 7 D6 / Pin 8 D7 / Pin 9 Decimal Value 1 2 4 8 16 32 64 128 H-Bridge (Bi-directional DC motor control) • • • • To turn the DC motor in one direction, set D2 high & D3 low. To turn the DC motor in the opposite direction, set D2 low & D3 high. To stop the motor, set both D2 & D3 low. DO NOT set both D2 & D3 high! Stepper control • • Stepper motors work by sending a repeating pattern of bits to the different coils. Taping a popsicle stick to the end of the stepper motor and using a protractor is a good way to measure the angle per step. For our example, the stepper motor is controlled by D4-D7. The following block of code will make the stepper motor turn. for steps : 1..100 for i : 0..3 parallelput(16*(2**i)) delay(100) end for end for % send the pattern 100 times % set the correct pin high % delay 1 tenth of a second Creating an Electromagnet South North Wrap magnet wire around the soft iron core (bolt) Attach wire ends to your interface -‘ve Things to remember about electromagnets: • The more coils you make, the stronger the magnet. • Magnet wire works better, because it is thinner and more coils you can get. • A soft iron core will make the magnet work better (a bolt). +‘ve Electromagnetic Crane – Wiring Diagram PN2222A H-Bridge Bi-Directional DC motor control PN2222A 2N2907 2N2907 1k Ω Flashing LED 220Ω See next page for stepper motor control. Electromagnet 1k Ω 7424 PN2222A Parallel Port Ground (18-25) +5V To Parallel Port Output D7-D0 Use an external battery (4.5V – 6V) GND Electromagnetic Crane – Stepper Motor Wiring Diagram ground +5 V 1k Ω Coil 3 Blue Coil 4 White M 1k Ω 74LS245 TIP31 Coil 1 Orange TIP31 TIP31 TIP31 Coil 2 Red ground +5 V D3 D2 D1 D0 Ground (18-25) +5V For Motor Electromagnetic Crane – Exemplars Electromagnetic Crane - Checklist Have I … CRANE used / made a eye-pleasing model; verified the flashing LED works; verified the magnet turns on an off; verified that my final program correctly controls the crane; FINAL PROGRAM commented all blocks of code; used clear variable & constant names; designed a graphical interface representing the game board; covered the required functions of the game board; DOCUMENTATION created a title page; printed out the code for my final program; written a report, including: o the process, o clear explanation; drawn a diagram of the crane (and any initial sketches); drawn a schematic of the crane; checked all papers for spelling & grammar mistakes; had at least two person proof-read my report; compiled all the paper submissions in a duo-tang? Electromagnetic Crane – Marking Scheme Name: Category Component Mark Knowledge (30%) Program Functionality Wiring & Interface Functionality /15 /15 Application (30%) Wiring Neatness Program Appearance /15 /15 Problem S. (15%) Crane – Materials & Construction Creativity & Innovation /5 /10 Communication (25%) Crane Diagram Project Write-up Internal Documentation Wiring Diagram /5 /10 /5 /5 Total %