I encountered two problems in trying to get the field camera sensitive enough to accurately measure the Earth's magnetic field.

Sensor Calibration

The sensors do not accurately read zero when they are not exposed to any field: there's a lingering measurement, which might be due to inaccurate sensor construction, or might be due to real magnetic fields created by the parts of the field camera itself. Each sensor is different. This residual "zero field" readings must be subtracted out to give an accurate measurement. To do this, I wrote a calibration program that measures this zero offset and prints the zero offset values to the serial port. Conveniently, it prints them in C++ array definition format, so they can be copy-and-pasted into the main code.

Here's how the calibration process works. Once the calibration program is started, the user holds the camera far from any metal objects and presses the "begin" button on the touchscreen. They then rotate the device 90 degrees every 10 seconds, so that it spends equal time in each orientation. They then flip the camera over so its screen is facing the floor and continue rotating every 10 seconds. After 80 seconds, the camera has spent an equal amount of time with its sensors facing in the positive and negative X,Y, and Z directions, so any contribution from the Earth's magnetic field or nearby magnetic objects should cancel out, but the instrumental zero offset will not.

The calibration program calculates an average of the measured fields during this process, and prints it to the serial port.

More elaborate calibration is possible. For instance, due to soldering errors, the TMAG sensors are not perfectly aligned to the board. (I got them as close as possible, but not perfect.) I could immerse the camera in a strong, uniform magnetic field such as that created by a Helmholtz coil, measure the off-axis fields detected by the misaligned magnetometers, and use that data to build a rotation matrix that would give the "true" field. The same calibration program could be used for this. However, I didn't have time to complete this task, and it's not necessary for a qualitative demonstration device.

Elimination of Ferromagnetic Parts

Iron and steel components will focus and amplify external magnetic fields. Even worse, they exhibit hysteresis, in which they retain permanent magnetism even after the magnetic source is removed. Any steel parts in the device can become magnetized, disrupting measurement of the Earth's magnetic field. This was a real problem! In particular, the TFT LCD display has a "convenient" SD card reader built-in, which has a steel body. The magnetometers nearest to the SD card readers showed noticeable field deviations and hysteresis.

To solve this problem, I carefully de-soldered the SD card reader, since it's not needed for this project. This greatly improved the repeatability and uniformity of the measurements. I also used non-ferromagnetic stainless steel screws to hold the field camera together. This had a less noticeable impact, since these screws are farther from the sensors. The only remaining steel part in the field camera is the USB port, which is small, quite far from the sensors, and not really replaceable.