# Measuring Magnetic Fields in a Volume

A project log for low-field MRI

an attempt to develop a low-field coded-field compressed sensing magnetic resonance imager

peter jansen 04/03/2015 at 03:462 Comments

Let's have a look at the first test rig for measuring magnetic fields over a 3D volume.

I confess that I've been thinking about this for a few weeks, and it's been a fun (and sometimes frustrating) design process. We'd like to accurately map the magnetic field intensity and direction at each location in a small volume -- say a 10cm cube. Normally if you'd like to move something through a volume (say, like a 3D printer extruder), you'd put together three perpendicular linear axes, mount your tool or sensor, and that would be it.

But here, getting accurate readings is very important -- this will ultimately be used to measure the first coded fields, and the accuracy of those field measurements will determine the quality of our reconstructions, and in the extreme case, whether the technique will work at all. And it just so happens that most of the things linear axes are made out of -- stepper motors, lead screws, nuts, and other hardware, are magnetic. So we'll have to think a little unconventionally, and figure out a way to make a scanning system that keeps these components somewhat distant from the scanning volume.

The Z and rotational axes

The design I've settled on for this first test uses polar coordinates, and keeps most of the metal parts (and all the metal parts that move or have electromagnets in them, like the steppers) reasonably far away from the magnetometer. To help give a sense of scale, the rig is 8 inches in diameter, and 12 inches tall. First we'll look at the Z and rotational (theta) axes, and then look at the radial (rho) axis.

The base for the rotational stage is mounted on two M8 nylon lead screws that transfer linear motion, and move the whole stage up and down in Z. The base has three 1/4 inch aluminum slides with nylon bushings at 120 degree angles, and there are also three stationary 1/4-20 threaded rods up the length of the machine that help keep everything rigid.

I really like how the rotational (theta) axis worked out -- I had some MLX (2.03mm pitch) timing belts left over from another project, and ended up (after several attempts) being able to successfully laser cut a giant ~5 inch timing pulley (with about 185 teeth) that easily rotates, and also serves as a platform for the radial (rho) stage that we'll see below.

A critical aspect of this stage is that, to make it useful for further testing (of the code coils, or even primary coil), it has to have a large open area in the center where stationary coils could be mounted from the bottom. This complicated the design a bit, but it ends up working out pretty well, and just the Z and rotational axes could very easily serve as the platform for a tiny CT scanner (or other interesting projects that need to rotate around a stationary sample).

Two NEMA14 motors power the Z axis, and are coupled to the nylon lead screws using flexible aluminum couplers.

I like to try and include extra holes and mount patterns on the things that I design so that I can elegantly mount wires or other things as it develops without cutting a new part. Here I've included mount patterns for a Raspberry Pi and Arduino Uno on either side of the bottom of the base.

The lid on the top fits perfectly. Ideally under here there'll be a scanning magnetometer, and an extra stage.

These next few pictures are looking top-down (without the lid). It was such a wonderful angle to photograph, I've included three pictures! I think these are some of my favorite photos that I've had the change to take recently.

Now let's have a look at the radial (rho) stage, that physically translates the magnetometer from the center of the polar circle, outward along a radial line.

Radial (rho) stage (including the magnetometer)

The radial stage definitely looks unusual, but it's what my brain settled upon after thinking of many more complicated ideas. The idea here, again, is to keep all of the moving metal parts as far away from the magnetometer as possible, while still being able to transfer precise linear motion to the magnetometer.

Looking down from the top of the stage, we can see the magnetometer itself (an HMC5883L breakout board from Sparkfun), which has to move from the center of the circle all the way to one side (the right side, in this orientation). It's mounted on a tiny linear stage, and instead of a belt or screw, it uses a cable to transfer linear motion. I've seen this before in some old pen plotters that I took apart years ago, and it really seemed to fit this niche. An elastic band (left side) provides tension to return the axis to the center when the cable isn't actively being pulled.

Kind of silly, but the string that I used at first broke after only about 100 cycles, and I needed to find something around the house that could serve as a more durable replacement. I ended up substituting in some satin dental floss, which causes the machine to smell very pleasantly minty when operating! :)

Here's the underside of the radial (rho) axis. Since this axis moves in several directions relative to the rest of the machine, and contains the sensitive magnetometer, everything is made out of nonmetalic materials. The machine screws and bushings are nylon, and the linear rails are made out of 1/4 inch delrin rods. The tiny carriage that holds the magnetometer is just four pieces of MDF sandwiched together, with press-fit slots for the bushings, captive t-slot nuts for the magnetometer to mount to, and cutouts to securely hang onto the elastic and cable, er, I mean dental floss...

The range of motion (about 4cm, currently) is so short for the radial axis, that we can get away with using a servo motor instead of a stepper, and save an extra stepper controller. This also provides reasonably accurate absolute positioning without the need for a homing endstop or external encoder.

The servo is mounted towards the bottom of this axis (which is about 20cm tall), to keep it as far away from the magnetometer as possible.

And here's the whole thing, indexed up in Z about 4cm. Time to give it a try! I connected it up to an Arduino, and wrote a quick sketch in Processing to visualize the magnetometer field strength at a given location. The Z axis still isn't perfect and has a bit of a ~5mm wobble (it will likely require a third lead screw for stabilization), so I just captured one 2D circular slice of the cylindrical volume, pictured below.

Here we have the very first rough magnetic field image from the machine! This is a baseline image, so the fields are just from Earth's field, as well as whatever the machine itself generates. The variation is surprisingly low -- dark represents the lowest measured field (about 40uT), and light represents the highest field (about 52uT). Samples were taken every 10 degrees in theta, and about every 2mm in rho, so this represents a circle that's about 6cm in diameter, and is the average of about 64 samples per point, which got the variation down to about 0.1uT, which translates into a frequency variation of only 4Hz in the frequency domain! For orientation, the lighter area is centered towards the area of the machine that has two lead screws closer together, where as the dark is centered around the single lead screw.

There's still plenty to do with this rig to characterize the measurements and determine it's accuracy, but it's certainly exciting to see some initial data from the machine.

## Discussions

Anthony wrote 05/05/2015 at 03:26 point

My advice, with a good deal of experience in other 'imaging' industries is that you should also implement a very standard form of linear encoder. I could suggest some companies that produce them by a laser trace device, but especially for this scale, on a clear film, one could 'home make' something on a common laser printer.

On this note, I would check out Avago as though the modules themselves are seeming 'simply' they are widely used in the industry....

These 'new fields', so often they 'calculate', and never during the process itself 'double-check'.... No wonder the end result sucks..

Are you sure? yes | no

AssidiousBlue wrote 04/28/2015 at 14:12 point