Read the 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.
Microcontroller plugged in and digital compass attached
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.
Select a point by clicking on it and move the compass to that point. Repeat until all points have been plotted.
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.
You have completed the lesson.
You may scroll up to review the lesson.