This is a summary of the datasheet for the MicroMag3 3-axis magnetometer, available at Sparkfun.com. It was written by Daniel Soltis, February 13, 2007.


Introduction/General Description

This magnetometer is an integrated module that uses 3 magneto-inductive sensors to detect magnetic fields along 3 axes. Its most obvious uses are for magnetic field sensing and 3-dimensional orientation sensing. The module contains some features designed to reduce noise, and its intended use is in prototyping and low volume applications.

The magnetometer's field measurement range is +/-1100 uTesla (+/- 1 Gauss), with a resolution of 0.015 uT (0.00015 Gauss). For reference, the Earth's magnetic field is on the order of magnitude of 0.5 Gauss, and the magnetic field of a small bar magnet is on the order of 0.01 Tesla (100 Gauss). The strongest magnetic fields we've been able to make are in the 15-20 Tesla range. Basically, this means that this magnetometer is designed to be sensitive to small fluctuations in magnetic fields of approximately the same strength as the Earth's magnetic field--thus its intention for use as an orientation sensor.

It uses a serial peripheral interface (SPI), which is a synchronous communication between a master (presumably the microprocessor) and a slave (the magentometer) device. The specifics of the interface are explained later in the datasheet. The Arduino website contains a few tutorials on working with other items that use SPI:

EEPROM

Digital Potentiometer


Operating and Other Characteristics

The magnetometer runs on 3 Volts direct current.

The magnetometer must not receive input beyond:

  • supply voltage: 5.25 VDC (so use a 3.3V voltage regulator, not a 5V) (Actually, in a later paragraph, the datasheet suggests using a bias resistor of 75 ohm when running off of a 5 VDC power supply, so I guess that is feasible.)
  • input pin voltage of V_00 +/- 0.3 VDC. I'm not sure what V_00 means in this context.
  • input pin current of 10.0 mA at 25 degrees C
  • storage temperature of 125 degrees C (so don't put it in the oven!)

There's a table of typical and maximum module characteristics. The table is based on a setup in which the magnetometer is run at 3 VDC, with a bias resistor (I am guessing thats a resistor between the module and either the voltage supply or the ground) of 43 ohms.

  • the current that the module draws (<0.1 mA when idling, 0.4 (max 0.5) mA when operating)
  • the field measurement range (+/-1100 uT, as previously stated)
  • how closely the measurement counts reflect the actual magnetic field (0.6% error, max 1%, from a best fit straight line)
  • the operating (-20 to 70 degrees C) and storage (-40 to 125 degrees C) temperatures

More complicated characteristics include the gain, resolution, and sensor frequency. I'm not sure exactly what the sensor frequency means, but it is 175 kHz.

The gain is the change in number of counts (the units in which the sensor gives results) per change of uT in magnetic field. This can vary depending on what period the sensor is set to. Basically, the longer the period, the longer the amount of time the sensor detects the magnetic field, and the higher the counts. This means that a longer period gives a higher resolution (gain), at the expense of speed. In addition, the module sends data to the microprocessor in 16 bits, so if the period is too long, then the number will overflow those 16 bits.

The longest period that is guaranteed not to overflow the output data is 2058, which results in a gain of 31.24 and a resolution of 1/31.24. Changing the power supply voltage to 5V or changing the value of the bias resistor can change the gain.

These are several graphs that show how the magnetometer's output changes in response to the field strength. In graph 1, you can see that is it very linear up to about 500 uT, then fairly linear but with greater temperature dependance up to about 1000 uT (which is about the instrument's stated maximum range), then the output levels off and falls. On a practical level, this means that when in the presence of field strengths greater than 1000 uT, the output becomes garbage, and when in the presence of field strengths between 500 and 1000 uT, the output becomes temperature dependent (specifically, at higher temperatures, the output increases more slowly). So don't take it near magnets, and pay attention when at temperature extremes.

In the second graph, it shows that, from 0 to 300 uT, there is a consistent response over a wide range of temperatures (-25C to 90C); this is more closely examined in graph 3, which shows how much the readings vary from room temperature readings at different temperatures--the differences are within +/-50 counts, while total counts increase linearly from 0 to 12,000 from 0 to 300 uT.


How to use the SPI

Six pins are used to exchange information:

SCLK (serial clock) Used to syncronize data transfer, using a clock generated by a master device. It should be 1MHz or less. One byte of data is exchanged over 8 cock cycles (i.e., one bit for each clock cycle).

SSNOT (slave select line) This has to be set low prior to data transfer and must remain low during data transfer, and can be deselected after the magnetometer received the command byte and begins to execute the command. i guess this is part of using the protocol to control a number of peripherals?

RESET is usually low, is reset by an input of low-high-low. The reset needs to be toggled before every measurement.

MOSI (master out slave in): This is data sent from the microprocessor to the magnetometer. There are a bunch of rules for how and when to send data

DRDY (data ready) is low after a RESET, and is high when a command has been received and the data is ready. Makes sure that data is sent only when it is available. There are some workarounds in case things go awry.

MISO (master in slave out) This is the pin that sends data to the microprocessor (master). There are a bunch of rules for how it works (discussed later).

Basically, the order of operation is:

1. bring SSNOT low

2. toggle RESET low-high-low (done before every measurement)

3. send 8 bits of data on the MOSI line in synch with 8 clock cycles.

4. After receiving 8 bits, the magnetometer does its thing.

5. After doing its thing, the magnetometer sets the DRDY line to high, then shifts data out on the next 16 clock cycles through the MISO line.

6. then loop to step 2 to take more measurements, or set SSNOT high until you want the magnetometer again

The next page shows some graphs illustrating when exactly data gets sent (the rising edge of a bit of data moves with the falling edge of the clock cycle.) I partially understand this; I think its set up to make sure that you don't sample the data at a time when it is rising or falling.

One sensor (i.e., one axis) can take a measurement at a time, so taking measurements on all three axes requires three separate commands. A single sensor takes a measurement by doing something I don't understand, and returns it via 16 bits.


Bits sent over the MOSI pin

From positions 7 to 0 (and I think position 7 get sent first?? i could be wrong), they consist of:

(7) DHST: High Speed Oscillator Test -- used for debugging, kept at 0 for usual operation

(6) PS2, (5) PS1, and (4) PS0: This set of 3 bits sets the period of time being measured, from a shortest period of /32 (500 us) set by 000, to a maximum of /4096 (60 ms), set by 111.

(3) ODIR: Oscillator Direction -- is used for debugging, kept at 0 for usual operation

(2) MOT: Magnetic Oscillator test -- is used for debugging, kept at 0 for usual operation

(1) AS1 and (0) AS0: tell what axis to measure:

X axis 0 1

Y axis 1 0

Z axis 1 1


Schematic

The last page shows a schematic of the chip, with labels for the components, size measurements, and identification of the pins. The chip contains 3 magnetic sensors on three axes, a number of resistors and capatitors, and a component labeled "U1".

There are a total of 14 pins, 5 of which are not connected. Pins 1-6 are the pins used for SPI, pins 7 and 14 are ground, and pin 12 is "VDD," which I am assuming to be the supply voltage. Although the datasheet refers to a bias resistor, there's no schematic of how the magnetometer is connected in a circuit. I assume that's assumed to be trivial.


Questions I still have

What does it mean that the module should not receive more than V_00+/-0.3VDC on the input pin?

What is the meaning of sensor frequency?

What is the bias resistor?

How exactly to the sensors work?

Data is sent most significant byte first--what order is that? The same as it gets written (e.g., 10 is 3, rather than 1)?

What is U1 on the chip schematic?