Tuesday, December 27, 2011

Pocket Magnetometer?: A Holiday Break Experiment

I've often wondered whether the magnetometer built into the iPhone is sensitive enough to be used as a remote sensing device.  At CSULB we use a Geometric 858 cesium vapor magnetometer to map subsurface deposits.  This ca. $25K instrument provides very fast and high precision measurements of the earth's magnetic field.  Collecting 10 readings a second, the 858 is capable of measuring differences as small as 0.008 nanoteslas (gammas).  While this precision is fantastic, often the variability we are interested in (e.g., hearths, organic deposits, etc) varies substantially more than that from the background magnetic field.  When mapping a large area, it isn't uncommon to see lots of noisy measurements at 1-10s of nanoteslas with features of interest showing variation in the 100s of nanoteslas. Of course, one's ability to measure differences in subsurface magnetics depends largely on the degree of variability of the background. The noisier the background (i.e., larger the highs and lows), the bigger the signal must be from the feature of interest. Using a gradiometer (i.e., two sensors and subtracting the difference) greatly aids in filtering out noise -- more on that in a bit.

The iPhone's magnetometer is reported to be sensitive to changes as small as 0.1 microteslas.  That is 100 nanoteslas (gammas). This means that the differences detected have to be pretty large, but also that it is not too far off from where we want to be.  It can report values as fast as once per 0.01 seconds.

To check out how the iPhone might work, I wrote a quick app that polls the magnetometer.  For simplicity, I also had it poll the GPS for locational information. I say simplicity since this has a number of consequences.  One the one hand one gets X and Y locations for each magnetic value.  One the other hand, the rate of update is slowed to one reading per second - which seems to be about the limit of the iPhone for producing locational values. I'll have to check on this though.  Using the iPhone GPS also introduces locational error since the phone is a pretty basic GPS w/ 2-5 meter error (at least).  The app creates a text file with the three values -- X, Y, and mag.  Oh, and for the mag value, I calculated the overall magnitude of the field at each position.  This is because the built in magnetometer actually returns values in 3 dimensions (x,y,z) which is cool, but means that small shifts in the orientation of the iPhone will be detected.  To calculate the overall magnitude, I simply stored the  sqr(x^2 + y^2 + z^2).

A more elaborate app would probably include a couple of features -- first, it would have one define transects in some systematic way and then have a way of marking the beginning and ending of the transects in the file.  Second there would be some way of placing markers in the file for indicating intervals.  These two bits of data would be useful for stretching the values for each transect in an fashion that would best represent the survey.  This might even not use GPS at all (though one would then have to layout and map a grid, and then georeference that later).  One might also make use of 2 iPhones to create a gradiometer -- or even take an Arduino Uno ($50) and 2 magnetometer sensors (maybe something like this or http://microcontrollershop.com/product_info.php?products_id=4565 -- $15/each) to construct a mini-gradiometer(space the sensors about 1 meter apart with one close to the ground and one at waist level).   For kicks, maybe add a gps -- http://microcontrollershop.com/product_info.php?products_id=2768 ($60) at the same time and some kind of analog input for adding markers ) Add this for data logging:http://microcontrollershop.com/product_info.php?products_id=4526 ($25.00). One could make a pretty slick little measurement device and data logger for doing mag/gradiometer surveys for under $200. Add in additional mag sensors to create an "array" and one can get pretty serious.

But there is still a concern -- is the basic magnetometer sensitive enough to changes subsurface changes in composition?  With my quick iPhone app, I did a quick survey in the park across from my house. This was a number of transects (up and down) that were done perpendicular to the curb of the circular park.  I uploaded the data into Surfer to and then added the file into QGIS so I could have the output georeferenced over a satellite image.  Below is what I ended up with.  In the image dark colors are low magnetic values, white colors are higher values.




-- It was certainly fast and cheap. The quick app worked with minimal pain.

-- The data definitely characterizes the curb edge of the park.

-- There may be other subsurface structures as apparent from the data.



-- The one-second update rate for the location is a bit slow for getting mag points. A dedicated gps card (as described above) would be a huge advantage as these cards can usually produce location at 5-20Hz.  With the mag producing values at 0.01 seconds, you would have far more dense data to produce a map.

-- I'm not sure why the other structures are apparent in the data.  These are possibly due to subsurface pipes and whatnot. The lack of even data points across the survey area, however, is probably most likely to blame.  I didn't mark out my transects ahead of time (which is always a good idea) so I know I didn't walk in straight parallel lines.  An interface on the app might provide "steering" to keep on on a transect - that would help.  Also, having markers would enable one to ensure the data are distributed correctly across each transect (provided motion was constant).  Combining both the gps data (direction, speed, location) with some kind of marker system for end/middle/beginning of lines would probably provide a low-cost but reasonably reliable solution.

GPS Precision

It would be great to be able to post-process the GPS data to correct them for atmospheric error and reduce the uncertainty. There have been some successes in doing post processing of consumer grade gps units.  Most notably, garmin gps units can be coaxed into producing pseudo-range and carrier phase data (see:http://www.fig.net/pub/cairo/papers/ts_03/ts03_02_schwieger_glaser.pdf http://gpsinformation.info/harris/gpspostprocessing.html http://www.gps-forums.net/impressive-resolution-garmin-etrex-gps-using-gringo-t35448.html). The 12-Channel Lassen IQ receiver (http://www.sparkfun.com/products/163) ($50.00) might be just the thing as it produces RTCM output in addition to standard protocols. Some thing to look into, for certain. Additional discussion of the Lassen IQ is here: http://forum.sparkfun.com/viewtopic.php?t=809. Actually, that should be possible according to the reference manual. http://www.sparkfun.com/datasheets/GPS/Lassen%20iQ_Reference%20Manual.pdf.  The TSIP protocol can be set to output raw measurements and raw pseudo ranges (though the default is off). See page 112 for the TSIP protocol. This could mean a really cheap post-processing capable GPS!  Sweet.

This project - Kinematic -- has done much of the research -- but seems to be dead. http://web.archive.org/web/20090202200458/http://www.precision-gps.org/ It suggests that the Lassen is capable of producing 20-50cm precision since it lacks carrier wave information. Hell, that would be awesome.