Site icon 14core.com

Wiring the MPU 6050 Sensor Mems Accelerometer GYRO

The MPU 6050 sensor board contains a MEMS ACCELEROMETER and MEMS GYRO a single chip that provide a very accurate data, as it contains 16bits analog to digital conversion hardware for each channel that captures the X, Y, and Z channel at the same time. The board sensor uses i2c Bus interface that you can just hookup to the microcontroller specially while working in Arduino board.

The MPU 6050 combines both an accelerometer and a gyro together in one single chip. There two type of MPU version there is 6050 and 9150 that has a MAGNETOMETER (Compass) integrate to chip. On this illustration we will cover only the MPU 6050 without using the magnetometer.
Getting the raw values for the accelerometer and the gyro is quite easy. The sleep mode has to be disable and then the registers for the accelerometer and gyro can be read. The sensor also contains 1025 bytes FIFO buffer that can be programmed to be place into FIFO buffer and the buffer can be ready by the microcontroller.
The FIFO buffer is used together with the interrupt signal if the MPU 6050 places a data into the FIFO buffer it send signals to the microcontroller with the interrupt signal. The microcontroller knows that there is a data coming from FIFO buffer that ready to be read.

The MPU 6050 always acts as a slave to the Arduino with the SDA and SCL pins connected to i2c BUS. The board has also its own i2c controller to be a master on a second sub i2c bus. It uses the pins AUX_DA and AUX_CL for the second sub i2c BUS you can control the magnetometer and the values of the magnetometer can be passed into the microcontroller.

The sensor has a Digital Motion Processor (DMP) or Digital Motion Processing Unit these DMP can be programmed with firmware and can do a complex calculation with the sensor values.

The Digital Motion Processor can calculate directly to the chip at this state the load reduce for the microcontroller. The DMP can even do a calculations with the sensor values of another chip, for example if the magnetometer connected to the second i2c Bus.

Using Multiple Sensor

At the MPU6050 board Pin ADO select between i2C address 0x68 and 0x69 that makes it possible to have two of these sensors in a project most breakout boards have a pullup or pulldown resistor to make ADO default LOW or HIGH, you just need to connect the ADO to GND or 3.3v for the other i2C address.

Wiring one or more board MPU6050 are needed to implement this project the i2C bus can be extended with CD74HC4067 De-multiplexer breakout board.

Wiring Diagram with Arduino

MPU 6050 Code


[crayon-674004337684e431018772/]
While using one or two MPU6050 by connecting each of the AD0 pins to a separate output of the microcontroller if the number of pins is a problem then a shift register or port expanded can be used.

The output of a 5v Arduino MCU cannot be used, you need to used shift register or a voltage divider for 3.3v on each output. The 5v output pins can also be converted in 3.3v open collector outputs by using transistors or an open collector driver. Note pullup resistor to 3.3v should be added for a high level of 3.3v.

To visualize the 3D model in processing first you have to upload the Arduino code for MPU you need to uncomment the code in MPU6050 code.

#define OUTPUT_READABLE_YAWPITCHROLL //<=== uncomment

To visualize the 3D model, you need to download  & install the  Processing IDE here.

Open processing then file > open and then navigate to the folder where you had installed the MPU6050 library for Arduino you can find the processing example in MPU6050 example

In this code you have to then check the serial port which is defined in it, by default the line that defines if you using Linux or Mac.

Visualizing with Processing





Downloads

Download MPU6050 Code Libraries | Zip
Download MPU 6050 Datasheet | Pdf

 

 

Wiring the MPU 6050 Sensor Mems Accelerometer GYRO
Exit mobile version