Plotting Magnetic Fields
Sections
1. Introduction
2. Hardware Check
3. Plotting Magnetic Fields
1. Introduction
In this lesson we'll plot the magnetic field lines of a bar magnet using a digital compass. A digital compass is a sensor that responds to magnetic fields. There's probably one in your cellphone that's a lot like the one we're using here.

A magnetic field line is an imaginary line that connects the south pole of a magnet to its north pole. They're a handy way to visualize the magnetic field of a magnet, but it's important to remember that the magnetic field exists between the field lines as well.
To plot the magnetic field we'll place the bar magnet next to a sheet of paper with pre-marked points. Then we'll measure the direction of the magnetic field at each point. You can print out this grid for the next section. It has a spot marked for the magnet as a start, but try other placements after that one.
It's important to keep the compass oriented the same way the whole time we're measuring the field. If you take a close look at the compass, it has x and y axes printed on it next to the compass chip. While we're moving the compass around the page we'll need to keep the y axis pointed to the top of the page and the x axis pointed to the right.

2. Hardware Check
In the next section we'll use a digital compass attached to one of the I2C pins of the Arduino. If you haven't already, attach the compass to the Arduino and connect the Arduino to the computer.
3. Plotting Magnetic Fields
The first point is selected below. (Each point will flash while it's selected). Move the compass to that point. Make sure to position the compass so the y arrow on it points to the top of the page and the x arrow points to the right. When the direction stabilizes, click the next point and move the compass again. Repeat this process for each point. You won't be able to see the whole field at once, but you can move the magnet to a different position and plot it again.
X Magnitude
0
Y Magnitude
0
This lesson requires a newer browser. Please see this page for more information.

4. Lesson Done