Electromagnets take advantage of the circular magnetic field that electrons generate when moving through wire. Coiling the wire doubles up the field and orients it in a single direction. Magnetizable metal placed inside the coil strengthens the field further still. Direct current (DC) through the wire provides a constant magnetic pull. But in a loudspeaker, for example, the electric current through the attached electromagnet varies with the audio playback. To make a variable electromagnet yourself, you could vary the current with a simple light dimmer. You would want an old one though, since variable-resistor dimmers have been replaced by more efficient, diode-based dimmers that run only on AC.
Salvage an old, dial-type dimmer or purchase a variable resistor, also known as a rheostat. Make sure you see only two terminals on the variable resistor. If there are three, you’ve bought a potentiometer, which is more than you need. You may find determining which two of the three terminals to connect difficult, so get a two-terminal resistor instead.
Test a screwdriver or large metal bolt for magnetizability. Hold a kitchen magnet near it to see if they attract. If the metal object doesn’t attract, find one that will.
Wrap the insulated copper wire around the metal object—do this for hundreds of turns, if possible. Overlapping is okay. Leave half a foot of wire free at each end of the wire.
Scrape the insulation off the two ends of the wire. Tape one bare end to a terminal of a 9-volt battery. Screw the other bare end in place to one of the dimmer terminals.
Scrape the ends of the other wire and attach it to the other dimmer terminal and other 9-volt battery terminal. Test the electromagnet by picking up paper clips with the end of the metal object. Vary the dimmer to see when the magnetic field is too faint to lift the paper clips.
Using an AC electromagnet is possible, but it is less powerful than a DC electromagnet using the same voltage.