New Product Announcement – Pmod CMPS2

Pmod CMPS2: 3-axis digital compass.

Announcing the addition of the Pmod CMPS2 to the Pmod sensor family!


The Digilent Pmod CMPS2 is a 3-axis anisotropic magneto-resistive sensor, AKA a digital compass. With Memsic’s MMC34160PJ, the local magnetic field strength can be measured in a ±16 Gauss range, with a heading accuracy of 1° and up to 0.5 mG of resolution. Exposure to strong external magnets can change the characteristics of the sensor, but luckily there is an integrated SET/RESET function that can be performed each measurement or periodically as desired, to combat this. The RESET function also compensates for error due to Null Field output change with temperature.

Pmod CMPS2 plugged into Pmod host port on Digilent system board.

While communicating with the host board via the I²C protocol, users can measure the ±16 G field surrounding the device. The Pmod CMPS2 is one of our first modules designed to follow the updated Digilent Pmod Interface Specification 1.1.0. This new specification requires that all I2C Pmods conform to the 6-pin form factor for improved physical connection to Pmod host ports on Digilent system boards (see image left). For an overview of the differences between the new and old spec, see this blog post .

How does it work?

The Pmod CMPS2 communicates with the host board via the I²C protocol. By first sending the 7-bit I²C device address of 0110000 and then a read/write bit (high/low logic level, respectively), followed by the register address of interest at a maximum clock frequency of 400 kHz, users can both configure and read from the Pmod CMPS2. An additional female header, header J2 on the image below, is provided so that users may daisy chain the Pmod CMPS2, allowing for control of multiple devices on the same I2C bus. In order to daisy chain, the jumpers on JP1 must be disconnected.

As with any magnetometer, the Pmod CMPS2 will have to be calibrated. To calibrate the magnetometer, the offset associated with the magnetic sensors and the environment needs to be calculated and removed from future measurements. Follow the calibration section of our reference manual to learn how to do this.


The MEMSIC MMC34160PJ is good for any project where sensing the Earth’s magnetic field is desired. This includes any GPS navigation and position sensing.

The Pmod CMPS2 is designed to work with any Digilent FPGA, Zynq or MCU board. It can be plugged into any host port on a Digilent FPGA or Zynq system board. With Digilent microcontroller boards, a little more care needs to be taken to figure out which Pmod host port supports the I2C protocol. Once identified however, the Pmod CMPS2 should be easy to get up and running with any Digilent MCU board. Just follow the Quick Start section of the reference manual!

Getting Started with the Pmod CMPS2

If you are an MCU user, we’ve written some libraries and example code to illustrate how to start getting magnetometer data, and then how to convert that data into useful heading measurements. The example code was written in the Arduino IDE and should work smoothly with the Digilent core for Arduino. For download instructions, see our tutorial on how to get started with the Digilent core.

If using the Pmod CMPS2 with a Digilent FPGA board, see our wiki page titled Using Pmod IPs for instructions on how to use our Pmod CMPS2 IP Core with MicroBlaze designs.

Questions or comments? Use the comment section below or visit the Digilent Forum!

Be the 1st to vote.

Leave a Reply

Your email address will not be published. Required fields are marked *