From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

Invensense MPU6050 - Accelerometer and Gyro - LabVIEW API

Title:

Invensense MPU6050 - Accelerometer and Gyro - LabVIEW API

 

LabVIEW Version:

LabVIEW 2013 Student Edition

 

Description:

MPU6050 is an accelerometer and gyro sensor.

MPU6050 uses I2C protocol to transfer uncalibrated data from internal memory registers.

Read the Invensense MPU6050 datasheet included in the code for more information and specifications.


Instructions on how to use Code:

Open
Create a new I2C Reference for MPU6050 sensor. Set the I2C configuration and address.  The two address available for this type of sensor are 0x68 (default) and 0x69 (alternative). Data speed of 400kbps is suggested.

Config
Set the basic configuration of the MPU6050. Using Acc&Gyro config is possible to set the sensor sensibility.

Start
Transitions the sensor from sleep to running state to begin the measurement.

Read
Reads 14 bytes RAW data in burst mode from sensor registers. The data must be calibrated using the library's RAW converters. The first six bytes are Axis X Acc (16bit), Axis Y Acc (16bit) and Axis Z Acc (16bit). The seventh and eighth byte are Temperature (16bit). Nineth to fifteenth bytes are Axis X Gyro (16bit), Axis Y Gyro (16bit) and Axis Z Gyro (16bit).

Stop
Stops the measurement and set the sensor in sleep mode.

Close
Clears the sensor reference. Before clearing, this VI can abort the measurement, if necessary, and releases any resources the reference reserved.

RawToTemp
Convert Raw Data in Temperature [°C]

RawToAcc
Convert Raw Data in Acceleration [g]

RawToGyro
Convert Raw Data in Rotational Speed [°/s]

WriteRegister
Write a desired value in a specific register allocation. Data must be a 2D Array where values of the first column are addresses related to the respective values in the second column.

ReadRegister
Read a desired register allocation. Burst mode is availabe using values of <B> Byte to Read </B> bigger than 1.

 

Attached Code

 

TestVI.PNG

 

TestVI_BD.PNG

 

Project_Tree.PNG

Comments
KoenvE
Member
Member
on

I am really new to Labview. 

My project incorporates controlling the speeds of an stepper motor using measurements from an MPU6050..

I currently have a program to run the stepper motor which works. Till now however I was not able to get useful measurements from the MPU6050. This program would fit perfectly, however I can't get it working. 

Can somebody please elaborate on the first step: "Open
Create a new I2C Reference for MPU6050 sensor. Set the I2C configuration and address.  The two address available for this type of sensor are 0x68 (default) and 0x69 (alternative). Data speed of 400kbps is suggested."

 

Many thanks

Contributors