Magnetic fields are everywhere– you just can’t see them*.
Here we introduce some basic and inexpensive visual tools, as varied as iron filings and Arduino, pre-school toys and OpenGL, for getting to know your local fields. It’s not exhaustive, but might provide you with some useful starting points for your own exploration.
(*Unless you count the magnetic field inside those photonsthat you use to see things.)
One of the simplest and oldest magnetic field sensors is the humble directional compass. A compass is simply a magnet with labeled north and south poles, held in a bearing such that it can align itself with the ambient magnetic field. Usually, that’s earth’s (relatively weak) magnetic field. But they also can be used to probe the field structure around stronger magnets, as they align to the sum total field at any given location.
Compasses are easy to make. You can take a look here to learn how to make simple versions that float on water or spin on a smooth surface. However we’ve come to prefer the even simpler method shown here: sandwich a thin thread (or a long hair) between two very strong magnets and let it hang down.
If that’s too much trouble– or you need lots –you can pick one a bag full of simple compasses here.
One of the limitations of compasses is that the bearings usually rely on gravity, meaning that they only work in the horizontal plane. For our version with the string, you can get around this by putting the magnets near the middle of the thread, and holding the ends tight to get a compass that works in any plane that you like. You can also get a nifty 3D compass that has bearings to allow the magnet to point in any direction at all.
If you did go ahead and get that bag of simple compasses, you might imagine arranging them around a magnet to see how they all line up. Doing so, you’d find that all of the needles trace out a set of imaginary curves called magnetic field lines. The field lines are no more real than the lines on a topographic map, but provide a useful tool for visualizing the concentration and orientation of the magnetic field in a region.
Taking the natural limit of this situation, why not use zillions(technical term) of tiny compasses to look at the field?
It turns out that you can get awfully close to that by using iron filings. Now, iron filings aren’t exactly a common household item, but you can make or buy some pretty easily. If you crush coarse steel wool (and be carefulif you choose to do so) you can make a pretty good approximation, or you can take actually spend a few minutes with a file and a chunk of soft iron to make authentic filings.
Toy stores sometimes carry tiny vials of iron filings in their science-y section, and so you that’s sometimes a good place to look, too. The “toy” filings that we’ve seen are often very dirty, and come across as uneven powders. By contrast, we’re really impressed with the quality of these iron filings from Arbor Scientific– shown above, and under six dollars per pound –which have larger and reasonably well matched grain size as well as low dust.
Here we’ve poured iron filings onto a piece of paper covering a stack of powerful NdFeB magnets. You can see some hints of field structure, but it’s hard to make anything out.
A much better approach is to slowly and uniformly sprinkle the filings onto the paper from a few inches above, giving them an opportunity to arrange themselves in the field. As you add more filings the filings illustrate the field lines more clearly, up until a certain point.
So what’s going on here, really? These aren’t compasses, free to rotate on a bearing. In fact, the iron particles are not all that magnetized initially. In the jar, the particles aren’t attracted to each other; they just feel like heavy sand.
Rather, the iron particles are just being good ferromagnets, which exhibit strong magnetization when placed in a strong external magnetic field.
(From a microscopic perspective, the magnetic domains inside the iron filings are randomly aligned to begin with. They align strongly when placed in the external field, and will retain some part of that
magnetization when the external field is removed.)
When the particles are dropped onto the paper, they suddenly become strong little bar magnets (thanks to the external field) and do their darned best to align to it– just like the little compasses. The particles that land close enough to the magnet itself are pulled right towards it. Those further away are magnetized by the big magnet, but don’t have enough attraction to move towards it. Instead, they attract towards one another, north to south, north to south, with the results that you see here.
If you look closely, you’ll notice lateral stripes across the center of the magnet. That’s because we’re not using a single bar magnet under the paper, but instead the stack of strong magnet cubes shown in the next photo.
Pro tip for working with iron filings: do not let the filings touch the magnet directly. You’ll never get them off.
These pieces of zinc-plated iron wires are a fancy version of iron filings. They are dust free, won’t rust, and can be picked off of a magnet. You can get them here, but they cost about twenty times as much as the regular iron filings.
On the other hand, they make for a pretty good field display.
This material feels like a thin piece of semi-rigid plastic with paint on the back side. In practice it acts like a sheet of green bubble wrap that has ultra-fine bubbles filled with viscous fluid. Within the fluid,
there are shiny but microscopic magnetic rods. In the presence of a strong field the rods align to the field– much like our other examples. Near the poles of the magnet the film appears dark, as you view the rods end-on, and away from the poles, the film appears bright, as you view the shiny sides of the rods.
As the fluid is viscous, the particles do not align except to very strong magnetic fields, and tend to stay in place once the field is removed– the earth’s field (half a gauss or so) is nowhere near strong enough to affect it. You may be able to see whorls in the photo above, from when a magnet was waved over the surface to “erase” the image.
Pro-tip for using magnetic field viewing film: don’t scratch the back side or pinch it between two magnets– the “bubbles” will pop, and you’ll end up with dead spots on your film.
Here’s what the film looks like over the same magnet stack that we used for the iron filings. The contrast is remarkable. While it’s easy to see the lateral bars in the middle between the little cube magnets, it’s all but impossible to see the overall shape of the magnetic field that was revealed by the iron filings. The only hint of it is the dark region by each pole, corresponding to where the iron filings were also sticking up, out of the plane.
Again, this is because of the viscous nature of the material; it can only respond to very strong, local fields like those by the poles.
There are certain places where viewing film really does well– which are those with complex magnetic pole geometry. Consider a simple rubberized refrigerator magnet— the kind that appears as a business card that you stick on the fridge. Rather than using strong magnets to support the weight, they use a more complex field geometry, with lots of poles, to concentrate the field right by the magnet surface– as you can see above.
For reference, here’s how that same magnet looks under iron filings:
If magnetic viewing film seems obscure and technical, there’s an inexpensive alternative that’s surprisingly common: the Magna-Doodle, or Doodle Pro, as they seem to be labeled these days. You certainly won’t get the same level of performance out of it, but it’s an interesting toy once you approach it this way.
We first talked about the Magna Doodle several years ago in an article about using it as part of a pen plotter. It’s like the magnetic viewing film in the sense that it has chambers of viscous fluid and ferromagnetic particles. However, the particles and chambers in the Magna Doodle are macroscopic and you can see them. In that way, it’s much like a cross between the magnet viewing film and the iron filings.
Placing our magnet stack on the Magna Doodle screen and removing it, you can see the field lines show up, and even tell which set is “edge on” by the arrangement of the iron particles. (You may want to view that last picture extra large to see that in detail.)
(If you have access to the back side of the Magna Doodle screen, you might also see some interesting stuff there.)
We now head in a radically different direction: using an electronic compass to visualize magnetic fields with the help of a computer. The tiny circuit board shown here is a breakout board for the Honeywell HMC5843 3-Axis magnetoresistive sensor, from
from SparkFun Electronics. (If you need a scale reference, here it is.)
(The HMC5843 is a sensitive device, capable of reading fields up to six Gauss– about ten times Earth’s magnetic field, but isn’t suitable for making measurements near the poles of magnets. It’s more like a compass than an iron filing.)
There are only four connections to and from this board: 3.3 V input power, ground, and two I2C wires. To talk to it, we use an Arduino board (Duemilanove), which provides the 3.3 V (stepped down from the 5 V USB power), the I2C interface, and a USB interface so that we can get the data back to the computer. On the computer side, we use a Processing sketch to read out the data and plot it to our screen.
Here’s the breakout board with the four wires attached.
Aside: Why the giant capacitor? There’s actually a known bug on this version of the breakout board– not sure if it’s been fixed yet or not –which is that it did not read out sensible numbers with the default capacitor there. I added a *ahem* slightly larger 1 microfarad capacitor in parallel which seemed to fix it just fine. You can add a smaller one but (a) this one is nonmagnetic (b) it gives a place to actually hold the tiny circuit board and (c) it’s red, therefore SparkFun should approve. Matches the board and all.
After soldering the sensor to the Arduino board by the four wires, we loaded this Arduino sketch onto the board. It’s based on this hmc5843 library that you’ll need for the sketch to compile. On the computer side, we wrote this Processing sketch to read out and graph the data.
The Processing sketch uses its OpenGL routines to plot the magnetic field read out by the sensor. At the time of each reading– several times per second –a dot is plotted in 3D space, representing the field strength measured in the X, Y, and Z directions, shown as the red, green, and blue axes.
In this plot, the sensor is turned around a few times about its Y axis (where the cords come out) without moving around much. In the reference frame of the sensor, the Earth’s field keeps a constant magnitude, i.e., distance from the origin, but wanders in orientation.
Holding the sensor still, you just get a single dot in space plotted. The color cycles slowly in time to help indicate the history. To reset the plot or look along the different axes, you can type ‘0’, ‘1’, ‘2’, or ‘3’ on your keyboard to reset the view to xyz, along x, along y, or along z respectively.
Ideally, as you rotate the sensor around in all possible directions, it will trace out a sphere, centered at the origin, where the radius is given by the ambient magnetic field. Something like you see above.
In practice there are usually magnetic offsets on the sensor chip itself or on the breakout board– those multilayer ceramic capacitors are almost always magnetic, for example. So, as you trace out the sphere, you’ll find the center to be displaced from the origin. For this reason, the Processing sketch includes x, y, and z correction factors (offsets) that you can use to center the sphere back on the origin.
You can use the sketch to calculate the proper offsets. If you rotate the sensor through all possible positions, spanning the maximum orientation along +x, -x, +y, -y, +z, and -z,
then when you end the program by clicking in the window, the data printed will include new offset values that you can paste back into the sketch– ensuring that the data will be reasonably accurate next time that you run the program.
So, it’s a starting place for exploring magnetic fields on the computer, and works pretty well as a 3D compass that you can plot in real time.
A natural next step would be to plot the magnitude of the field at different positions in space. That’s straightforward once you add in data for where the device is located– but tracking is another topic for another time.
We hope that this article provides a few points for starting to play with and see magnetic fields. Again, it isn’t meant to be comprehensive, but merely to provide a few starting points for easy exploration. There are many other methods of looking at and measuring magnetic fields as well– for example ferrofluids come to mind, but may provide less intuition about field geometry than simple iron filings.
If you liked this article, you might want to check out these others as well:
- 17 cool magnet tricks
- How to make the simplest electric motor
- Making Crafty Fridge Magnets
- How to extract magnets from plastic toys
- Demonstrate Magnetohydrodynamic Propulsion in a Minute
- Iron filing nail polish
- An AVR-based Analog Plotbot with an E-Paper Display
- Building an Electric Motor
- Homopolar motor exhibit at the Exploratorium
- Super-Easy Supermagnet Compass