Understanding Smart Phone Sensor Performance: Magnetometer

One of the most common questions we hear from mobile applications developers is, “how good are the sensors on my phone?”  This article is part of a series that provides a framework to understand sensor performance.

This series has previously touched upon the importance of system architecture and intelligent algorithms in providing optimal sensor performance in a smartphone or a tablet.  To complete the discussion of the sensor system, platform designers also need to select good sensor components.  This article uses the magnetometer to highlight the impact of these three factors.

The magnetometer is commonly found on mobile devices such as smart phones and tablets, but it is one of the most difficult sensors to interpret.  It is commonly called a compass since it measures the strength of the magnetic field in three dimensions, but does not necessarily point north.  In fact magnetic interference can cause it to behave unpredictably, as often seen in augmented reality apps.

In an environment free of magnetic interference, the magnetometer measures Earth’s magnetic field which combined with gravity (measured by an accelerometer) can be used to determine the 3-dimensional orientation in which the phone is being held.  The cardinal directions with respect to any orientation of the device can then be determined and used to display contextual information, such as tracking the nearest subway stations as a phone is moved around.  If the phone also knows its rough geographical location, a compass app can translate magnetic north into true north.

The figure above shows the power spectral density (PSD) of two stationary magnetometers measuring the same ambient magnetic field.  Yet, their results look different in many ways:

  • The two sensors have different noise floors (sensitivities).
  • The maximum measurable frequency for magnetometer A is 25 Hz but for B is 50 Hz.
  • The shape of the PSD is completely different.  The spectrum from Magnetometer A shows a 3.3 Hz ripple.  The spectrum from Magnetometer B is largely flat (as expected for white noise).

Differences in sensor physics account for the noise disparity.  Magnetometer A is a Hall effect sensor, a transducer that varies its output voltage in response to changing magnetic fields.  Hall effect sensors are inexpensive to make but consume higher power and provide less precision than many alternative sensing technologies.  Magnetometer B is an anisotropic magneto-resistive (AMR) sensor.  AMR sensors use a thin film of ferromagnetic alloy that changes resistance according to an ambient magnetic field.  They offer better accuracy, higher bandwidth, and more temperature stability than Hall effect sensors.

The PSD plot for Magnetometer A shows noise density envelope higher than -65 dB at 5Hz.  In contrast, the noise density for Magnetometer B is around -80dB.  Since human movements occur at low frequencies, noise spectral density below 10 Hz is an important performance determinant.  Higher noise power will interfere with the sensors ability to detect small changes, or fine movements.  Furthermore, filtering or averaging to reduce noise limits the utility of the sensors: a point we shall discuss later in this article.

Second, the upper limits of the PSD plots reflect the sampling rate used for each sensor.  Magnetometer A is sampled at 50 Hz while Magnetometer B is sampled at 100 Hz.  Higher sampling rates can improve filter and algorithm responsiveness but could also consume more power.  An optimal system design should include an intelligent resource manager that throttles sampling rate based on application demand to conserve system battery life.

Third, the ripple in Magnetometer A’s spectrum is the result of an averaging filter.  Apparently, to reduce the effect of sensor noise, each data point provided by the sensor is actually a running average of the current raw sample and the 14 preceding raw samples.  This results in a low passed signal that erodes motion data faster than 3.3 Hz and makes Magnetometer A poorly suited to measure user movements.  As Magnetometer A is commonly used in many smartphone models, this averaging filter contributed to the erroneous conception that magnetometer has low bandwidth.

Indeed, the spectrum for Magnetometer B is largely flat.  It suggests that the sensor data has not been artificially altered in any way and high frequency response has not been compromised.  Incidentally, the peaks at 20 and 40 Hz are the aliases of the first and third harmonic of the magnetic field created by 60Hz A/C currents (in the United States).

So far, we have focused on the noise and bandwidth of the magnetometer measurements.  However, even with the cleanest sensor data, a compass app still requires an algorithm to interpret them to find magnetic north.  Specifically, calibration is needed to remove the effects of ferromagnetic materials in a mobile device so that Earth’s magnetic field can be properly detected.  These materials include the maganese found in the battery (which constitutes hard-iron effects) and nickel found on the printed circuit boards and on component leads (which constitute soft-iron effects).  The magnetic alignment of these materials change when exposed to external magnetic fields, such as electro-magnetic field of a refrigerator motor or the permanent magnet on the buckle of a smartphone holster.  Many smartphones in production today, feature inferior calibration algorithms that can be confused by external magnetic fields and lose their compass heading (video link).

In summary, this article has illustrated some of the key sensor system considerations to create a useful compass app.  Good sensor performance relies on proper designs in three aspects: sensor component selection, sensor system architecture, and intelligent sensor algorithms.  Failure in any one will compromise the utility of the sensor.

On July 11th 2014, Audience completed the acquisition of Sensor Platforms. Audience believes the combination of its Advanced Voice and Multisensory Processing with Sensor Platforms’ technology places the combined company in a unique position to deliver compelling solutions based on the fusion of voice and motion.

Multisensory user interface with context awareness will bring fresh differentiation and end-user value to the market for smartphones, wearables and other mobile devices. Sensor Platforms has developed key technologies and software infrastructure in this space, and the combination of our engineering teams will enable us to rapidly scale our capabilities in context awareness-based user interface.

Audience welcomes the Sensor Platforms team and thanks all of its partners for their continued support during this transition.