Let's Make Robots!

dual axis magnetometer


AttachmentSize
compass.pde2.08 KB
Vendor's Description: 


I've recently bought this module and believe someone would like to use it in his/her design. This one is cheap, you can find it in the website http://www.sureelectronics.net for $4,99 though shipment costs are a little high. I bought mine in ebay for $7,99 with free shipment.

There's another version that includes the missing ic (a PIC) that enables the UART communication instead of just the i2c, maybe it's not worth it. In my opinion the board is a little large with lots of "not connected" pins as you need only 4 (Vcc, GND, SDA, SCL).

 


 

This is the description of the module.

This self-made module integrates a dual-axis magnetic sensor called MMC212xMG by using its own I 2 c interface. This RoHS-compliant sensor consumes as low as 0.4mA@3V with 50 measurements per second. Its full integration of 2-axis magnetic sensors and electronic circuits resulting in less external components needed. The miniaturized size makes it ideal for a variety of applications like electronic compass, GPS navigation, position sensing etc.

 


 

In sureelectronics.net you can find the datasheet of the module and also 4 application notes.

Calibration is a must if you want to get useful data. Just rotate 360º the module and get the max and min values for 'x' and 'y' axis and use the formulas given in the app note.

 

Note: the i2c commands given in the datasheet don't work for me. The 'x' and 'y' data where shifted one byte. Thanks to one guy in the arduino forum that was using the module that tried it and worked ¿?

 

 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The code I tried is there compass.pde. Dealing with the i2c in arduino is a bit tricky, remember to shift right one place the address. But I think your module is running as you can find the north.

It's better to use atan2 function instead of just atan, also when calibrating rotate it in the three axis. The calibration process is just to get the max and min values, so it doesn't mind whether you're rotating flat and parallel to the ground or take it in your hand and move it.

 

trying now, thank you

i have also tried it and used the code from the arduino forum + max and min values, but with no success, i can only find north.

can you upload the code if you manage to get it to work? thank you

PS: when calibrating, did you rotate it on all axes, or only flat and parallel to the ground?