A magnetic field is produced by the direction and flow of electrons in an electrical current. Although single-wire currents produce a magnetic field, it is often very small and insignificant. By coiling a wire, however, around a solid metallic conductor, the conductor increases the device's magnetism and creates a electromagnet. Using these ideas and some simple household items, you can create a direct current (DC) electromagnet of your own.
Use your utility knife to cut the plug off of your lamp cord, and cut the cord out of the lamp base. Make sure it is unplugged from the lamp at this time to avoid injury. If you are using magnetic wire as opposed to lamp cord, then skip to step 3.
Cut the double-wired lamp cord down the middle of the cord, splitting the insulation into two individually insulated wires.
Wrap your wire around your metallic rod. To start, leave 15 cm (6 inches) of wire hanging off of the end, and then wrap the wire tightly around the nail or screwdriver. For a stronger electromagnet, use a large iron bar as your base. Wrap the wire tightly so that you can't see any of the bar beneath it. If you overlap it, it is fine--in fact, the more wire you add and wrap, the stronger the magnetic field will be. So, if you desire to have a strong magnet, wrap the wire around the bar twice or even three times. Be careful, though, as the more you wrap it, the hotter it will get, and the faster the battery you are using will drain.
Leave a 15-cm (6-inch) length of wire off of the end of your device once you've finished wrapping it. You should be left with a 15-cm (6-inch) piece of wire at the start and a 6-inch piece of wire at the end of your rod.
Strip the insulation off of the end of your wires if you are using a lamp cord. Use your utility knife to gently strip them, without cutting or damaging the wires inside. If you are simply using magnetic wire, make sure the ends are free of debris or hindrances.
Attach the two ends of your wire to the two opposite terminals of your 9-volt battery. Use electrical tape to make sure the ends stick in place. If you would like a larger magnetic field--i.e., a stronger magnet--you can use a larger battery to create a stronger current. Bear in mind, however, that the stronger the current, the hotter the magnet and the quicker the battery will drain. Once the battery terminals are connected to the wires, your electromagnet will be operational. Pass it over metallic objects to see whether they are attracted to it. Remove the wires from the battery terminals once you have finished with your electromagnet.
Since electromagnets and their polarities depend on the direction that the current flows, you can easily switch the current of your magnet--thus, the polarity--by putting the wires onto different terminals. That is, if you had one wire on the positive terminal, move it to the negative terminal, and vice versa.
Since this device is essentially considered a "dead short," it will heat up very quickly and drain the battery as well. If the device isn't in use, remove the wires from the battery and cut the current. Only turn it on when you're ready to test or use it. In the same vein, since this magnet is dealing with live wires that can shock or burn you, use the utmost caution when touching and handling it. Use gloves and be wary of your surroundings.