Testing a Digital Compass module based on MMC2120MG magnetic sensor

Here I’m going to show you how to use a digital compass for you robot project. This can be easily used to obtain the heading of the robot and adjust the path of it. I got this module and tested it before two years ago. Here,I’m using Sure Electronics DC-SS504 module which includes a MMC2120MG magnetic sensor. Actually this module has the magnetic sensor and a PIC16F690 on-board. This PIC is used here to drive the magnetic sensor and convert it’s I2C interface to UART interface. You can get a digital compass with I2C and drive it using your own uC too. Actually I got this for UART interface and this was used to build a robot.


The compass arrived with a nice little plastic casing. I had the digital compass module and some 2.54mm connectors.



As any other digital compass (including digital compasses on mobile phones), it had to be calibrated for the place where it’s going to use. The typical 8 direction motion was required for the calibration after issuing the calibration command. You can also set the magnetic declination using the appropriate command. You can find those on the datasheet. These calibrations are easy as we use the UART interface provided by on-board uC. I also found out that if we issue the calibration command and don’t move the compass, you can measure the angle reference to that starting point. Cool!!! isn’t it ?


I tested the compass by connecting it to the Pickit2 UART tool. Pickit2 got a cool logic analyser feature and UART tool built it. These feature are really helpful when doing projects. You can build your own Pickit2 lite from my previous post.



Share on Google Plus
    Blogger Comment


Post a Comment