Magnetic Fields II: Field Measurements and Resonance

In this lab, you will use a magnetic compass as a probe to investigate magnetic field strengths. You will use your compass in conjunction with a pair of Helmholtz coils (which can generate fairly uniform and readily calculable magnetic fields) to obtain an estimate of the strength and direction of the horizontal component of the Earth's magnetic field, and to explore different magnetic field measurement techniques.


Before we start today's lab, we are asking all students to complete a short (<5 minute) survey in which you will have a chance to provide feedback on your TA (and undergraduate LA, if applicable). Your answers are anonymous and will not affect your grade in any way. You may access the survey from your personal computer, a lab computer, or your phone.

At the end of the quarter, TAs (and LAs) will receive average scores and comments (without identifying information) from their lab section(s).

Do not include any identifying information in your responses. If you have any feedback to provide to which you would like a response, please send it to David McCowan (

If you cannot or do not want to complete the survey now, you may complete it at home. The survey will remain open until Saturday, February 24 at 5:00 pm.


Helmholtz coils

We will be using a pair of wire coils in a Helmholtz configuration, for which the magnetic field at the center is

$B_{HH} = \dfrac{8\mu_0NI}{\sqrt{125}R}$, (1)

where $\mu_0 = 4\pi * 10^{-7} \mathrm{H/m}$ is the permeability of free space, $N$ is the number of wire loops in each coil, $I$ is the current through the wires, and $R$ is the radius of the coils. (The Helmholtz configuration refers to two identical coils where the separation between the coils is equal to the radius of the coils. Such a pair of coils produces a very uniform field near the center, unlike a generic single loop of wire.)

Figure 1: A pair of Helmholtz coils
Room 107 Room 109/116
Number of turns varies (value written on the coil base N = 130
Radius R = 10.5 cm R = 15 cm
Table 1: The number of turns of wire in each coil and the coil radius for the coils used in differing rooms.

When a magnetic field interacts with a compass needle, it produces a torque on the needle $\tau$ given by

$ |\tau| = | \boldsymbol{\mu}_c \times \boldsymbol{B}| = \mu_c B \sin\theta$, (2)

where $\mu_c$ is the needle's magnetic dipole moment, $B$ is the magnetic field, and $\theta$ is the angle between them. For consistency in this experiment, we will always measure $\theta$ relative to the direction of the Earth's field (with no other fields present). We set up our coordinates as shown in Fig. 2.

Figure 2: Coordinate system for compass measurements

Lab notebook template

One member of the group should click on the link below to start your group lab notebook. (You may be asked to log into your UChicago Google account if you are not already logged in.) Make sure to share the document with everyone in the group (click the “Share” button in the top right corner of the screen) so each member has access to the notebook after you leave lab.

Part I: Measuring the Earth's magnetic field

Consider the setup in Fig. 3, where our Helmholtz coil is aligned such that the field it produces in the $\hat y$ direction is perpendicular to Earth's field in the $\hat x$ direction.

Figure 3: Top-down view of the compass on the platform with coils oriented to produce a field perpendicular to the Earth's field.

When the coil is turned on, there will initially be motion causing the compass needle to turn and change orientation. When the needle stops moving, we know that the torque due to the field produced in the coil, $\tau_{HH}$, is equal in magnitude (and opposite in direction) to the torque due to earth's magnetic field, $\tau_E$. (If the two torques were not equal, then then the needle would keep moving until it reached equilibrium.) Mathematically,

$|\tau_{HH}| = |\tau_{E}|$.

Using the geometry of the setup, we can break these torques down in terms of angles to find

$\mu B_{HH} \cos\theta = \mu B_E \sin\theta$.

The magnetic moment of our needle appears on both sides of the equation, so it drops out and we can then relate the strength of earth's magnetic field to the applied field by

$B_{HH} = B_{E} \dfrac{\sin\theta }{\cos\theta} = B_E\tan\theta$. (3)

Therefore, if we plot the magnetic field from our coils versus the tangent of the angle the compass needle, the slope should give us the Earth's magnetic field.

NOTE: This method will let us measure the horizontal component of the local magnetic field at the center of the coils, but that might not be due to Earth alone. Large pieces of iron may distort magnetic fields, and anywhere there are significant currents running through wires (e.g. some power carrying wires, door/window locks in some rooms) might alter the local magnetic environment.

Coil connections
Room 107 Room 109 Room 116
DC Power Supply
PHY 132 PHY 122
Set up your coil and compass system with the compass as close to the center of the coils as possible. Adjust your compass so that it reads $0^{\circ}$ when the coil is turned off and adjust the platform so that the compass is level.

Using the DC power supply, increase the current to the coil. Measure $\theta$ as a function of magnetic field, $B$ (or equivalently, as a function of applied current, $I$.)

Plot your data and fit to the appropriate line. Estimate the strength of the horizontal component of Earth's magnetic field.

We provide a Google Colab notebook that you can use to plot and fit your data.

Part II: The magnetic moment of a bar magnet

Even the smallest commercial magnets can have a field that is substantially stronger than Earth's at short ranges. We will investigate this for the small neodymium magnets which are mounted on the small foam boards.

If we assume our little magnets are dipoles (which will be sufficient for our purposes), then the magnetic field along the same axis as the dipole (which we'll call the $\hat x$ direction) is

$B_M = \dfrac{\mu_0}{4\pi}\dfrac{2\mu_M}{d^3}$ (4)

where $d$ is the distance away from the magnet, and $\mu_M$ is the magnetic moment for our permanent magnet.

Figure 4: The bar magnet (on its foam board holder) and the compass, oriented so that the field created by the bar magnet is perpendicular to the Earth's field.
Place your permanent magnet a few centimeters away from your compass on the bench top (not on the platform within the coils). Orient your bar magnet so that the field it produces is perpendicular to the Earth's field.

Adjust the position of the magnet until the compass deflection is $\theta = 45^{\circ}$. At this point, $B_M$ = $B_E$.

Determine the magnetic moment for the bar magnet, $\mu_M$, from Eq. (4) above.
Optional: A dynamics-based measurement

A dynamics-based measurement

You might've noticed that the torque equation for a dipole in a magnetic field has some similarity to the expression for the forces on a pendulum. It is indeed the case that you can model a magnet aligning with a field as a type of simple harmonic oscillator. However, for the case of our compasses, the fluid the needle floats in adds a considerable dampening term. Solving the equations of motion to figure out how the compass needle will rotate over time would require a careful characterizing of the system that is beyond what we can do in lab today.

Instead, let us think about our setup qualitatively for a second. Suppose we set up our Helmholtz coils as follows, so that they will create a field in the $-\hat x$ direction:


If we create a magnetic field opposite the direction of Earth's, then as we increase that field's strength, it will at some point become so strong that the net field will flip directions and the compass needle will rotate around to align itself in the opposite direction. If we then turn off the field, the needle will realign itself with Earth's magnetic field. The exact dynamics of this are complicated, but if the dampening term is constant, the alignment will occur more quickly as the field strength increases.

Now for the clever part: if we can create a magnetic field that is twice the magnitude of Earth's in the exact opposite direction, the needle will take just as long to line up with the net field with the Helmholtz coils on as it will take to line up with Earth's field when the coils are off. Therefore, by turning the coils on and off, timing the needle as it settles, and changing the current, we can make use of this symmetry as another means of measuring the planet's magnetic field.

Keep same setup

Use higher voltages to completely flip compass

Measure recovery time as a function of $B$-field

Since we don't have a complete model, aim to find $B$-field where recovery times are equal

Part III: Magnetic resonance

Last week, we were able to use some straightforward arguments to measure the ratio of electric charge to mass for an electron, $e/m$. Here, we'll do something analogous for magnetic and rotational terms: determine the ratio of magnetic moment to the moment of inertia for our compass needle, $\mu_c/J$. (We are using $J$ as our variable for moment of inertia because we have already used $I$ to represent current.)

To start, we'll use a permanent magnet this time instead of Earth's magnetic field. By moving the magnet closer or further from the compass, we can easily change the strength of the field the compass sees. (We will neglect Earth's magnetic field in this part because at the scales and ranges we'll be working with, the magnet will completely overwhelm the field produced by the Earth.)

For this setup, we'll place our permanent magnet on the $\hat x$ axis of our coordinate system and the Helmholtz coils will be set up to produce a field in the $\hat y$ direction.

With the Helmholtz coils off, our compass will rotate to align itself with the permanent magnet and then stop. If we turn on the Helmholtz coils, we'll again have two torques acting on the system, $\tau_{M}$ and $\tau_{HH}$.

Now, an interesting thing happens if we drive the Helmholtz coils with a sinusoidally varying current. We will not derive the full equations here, but the system acts as a harmonic oscillator (due to the constant field of the bar magnet) that is both damped (due to the fluid in the compass) and driven (due to the oscillating field from the Helmholtz coils). If we don't move the compass too quickly, we can neglect the contribution from dampening and find that the expected resonant frequency of this system is

$f_{res} = \dfrac{1}{2\pi}\sqrt{\dfrac{\mu_c}{J}B_M}$,

where $\mu_c$ is the dipole moment of the compass needle, $J$ is the moment of inertia of the compass needle, and $B_M$ is the field strength due to the bar magnet.

If our permanent magnet is treated as a dipole, then its field strength along the $\hat x$ axis is given by Eq. (4) above, which again is

$B_M = \dfrac{\mu_0}{4\pi}\dfrac{2\mu_M}{d^3}$.

With the combination of these two terms, we find that

$f_{res} = \dfrac{1}{2\pi}\sqrt{\dfrac{\mu_c}{J} \dfrac{\mu_0}{4\pi}\dfrac{2\mu_M}{d^3}}$. (5)

If we rearrange this in terms of measurable variables, then the resonant frequency becomes

${f_{res}}^2 = k \; \mu_M \dfrac{\mu_c}{J} * \dfrac{1}{d^3}$, (6)

where $k = \dfrac{\mu_0}{8\pi^3}$ is a constant.

This means that we should be able to relate the resonant frequency of our setup to the following three variables:

  1. $\mu_M$, the magnetic moment (i.e. strength) of our fixed magnet (which you measured above in Part II);
  2. $d$, the distance from the magnet to the compass; and
  3. $\frac{\mu_c}{J}$, the ratio of magnetic moment to moment of inertia for our compass needle.

Since we only have one fixed magnet per group and we can't really do much with the compass's physical parameters, the best way we can test the validity of this model is to see if $ f_{res} \propto d^{-\frac{3}{2}}$.

Returning to the platform between the coils, place the permanent magnet a few centimeters away from the compass and orient it so that its field is perpendicular to the field created by the coils.

Set the frequency of the function generator, $f$, and adjust the distance $d$ of the magnet until you find the largest oscillations for that particular frequency. (Alternately, adjust the frequency while keeping the the distance of the magnet fixed until the oscillations are at greatest amplitude.) This is the resonant frequency, $f_{res}$. (See below for tips on determining resonance.)

Plot your resonant frequency against distance and fit a line to it to see if the $-3/2$ exponent suggested by Eq. (6) is a good fit.

Tips for determining resonance:

  • You are looking for resonant frequencies in the range of 0.1 to 20 Hz. Choose the 1 Hz range on the function generator and adjust the frequency dial down to the lower end of the range.
  • To measure frequency more accurately, you may use the “frequency counter” feature on the multimeter. Attach the meter in parallel, and turn the dial to “Hz”. (See Fig. 5.) Note that the meter may take a few seconds to update (when the frequency is very low) and that it will also have trouble determining the frequency if the amplitude from the function generator is set too low.
  • Set the amplitude knob on the function generator to be about half. If you apply too strong an oscillating field, your compass needle will have always have large oscillations… whether you are on resonance or not. By turning the amplitude down a bit, you will have a better chance of seeing the change in amplitude as you tune the frequency through the resonant frequency.
  • Keep your bar magnet in the range of about 0 to 7 cm from the compass. If you go much further than that, the strength of the magnet's field no longer dominates over the Earth's field and additionally the point of maximum amplitude of the oscillations at resonance becomes harder to distinguish.
Figure 5: The multimeter can be connected to the function generator in parallel and turned to “Hz” in order to measure frequency.

Bonus: Magnetic shielding

The final piece of the puzzle today is to look at how the behavior of our oscillating compass needle can be changed by changing the environment around it. We'll use an alloy called $\mu$-metal (an alloy with very high magnetic permeability) to alter the compass's motion.

Effectively, this should shield the compass from some of the field produced by the permanent magnet. Thus, if we find the slope $a$ from our frequency vs. distance relationship – $ f_{res} = a~d^{-\frac{3}{2}}$ – with and without the shielding material, we can say something about how effective the shield is.

Qualitatively, how does the compass oscillation respond when you wrap the compass in $\mu$-metal? Do the oscillation amplitudes increase or decrease? Does resonant frequency (for fixed $d$) increase or decrease?
Are these observations consistent with the idea that $\mu$-metal reduces the field strength that the compass sees?

Real application: MRI

The above exercise is very similar to how Magnetic Resonance Imaging (MRI) works. Instead of compass needles, the target for tests are the nuclei of hydrogen atoms (which act like little bar magnetic) which will align with applied fields. The chemical compounds that the hydrogen atoms are part of affect its response in ways similar to the $\mu$ metal, changing the resonance frequencies we observe.

Submit your lab notebook

Make sure to submit your lab notebook by the end of the period. Download a copy of your notebook in PDF format and upload it to the appropriate spot on Canvas. Only one member of the group needs to submit to Canvas, but make sure everyone's name is on the document!

When you're finished, don't forget to log out of both Google and Canvas, and to close all browser windows before leaving!

Post-lab assignment

Answer the questions/prompts below in a new document (not your lab notebook) and submit that as a PDF to the appropriate assignment on Canvas when you are done. You should write the answers to these questions by yourself (not in a group), though you are welcome to talk to your group mates to ask questions or to discuss.


The conclusion is your interpretation and discussion of your data.

  • What do your data tell you?
  • How do your data match the model (or models) you were comparing against, or to your expectations in general? (Sometimes this means using the $t^{\prime}$ test, but other times it means making qualitative comparisons.)
  • Were you able to estimate uncertainties well, or do you see room to make changes or improvements in the technique?
  • Do your results lead to new questions?
  • Can you think of other ways to extend or improve the experiment?

In about one or two paragraphs, draw conclusions from the data you collected today. Address both the qualitative and quantitative aspects of the experiment and feel free to use plots, tables or anything else from your notebook to support your words. Don't include throw-away statements like “Looks good” or “Agrees pretty well”; instead, try to be precise.

REMINDER: Your post-lab assignment is due 24 hours after your lab concludes. Submit a single PDF on Canvas.


This lab is based in part on the following publications:

  1. Jonathan E. Williams , “Measuring Earth's Local Magnetic Field Using a Helmholtz Coil”, The Physics Teacher 52, 236-238 (2014)
  2. Esther Cookson, David Nelson, Michael Anderson, Daniel L. McKinney, and Igor Barsukov, “Exploring Magnetic Resonance with a Compass”, The Physics Teacher 57, 633-635 (2019)