A brief overview of my recent magnetometer experiments…

If you follow me on twitter (@brainwagon) you’ve undoubtedly seen a few mysteriously short tweets about experiments I’ve been performing on magnetometers. It’s hard to give any meaningful context in just 140 characters, so I thought I would dump a short overview of what I’m doing here, in the hope that I’ll turn it into a longer post later.

First of all, the inspiration to experiment with magnetometers comes from John R. Leeman’s blog/website. John posted the following video describing how he used inexpensive magnetometers to microcontrollers like the Arduino to teach about the basics of data acquisition and geophysics.

It was inspiring. As it happens, I had a simple 3 axis magnetometer (manufactured by OSEPP) using the HMC5883L chip. So, walking in his footsteps, I wrote some code for my Wicked Device Wildfire V2 board. It’s basically a member of the Arduino family which has built in wifi. My code basically reads the magnetometer and uploads it to the “phant” data logging server hosted at the Sparkfun website. Using the Python programming language, I can fetch the data from this server, and reformat it so that I can visualize it with gnuplot. For instance, here’s the smoothed data (mx/my/mz) and the computed amplitude and heading.


I’m really only just now trying to understand what the data actually means, and how the sensor is affected by things like temperature. This sensor is currently in my upstairs bathroom, which probably has a fairly wide temperature swing, is not level, and is probably closer to nearby metallic options than optimal. I’ll be letting this go in its current state to see if I can spot the diurnal (daily) variation in the heading. I suspect that most of the change in amplitude is actually due to changes in temperature. When I get a chance later this weekend, I’ll reset the device, and add a temperature sensor (probably a DS18B20) and record that along with the magnetic data, and maybe do some work to calibrate the sensor better.

I really like John’s site, and he also co-hosts a nifty geology podcast called the Don’t Panic Geocast. Definitely worth listening to, and inspiring me to learn more about geology, a subject that I admit I know relatively little about. Good stuff!