Close

GY-271 Compass Module

A project log for Ariadne Headband

Arduino-based heaband that uses haptic feedback to navigate blind people. Controlled via Bluetooth using Android app.

tomas-kosicekTomas Kosicek 08/26/2018 at 21:270 Comments

Compass module is probably the most important part of the headband. Without it we would not be able to determine azimuth and therefore navigation would be impossible. We went with GY-271 compass module mainly because it was locally available and we could get it in short time. After initial difficulties with getting data from the module we found out that module we got is equipped with QMC5883L IC instead of HMC5883L which we expected. Main difference between these two are different addresses of I2C and registers.

After sorting this out we started printing data on serial monitor and noticed that something isn’t right. To have a better idea of the output data we decided to plot it into graphs using Python as you can see on the image above.

Because it is a three axis compass, points are plotted into three planes, in the first column all three planes are shown overlapping and then each plane separately. In the first row are plotted unchanged data from the compass module. As you can clearly see points are forming a circle which center isn't same as zero in the graph. The reason is that values have some offset that makes calculating correct azimuth from these values impossible.

To get rid of the offset a calibration is needed. It's done by rotating compass ideally in every possible direction and looking for maximum and minimum values for each axis. After calibration is done maximum and minimum values are saved (in present version of software it's not fully functional) and then values read from compass are modified such that there is almost no offset.

Corrected values are shown in Graph in the second row, as you can see it's much better. Azimuth calculated from these corrected values is quite accurate. Problem is when two axis from whose azimuth is calculated aren't horizontal, if compass module is tilted on side azimuth changes. We plan to address this problem in future by using compass module with accelerometer and then compensate the tilt.


Discussions