iMX233-OLinuXino I2C tutorial – using MOD-MAG 3 axes magnetometer


MAG3110 is interesting little device, it’s preciese 3 axis magnetometer which measure the magnetic field in range +- 1000 uT and have sensitivity of 0.1 uT.

MAG3110 is manufactured by Freescale and you can find the datasheets here.

MOD-MAG UEXT module contain MAG3110 and connects directly to all our boards with UEXT connector. MOD-MAG user manual is here.

Magnetometers are widely used by treasure hunters to scan geo magnetic field and make maps. Why? because metals in earth change the earths magnetic field and scanning the magnetic field you can see what is under the surface.

Typical magnetometer maps is like this you can see different magnetic levels colored in different colors.

MOD-MAG.c demo code is available on GitHub .

Before you use it make sure your board is with hardware I2C enabled as I explained in my previous post:

Once you download it you can compile and make executable:

$ cc MOD-MAG.c -o mod-mag
$ chmod +x mod-mag

then when you execute it you will see MAG3110 registers:

$ ./mod-mag

Register[0x00]: 0xFF
Register[0x01]: 0x0B
Register[0x02]: 0x59
Register[0x03]: 0xF5
Register[0x04]: 0xDC
Register[0x05]: 0x02
Register[0x06]: 0x85
Register[0x07]: 0xC4
Register[0x08]: 0x02

these 9 registers actually contain X,Y,Z values x2 bytes per axe

by approaching magnet to MOD-MAG you can see how these values are changing, now all you have to do is to scan some surface and find a good way to visualize the captured info 🙂

2 Comments (+add yours?)

  1. Tac_Evaworcim
    Sep 28, 2012 @ 02:13:47

    Nice sensor 🙂
    What is the typical distance to a small neodium magnet it can measure well? Say ~10º positioning?


  2. John
    Nov 24, 2012 @ 18:41:29

    Why don’t you try to merge magnetometer + accelerometer + gyroscope and make a 9DOF IMU? I think you can make it cheaper tha the ones selled by sparkfun


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: