This article has an insufficient reference list. Please help by adding the appropriate references to this article, especially if you were involved in writing it!
This article needs to be cleaned up to conform to a higher standard of quality. Please help SensorWiki by editing this page.



Magnetometers are devices that measure the strength and/or direction of a magnetic field. Because magnetic fields are defined by containing both a strength and direction (vector fields), magnetometers that measure just the strength or direction are called scalar magnetometers, while those that measure both are called vector magnetometers. Today, both scalar and vector magnetometers are commonly found in consumer electronics, such as tablets and cellular devices. In most cases, magnetometers are used to obtain directional information in three dimensions by being paired with accelerometers and gyroscopes. This device is called an inertial measurement unit, or IMU.


A compass is a navigational instrument which is sensitive to the magnetic field of the earth. A typical compass has a magnetic strip which aligns itself with magnetic north, and from this, orientation can be determined. Thus, because a compass is used to determine just the direction of a magnetic field, they are considered scalar magnetometers.

A digital compass is not free to move the same way that an analogue compass is, as it is typically fixed to a circuit board. Consequently, an output corresponds to the orientation of a specific reference point of the compass.

The CMPS03 digital compass output data is acessible in two manners. First is as a digital query, conducted in the same manner as an EPROM query. To read the compass output this way, pins 2 and 3 can be connect to a micro- processor for a direct digital reading. The second manner is as a pulse width modulated (PWM) signal. If the PWM signal is to be used, pins 2 and 3 should be pulled to 5 volts with 47K pull up resistors. The purpose of a pull up resistor is to establish a default value on a pin if it is not to be used.

The PWM signal is output on pin 4. The bearing of the device in degrees corresponds to milliseconds the output is high, minus 1. The output thus will be high from 1ms (0 degrees) to 36.99 ms (359.9 degrees). Following this, the signal goes low unconditionally for 65ms.

The output of the PWM signal can be easily interpreted by the BASIC stamp microprocessor. The BASIC stamp contains a function pulsin in which returns the number of stamp time steps the input signal is high. The stamp time step is fixed, thus the value returned by pulsin may be scaled to determine the number of milliseconds the pulse is high. The time step for a 2SX basic stamp is 8 microseconds, fast enough to deliver the necessary time resolution. The digital compass is the final navigational electronic sensor. Together with the accelerometer and gyroscope a complete navigational sensing system can be constructed.

Other scalar magnetometers

Besides the compass, scalar magnetometers can exist in several other forms, using a variety of techniques to obtain information on a magnetic field.

Among these alternative methods include the proton magnetometer, which measures the resonance frequency of protons in a given magnetic field. This is achieved by moving an electric current through a solenoid submerged in a hydrocarbon liquid. This field has properties which can be specifically calibrated and measured. Therefore, the presence of an external magnetic field can detected by measuring the disruptions in the known field produced by the magnetometer. Proton magnetometers are generally used in geology and archeology studies.


Devantech CMPS03 Sources
Description Robot Compass Module Acroname US$ 51.00
Datasheet datasheet

Notes Uses Philips KMZ51 magnetic field sensor.

Honeywell HMC6352 Sources
Description 2-Axis Digital Integrated Compass On-A-Chip Digikey CAN$ 60.18
Datasheet pdf



Precision Navigation Inc. Vector 2X Sources
Description Low-cost, 2-axis compass module Jameco US$ 49.95
Datasheet pdf




Digital Compass board