The basic idea behind an electromagnet is extremely simple: By running electric current through a wire, you can create a magnetic field.
By using this simple principle, you can create all sorts of things, including motors, solenoids, read/write heads for hard disks and tape drives, speakers, and so on.Now, you will learn exactly how electromagnets work. You will also have the chance to try several experiments with an electromagnet that you create yourself!
You likely know that all magnets have two ends, usually marked "north" and "south," and that magnets attract things made of steel or iron. And you probably know the fundamental law of all magnets: Opposites attract and likes repel. So, if you have two bar magnets with their ends marked "north" and "south," the north end of one magnet will attract the south end of the other. On the other hand, the north end of one magnet will repel the north end of the other (and similarly, south will repel south).
An electromagnet is the same way, except it is "temporary" -- the magnetic field only exists when electric current is flowing.
If you look at a battery, say at a normal D cell from a flashlight, you can see that there are two ends, one marked plus (+) and the other marked minus (-). Electrons collect at the negative end of the battery, and, if you let them, they will gladly flow to the positive end. The way you "let them" flow is with a wire. If you attach a wire directly between the positive and negative terminals of a D cell, three things will happen:
Electrons will flow from the negative side of the battery to the positive side as fast as they can.
The battery will drain fairly quickly (in a matter of several minutes). For that reason, it is generally not a good idea to connect the two terminals of a battery to one another directly. Normally, you connect some kind of load in the middle of the wire so the electrons can do useful work. The load might be a motor, a light bulb, a radio or whatever.
A small magnetic field is generated in the wire. It is this small magnetic field that is the basis of an electromagnet.
The part about the magnetic field might be a surprise to you, yet this definitely happens in all wires carrying electricity. You can prove it to yourself with the following experiment. You will need:
An AA, C or D cell battery
A piece of wire (If you have no wire around the house, go buy a spool of insulated thin copper wire down at the local electronics or hardware store. Four-strand telephone wire is perfect -- cut the outer plastic sheath and you will find four perfect wires within.)
Put the compass on the table and, with the wire near the compass, connect the wire between the positive and negative ends of the battery for a few seconds. What you will notice is that the compass needle swings. Initially, the compass will be pointing toward the Earth's north pole (whatever direction that is for you), as shown in the figure on the right. When you connect the wire to the battery, the compass needle swings because the needle is itself a small magnet with a north and south end. Being small, it is sensitive to small magnetic fields. Therefore, the compass is affected by the magnetic field created in the wire by the flow of electrons.
The figure below shows the shape of the magnetic field around the wire. In this figure, imagine that you have cut the wire and are looking at it end-on. The green circle in the figure is the cross-section of the wire itself. A circular magnetic field develops around the wire, as shown by the circular lines. The field weakens as you move away from the wire (so the lines are farther apart as they get farther from the wire). You can see that the field is perpendicular to the wire and that the field's direction depends on which direction the current is flowing in the wire. The compass needle aligns itself with this field (perpendicular to the wire). If you flip the battery around and repeat the experiment, you will see that the compass needle aligns itself in the opposite direction.
Magnetic field of a wire
Because the magnetic field around a wire is circular and perpendicular to the wire, an easy way to amplify the wire's magnetic field is to coil the wire, as shown below:
One loop's magnetic field
For example, if you wrap your wire around a nail 10 times, connect the wire to the battery and bring one end of the nail near the compass, you will find that it has a much larger effect on the compass. In fact, the nail behaves just like a bar magnet.
A simple electromagnet
However, the magnet exists only when the current is flowing from the battery. What you have created is an electromagnet! You will find that this magnet is able to pick up small steel things like paper clips, staples and thumb tacks.
How do I know there's really a magnetic field? You can look at a wire's magnetic field using iron filings. Buy some iron filings, or find your own iron filings by running a magnet through playground or beach sand. Put a light dusting of filings on a sheet of paper and place the paper over a magnet. Tap the paper lightly and the filings will align with the magnetic field, letting you see its shape!