Basic Electromagnets

posted on 25 Jan 2013 by guy
last changed 23 May 2017

Average: 3.3 (8 votes)
Your vote (click to rate)

ages: 6 to 99 yrs
budget: $0.00 to $2.00
prep time: 0 to 0 min
class time: 0 to 999 min

This lesson provides some general background on electromagnets and describes three simple activities for students to explore on their own. For reference, it also includes formulas for the magnetic field strength around several common types of electromagnets.

learning goals:

  • learn about the relation between a current in a wire and the magnetic field it produces
  • explore the magnetic fields produced by different configurations of wire
  • observe the effect of using an iron core with an electromagnet


required equipment: wire (insulated), D battery, compass
optional equipment: Neodymium magnet, iron filings
subjects: Engineering, Physics
keywords: Ampere, Faraday, Orsted, electromagnet, electromagnetism

history and background

An electromagnet is created when an electric current passes through a conductor, thereby producing a magnetic field. In common use, it includes a magnetic core (usually of iron) surrounded by a coil of wire. When current flows through the wire, it produces a magnetic field that magnetizes the core, further enhancing the magnetic field. When the current is stopped, the core is no longer magnetized.

The principle behind the electromagnet was discovered in 1819 when the Danish scientist Hans Christien Ørsted observed that an electric current in a wire caused a nearby  compass needle to deflect, thereby demonstrating that a current in a wire produces a magnetic field.

As the story goes, Orsted was preparing a lecture on electricity, and one of his demonstrations involved discharging a battery through a conducting wire. When the current passed through the wire, a magnetic compass that was lying underneath suddenly spun around to align with the wire. When the wire was disconnected from the battery, the compass needle returned to its natural north-pointing position.

This event is believed to be the first demonstration of a direct connection between electricity and magnetism. Prior to this time, electric phenomena and magnetic phenomena were thought to be distinct, and had been studied separately. Scientists had performed many experiments involving static electricity, electric currents in wires, batteries and lightning. They had also performed many experiments with naturally magnetized pieces of ferrite ("lodestones") and iron, and had mapped magnetic fields. Until Ørsted's discovery however, there had been no observation demonstrating a connection between electric and magnetic effects.

The discovery was not completely due to chance; Ørsted had been looking for such a connection for some time. Several months after the lecture, he published his findings showing that a current-carrying wire produces a circular magnetic field.1 In the same year, the French scientist André-Marie Ampère observed and characterized the magnetic forces between two current-carrying wires, and two other frenchmen, Jean-Baptiste Biot and Felix Savart, discovered the "Biot-Savart law", which relates the magnetic field to the current that produces it.

In 1826, Ampère went on to discover his "circuital law" of electromagnetism, which relates the integrated magnetic field around a closed path to the electric current that passes through the path, and is consistent with the Biot-Savart law. These two general laws are used to derive expressions for the magnetic field around a number of simple configurations of current-carrying wires (see below for formulas of the most common configurations). (See the lesson on Iron and Magnets for more on magnetic fields and magnetic field lines.)

Fig. 1: Magnetic field lines around a straight wire. Positive current is flowing to the right and into the page.

Fig. 2: Magnetic field lines around a loop of wire. Current is flowing clockwise. The ends of the wires point out of the page.

Fig. 3: Magnetic field lines around a loosely wound solenoid. Current is flowing to the right.

Fig. 4: Magnetic field lines around a tightly wound solenoid. Current is flowing to the right.


Fig. 5: Detail of the finished solenoid wound around a straw. A #12 carriage bolt just fits inside this piece of plastic straw.

field around a straight wire

A current in a straight wire produces a circular magnetic field around the wire as shown in figure 1. The direction of the field lines is described by (one of) the right-hand rules. In the figure, positive current is assumed to be moving to the right, which means that in reality negatively charged electrons are moving to the left. The strength of the magnetic field is derived using Ampère's circuital law (or the Biot-Savart law) and is given by the formula: $$B={{\mu_0 I}\over{2\pi r}}$$ where $B$ represents the magnetic field strength, $I$ is the electric current, $r$ is the distance from the wire, and $\mu_0$ is known as the permiability of the vacuum and has the value $4\pi\times 10^{-7}$ Tesla-meter/Amp. This formula shows that the field is proportional to the current in the wire (as the current increases, so does the field), and inversely proportional to the distance from the wire (as the distance increases, the field decreases).

field around a loop of wire

A current in a circular loop of wire, or several loops of wire bound tightly together, produces a magnetic field like the one shown in figure 2, which looks like the field from a very short bar magnet. At the center of the loop, the magnetic field can be calculated from the Biot-Savart Law and is given by the formula: $$B={{N\mu_0 I}\over{2r}}$$ where $N$ is the number of loops and $r$ is the radius of the loop. See the lesson on Safety Pin Motor for an example of this style of electromagnet.

field around a solenoid

When you wrap a wire in many loops, you form a cylindrical coil called a "solenoid". If the wrapping is not very tight, the magnetic field around the coil may look like the one in figure 3. For a tighter wrapping, the field looks more like figure 4, which is approximately the same as a bar magnet. In this case, the field inside the solenoid is relatively uniform except near the ends of the coil where the field starts to spread out. For a long thin solenoid, for which the length is much bigger than the diameter, the strength of the field inside can be approximated by Ampère's law and is given by: $$B={{N\mu_0 I}\over{L}}$$ where $N$ is the number of loops and $L$ is the length of the solenoid.

Solenoids are often used in electromagnets for scrap yards, in actuators (switches), and in loudspeakers. Frequently, they include an iron core to enhance the magnetic field. See the activity on electromagnetic solenoids below.


WARNING: All of the following activites involve connecting a wire to both ends of a battery. The wire will get quite hot if you hold it on the battery for a long time. Don't tape the wire to the battery, it will eventually burn. Don't put batteries in your pocket with loose change either. I'm telling you from first-hand experience.

Ørsted experiment
Take a magnetic compass and set it on a table. Take a long piece of flexible wire, 24 gauge or narrower, and drape it over the compass in the north-south direction (along the needle). Touch the two ends of the wire to the two terminals of a flashlight battery. You should see the compass needle jump to an east-west orientation. WARNING: The wire will get quite hot if you hold it on the battery for a long time. To understand this effect, recall that the field lines around a straight wire circle the wire as in figure 1. The magnetic compass needle will try to align itself along the field lines under the wire — that is, the north pole will be pushed in the direction of the field line and the south pole will be pushed opposite to the field line. (See the reference below for a java demo showing this experiment.)

pushing a wire with a magnet
You can show the magnetic force on a current-carrying wire if you just using a strong magnet. Take a long piece of flexible wire, 24 gauge or narrower, and hold both ends to the terminals of a battery. WARNING: The wire will get quite hot if you hold it on the battery for a long time. Take a good-sized Neodymium magnet, 1/2 inch cube or bigger, and bring it close to the current-carrying wire. You should observe the wire be either attracted or repelled by the magnet. Hold the magnet in different orientations and watch how the force changes back and forth between attractive and repulsive. More advanced students should be encouraged to predict whether the force is attractive or repulsive according to the right-hand rule for the Lorentz force. For more on the Lorenz force, i.e. the magnetic force on a current, see our lesson on Classroom Rail Gun.

electromagnetic solenoids
Make a hollow solenoid out of a straw and some insulated wire. Find a large plastic soda straw, preferably one at least 1/4 inch in diameter, and a large iron nail or bolt that just fits inside the straw. Insert the bolt into the straw and wind insulated wire around the straw to form a solenoid. Enameled magnet wire works best, but plastic-insulated wire is also fine. Make one row of coils from the head of the bolt down to the tip, and then make another row of coils on the outside all the way back up to the head. Tie the two ends of the wire together at the head to finish. Putting some double stick tape on the straw before winding can help keep the coils in place. Figure 5 shows the finished product. This version was made from about 2m of 20 gauge plastic insulated wire wound two layers thick for a density of 12 turns per centimeter.

Connect the wire ends to a battery to make a solenoid magnet. Remove the bolt to begin with and measure how close you need to be to a magnetic compass before the needle is deflected. Insert the bolt into the solenoid and repeat the measurement with the compass. You should see a noticeable effect from farther away with the bolt. When the bolt is in place, it too becomes magnetized, and its magnetic field adds to the magnetic field of the solenoid to create a stronger overall field.

With the bolt inserted, your solenoid is probably strong enough to pick up paper clips off the table. Just touch the tip of the bolt to the paper clip and lift slowly. After you disconnect the battery, the paper clips may remain attached to the bolt. Both the bolt and the paper clips are magnetized by the external field of the solenoid, and they may retain some of their magnetization even after the power is turned off. See our lesson on Iron and Magnets for further discussion on magnetization.

electromagnetic solenoids with iron filings

In the lesson Iron and Magnets, we used iron filings to map out the field around a bar magnet. In this lesson it is interesting to do the same exercise with the solenoid wound around the straw. Try the solenoid both with and without the bolt inserted to see the effect the metal has in strengthening and concentrating the field.

further reading

Frederick Gregory at the University of Florida has written a beautiful description of some of the history surrounding Ørsted's discovery.

Walter Lowen's excellent talk on magnetism at MIT discusses Ørsted's discovery and many other principles of electromagnetim.

In case you don't have a compass handy, the folks at the National High Magnetic Field Laboratory have put together a clever java demo to simulate Ørsted's experiment, as well as an illustration of the magnetic field around a straight wire to help you figure out the directions of currents and fields.

  • 1. Hans Christien Ørsted (1820), "Experimenta circa Effectum Conflictus Electrici in Acum Magneticam"

login or register to post comments