I'm a physics professor who teaches electricity and magnetism almost every year. My goal is to create a device to let students see invisible magnetic fields. The device would be about the size and shape of a smartphone or small tablet, and would use a large array of magnetic field sensors to map out the strength and direction of magnetic fields passing through it. It would have a screen to draw and display magnetic field lines and vectors. As a basic goal, the device would show the strength and direction of the fields passing through it, so you would place magnets directly on or underneath it and it would draw the field as either lines or 3-d vector arrows.
Final project sketch showing field line view
Final project sketch showing vector arrow view

But as a stretch goal, I'd like to create a true "camera", where you can point the device at one or more magnets some distance away, and it would show the magnets and their field lines as a 3-d visualization on screen. To do this, it would use nonlinear optimization to identify the location, strength, and orientation of magnetic sources in 3-d space, based on the measurements taken by the array of magnetic sensors in the camera. This is a challenging bit of math, but one that I'm familiar with, and I have done a proof of concept to show that it can be done.

Final project sketch showing camera mode

Electronic Design

Final project sketch showing internal design

Hall Effect Magnetic Sensors

These small magnetic field sensors are the core of the project. They are able to measure magnetic fields in 3 axes to fairly high precision (some can easily sense the Earth's field, but I'm not sure I want that.) The device's resolution will be limited by the number of sensors I can fit into the grid. There's no way I will be able to have as many sensors as if I were using the iron filings technique, but since magnetic fields vary in a simple mathematically predictable way, I may be able to do some smart interpolation.

There are a wide range of these available as surface-mount componenents, for a price of $0.50 - $1.00 each in quantities of dozens, so I should be able to afford lots of them.

Open questions and things I'm worried about:

  1. Can I actually solder these? Some are very very small.
  2. Can I make a microcontroller talk to dozens of these at once?
  3. Will I be able to align them precisely on the board, so their XYZ axes are all aligned? Will I need some sort of placement jig? Post-construction calibration?
  4. Will a microcontroller be able to handle the necessary calculations and graphics, or will that have to be done by a smartphone or PC?

Display Options

Final project sketch showing display options

I have two possible options for displaying the magnetic fields.

  1. The device could have a form factor like a smart phone, with an internal LCD display that shows the visualization. This is sexy, but it means all the computation and graphics have to be done on the microcontroller in my project, and it might not be powerful enough, and I won't be able to use many pre-packaged tools.
  2. Or, the device could be a peripheral that plugs into a smart phone. This would let the device be a "dumb" peripheral that just reports magnetic field data via USB, and I could write a smartphone app to do all the analysis and display. This might be more powerful, but it's less slick, and I'd have to learn how to program smartphone apps as well as microcontrollers.
  3. It might be cool to have the device mount to the back of a smartphone, but most smartphones have a bunch of permanent magnets inside (for wireless charging etc) that would distort the readings.

Does this exist already?

There are some old-school non-electronic ways of visualizing magnetic fields, and some research groups have developed arrays of magnetic sensors, but I have not found any commercial product that does what I'm proposing to do, and the "camera" angle seems to be entirely new.

An old-school way of visualizing magnetic fields is to sprinkle iron filings on a piece of paper resting on the magnet, but this has several limitations:

Several engineering research groups have done some work with arrays of magnetic sensors.

I was unable to find anything that attempted to identify field sources from a distance, aka a true magnetic field "camera"

Proof-of-concept

Before building this thing, I need to check that the math actually works. That is to say, can I calculate the magnetic field that a magnet would create a the position of a few sensors, and then work backwards from the sensor data to find the position and orientation of that magnet? (Or multiple magnets, but let's start with one.)

In the mathematical proof-of-concept page, I work out the math and write some code to demonstrate that yes, I can use nonlinear optimization (the Broyden-Fletcher-Goldfarb-Shanno algorithm) to find the position and orientation of a magnet given at least three 3-d observations of magnetic field at different locations. I use a scipy python library to keep things simple and fast.

Can this algorithm solve for multiple magnetic sources? Can it do it in real time? I dunno, but this is good enough to go on for now.

Another important calculation is how far away would a magnetic field camera be able to "see" a magnet? The math page shows that we should be able to detect a rare-earth magnet at a distance of about 20 cm, which is far enough to be useful.