Tag Archives: Digital Compass

Improving Digital Compass Accuracy With a Low Pass Filter

In this video lesson we add a low pass filter to our calibration and digital compass program. This allows more precise calibration, and removes the jitter from the digital compass display. We continue to use the QMC5883L 3-Axis Magnetometer, which is on our GY-87 IMU module. We are using the following schematic for our project:

MPU6050
Schematic for connecting the GY-87 module to the Arduino

We collect the data using the GY-87 connected to an Arduino. Below is the simple program which takes the magnetometer data and sends it to the serial port.

The code for the Python side to do the calibration and display a Digital Compass is:

 

Calibrating a 3-Axis Magnetometer

In this video lesson we show you how to calibrate the QMC5883L 3-axis magnetometer. The lesson is geared toward this specific magnetometer, but the procedure will be the same for any 3-axis magnetometer. We then use the calibrated reading to measure and calculate the magnetic heading of the device. With this, we have created a calibrated digital compass. In this lesson we are using the GY-87 module, which contains the QMC5883L magnetometer. We are connecting the module to the arduino using the following schematic:

MPU6050
Schematic for connecting the GY-87 module to the Arduino

In the video we develop two programs. The first program determines your sensor’s calibration constants. Then the second program uses those calibration constants to calculate heading, or yaw. The second program uses the offsets and scale parameters for MY PARTICULAR SENSOR. These values were determined using the first program. You must determine these values for your sensor, and then edit the second program to use your particular calibration parameters.

Program to determine your calibration parameters:

Once you get your calibration parameters, then put them into this program. This program will then calculate your compass heading: