Tag Archives: Accelerometers

Using Arduino to Calculate Roll and Pitch from MPU6050 3-axis Accelerometers

In this video lesson we show you how to take the calibrated accelerometer data from the MPU6050 and use it to calculate the tilt of the board. We can calculate tilt in two axis, or the roll and the pitch. This is the schematic for the project:

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

This is the code we developed in the video to calculate the roll and pitch from the three axis accelerometer data.

 

Using Arduino to Calibrate the MPU6050 Accelerometers

In this video lesson we show you how to calibrate the accelerometers on the MPU6050. You will have to find the min and max accelerometer numbers for your particular board, but I show you how in the video. Below, we show the schematic of how our circuit is connected.

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

In the lesson we developed the following code. Measure your min and max values of the three accelerometers according to the instructions in the video. Then enter those numbers in the code below, and un-comment out the commented lines. If you run the code as-is below, it should work, but the results will be uncalibrated and not as accurate as possible.

 

Measure 3 Axis Acceleration on an Arduino with the MPU6050 IMU

In this video tutorial we show how the MPU6050 can be used to measure acceleration in the x, y, and z directions, that is, Ax, Ay, and Az. We also introduce the idea of plotting the data to the Arduino Serial Plotter to make visualization of the data easier.

Below is the schematic we are using to access the MPU6050 on the GY-87 module.

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

Below is the code which we developed in the lesson to measure acceleration in all three axis.

 

Schematic for Tilt Meter Using the MPU6050

Below we show the detailed schematic we use for the Tilt Meter we are developing based on the MPU6050 IMU sensor.

MPU 6050
Schematic for Creating a Tilt Meter

This is the simple code for measuring acceleration in the x and y axis. We will develop this much further in future lessons, but this is just to verify things are hooked up correctly, and that we can measure accelleration.

 

9-Axis IMU LESSON 3: Understanding How Accelerometers Work

Accelerometer
This photo shows a conceptual schematic of how an accelerometer works.

In this lesson we describe how the acceleromters on chips like the Adafruit BNO055 work. They work based on microscopic masses suspended on springs on the chip. As the chip moves, the suspended masses respond to the motion, and the gaps between the suspended masses and the substrate changes. The chips detect these changes in position by monitoring the capacitance between the suspended mass and the substrate, or between the suspended masses and carefully designed interdigitated fingers between the mass and the substrate. C=eA/d, e is the dielectric constant of the material, A is the area of the capacitor, and d is the gap between the two capacitor plates. Changes in measured capacitance come from either a change in A or a change in d. Both d and A change in response to motion, so by monitoring the capacitance of the suspended mass, acceleration can be inferred. The video below explains clearly how this works.

Code for Getting Raw Acceleration Data from the BNO055 9-axis Inertial Measurement Sensor.

The code below is for demo purposes only, and should not be used in any real applications. It just demonstrates how to work with this sensor in benchtop presentations.