Category Archives: Arduino

Plotting X-Y-Z Magnetometer Data for Accurate Calibration

In this video lesson we create a PyQt5 Widget in Python to help calibrate the QMC5883L 3-Axis Magnetometer on the GY-87 module. The Widget plots the data coming from the Magnetometer in real time to allow more accurate calibration.

This is the circuit schematic for our project:

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

This is the simple code for the arduino to generate the raw data;

This is the code we run on the Python side to plot the raw data:

 

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:

 

Using the QMC5883L Magnetometers on the GY-87 Module

In this video lesson we activate the QMC5883L 3-axis magnetometer on our GY-87 module. We show how to read the raw magnetic field strength in the x, y, and z axis. Your homework assignment will be to then calibrate the measurements such that you center the measured values around 0, and create a unit circle. This calibration will be very similar to what we did for the accelerometers a few weeks ago. This is the schematic we continue to use in this lesson:

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

This is the code we developed in todays lesson to read the raw data from the magnetometers.

 

Improving MPU6050 IMU Arduino Project Performance with a Complimentary Filter

In this video lesson I show you how you can improve the performance of your Arduino MPU6050 IMU Project by incorporating a complimentary filter. We will combine the roll and pitch calculations from the accelerometer and gyro into a fused result which allows us to enjoy the best of both worlds.

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

For your convenience, the code developed is presented below:

 

Reducing Gyro Drift in MPU6050 IMU Arduino Project

 

In this video lesson we learn how to reduce drift in our roll, pitch, and yaw from the MPU6050 IMU Arduino Project. We will be using the following schematic in today’s work.

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

This is the code we developed in this lesson: