Tag Archives: MPU6050

Arduino Digital Compass Project with SSD1306 OLED Display

In this video lesson we add an SSD1306 OLED to our Arduino Uno R4 WiFi IMU project. The schematic we use for the project is:

OLED IMU
This schematic shows how to connect the SSD1306 OLED to our IMU Project.

The code below is the program we develop in the video. Remember, you have to use your calibration parameters in the program below. I showed you how to calibrate your  system in THIS LESSON.

 

Removing Digital Compass Glitches and Wrap Around Issues

In this video lesson we continue to improve our Arduino IMU project incorporating the GY-87 9-axis sensor module. In last weeks lesson, we had added tilt compensation to the project, so the IMU reports accurate Heading values, even if the sensor is tilted. This creates a tilt compensated digital compass. We are now getting ready to begin building graphical displays on the SSD1306 OLED display. In order to do that, we must clean up a few things on the project. First, our compass presently reports headings between +/- 180 degrees. For standard compasses, North is a heading of 0 degrees, and rotating clockwise reports increasing number, up to 359. Then the compass returns to North, as it has been rotated all the way around. The other issue we clean up in todays lesson is associated with the so called wrap around glitch. That is, if we move only two degrees, from 1 degree to 359 degrees, it is a very small physical change, but the complimentary filter sees it as a large change, and it filters that change. The practical implication of this is that the needle on the compass will take the long way around the dial when making this transition, and it creates a very awkward glitch in the display. We will show you how to solve the wrap around glitch.

This is the schematic we have been using for  this project:

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

This is the code we developed in today’s lesson. Understand, you must calibrate your sensor module, as we taught in THIS LESSON. Then you need to put those calibration values into the code below for it  to work accurately for your sensor module.

 

High Performance Roll, Pitch and Yaw values from the GY-87 IMU Module

In this video lesson I show you how to use calibrated sensors and Complimentary Filters to perform Sensor Fusion to get high performance IMU data from the GY-87 IMU module. We end up with Roll, Pitch and Yaw that is fast, accurate, low noise, and no drift. The work we do in this lesson uses the calibration data generated in last weeks lesson, if you have not completed that lesson you need to do it before proceeding here. The schematic we are using in this lesson is:

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

This is the code we developed in this weeks lesson. Note that in the callibrateSensors() function, you need to use the calibration parameters for your module (as explained in last weeks lesson).

 

 

 

Ultimate 9-axis Program for Easily and Accurately Calibrating a 9-axis IMU on Arduino

In this video lesson we show how to easily calibrate a 9-axis IMU. We are using the GY-87 IMU module which contains a MPU6050 for measuring acceleration and rotational velocity, and the QMC5883L magnetometer. In this work, we have three programs. The first is simple arduino program for measuring and printing the data from the 9 sensors. Then, the second program is a python program on your PC which will allow you to simply and accurately calibrate the 9 sensors, from the data coming from the first program. Then the third program is a program on the arduino that reads the data from the sensors, and then uses the calibration data that was generated to create accurate, calibrated sensor data.

This is the schematic of the circuit we are working with:

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

Then this is the arduino code we use to calibrate the sensors:

This next program is to be run on your PC. It is a python program that will read the data coming from the arduino, and will then help you calibrate your sensors.

Then finally we take the calibration parameters from the python program, and incorporate them on the Arduino side to allow reading the data from the sensors, and reporting calibrated numbers. Remember, in the program below, you should use your calibration parameters instead of mine. That is, edit the program below for your specific calibration numbers.

 

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: