IQRF + 3-Axis Digital Compass HMC5883L

doit 007

This demo application shows how to do simple wireless digital compass. We used a 3rd party compass module with HMC5883L sensor. The Compass Module is designed for low-field magnetic sensing with a I2C interface, to provide heading information for your microcontroller wireless project.

Key Features:

  • Wireless magnetic sensor – compass
  • Measures Earth’s magnetic fields
  • Precision in-axis sensitivity and linearity

In this example, compass data are transmitted via I2C to the IQRF TR module. This module retransmit them via RF to another module…  We used HMC sensor mounted on simple development board GY-273. There are all required components, like pull-ups, capacitors, linear regulator and so on. Following picture shows wiring which we used.


Value from compass is readded every 500ms (by TR module), and then sent via RF to next module for another processing. As the second module, you can use TR module inside CK-USB-04 or you can use UART breakout board published before. In case, you would use CK-USB-04, the simplest way is E03-TR example usage, which resend received data to the IQRF IDE. There is packet format:


  • C – identification byte
  • XX – X data
  • YY – Y data
  • ZZ – Z data

In all 16 bit word is stored 12 bit value, which represents field strength.

Full source code is in attachment.

Post sent by Tomáš Novotný.

Download Attachments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.