MPU6050 application details

The MPU6050 gyroscope is used in the recent project, and I have never touched it before. Although it is easy to find the code you need online. Some functions are implemented. However, I still don't know much about the working principle of the gyroscope. Its code also needs to be analyzed, and I2C communication and related registers should also be familiar. I see that the Internet is mostly implemented on the Arduino development board, so how to implement it on the C51 microcontroller board, or how to implement it on the S5PV210? With these questions, the development of MPU6050 started.

1. Model

I took a look at the model  GY-521 MPU6050 module three-dimensional angle sensor 6DOF three-axis accelerometer electronic gyroscope


The latest chip manual and register map and description can be downloaded from the official website, see: MPU6050 official website


2. Check the chip manual

(1) Product introduction

The MPU-60X0 is the world's first integrated 6-axis MotionTracking device. It integrates a 3-axis MEMS gyroscope, a 3-axis MEMS accelerometer, and an extensible digital motion processor DMP (DigitalMotion Processor), which can be connected to a third-party digital sensor, such as a magnetometer, via the I2C interface. After expansion, it can output a 9-axis signal through its I2C or SPI interface (SPI interface is only available on MPU-6000). The MPU-60X0 can also connect non-inertial digital sensors, such as pressure sensors, through its I2C interface.
The MPU-60X0 uses three 16-bit ADCs for the gyroscope and accelerometer respectively, and converts the analog quantity measured by it into a digital quantity that can be output. In order to accurately track fast and slow motion, the measurement range of the sensor is user-controllable, the measurement range of the gyroscope is ±250, ±500, ±1000, ±2000°/second (dps), the measurement range of the accelerometer is ±2, ±4, ±8, ±16g.
An on-chip 1024-byte FIFO helps reduce system power consumption. Communication with all device registers uses 400kHz I2C interface or 1MHz SPI interface (SPI is only available for MPU-6000).  For applications requiring high-speed transfer, 20MHz SPI can be used for register read and interrupt. In addition, a temperature sensor and oscillator with only ±1% variation under operating conditions are embedded on the chip. The chip size is 4×4×0.9mm, and it adopts QFN package (leadless square package), which can withstand the impact of up to 10000g, and has a programmable low-pass filter.
Regarding power supply,  MPU-60X0 can support VDD range of 2.5V±5%, 3.0V±5%, or 3.3V±5% . In addition, the MPU-6050 has a VLOGIC pin that provides logic levels for the I2C output. VLOGIC voltage can take 1.8±5% or VDD.

(2) Product Features

Digital output 6-axis or 9-axis rotation matrix, quaternion (quaternion), Euler angle format (EulerAngleforma) fusion calculation data.
3-axis angular velocity sensor (gyroscope) with 131 LSBs/°/sec sensitivity and full-frame sensing ranges of ±250, ±500, ±1000 and ±2000°/sec.
Programmable 3-axis accelerator with program control ranges of ±2g, ±4g, ±8g and ±16g.
Removed sensitivity between accelerometer and gyroscope axes, reducing the effect of settings and sensor drift.
Digital Motion Processing (DMP: DigitalMotion Processing) engine can reduce the load of complex fusion calculation data, sensor synchronization, posture sensing, etc. The motion processing database supports Android, Linux and Windows built-in operating time deviation and magnetic sensor calibration calculation technology, eliminating the need for customers to perform additional calibration.
Temperature sensor
with digital output Supports video electronic image stabilization technology and GPS programmable interrupt with digital input Syncpin
Support gesture recognition, panning, zooming in and out, scrolling, fast descent high-G interrupt, zero motion sensing, touch sensing, shaking sensing functions.
VDD supply voltage is 2.5V±5%, 3.0V±5%, 3.3V±5%; VDDIO is 1.8V±5%
Gyro operating current: 5mA, Gyro standby current: 5uA; Accelerator operating current: 500uA, accelerator Power saving mode current: 40uA@10Hz
up to 400kHz fast mode I2C, or up to 20MHz SPI serial host interface (serial hostinterface) The
built-in oscillator has only ±1% frequency variation over the operating temperature range. Optional external clock input 32.768kHz or 19.2MHz

(3) Instructions for use

《1》Pin output and signal description



"2" typical usage


《3》Required capacitor specifications



Little things to know:

The basic unit of capacitance is F (farad), and other units are: millifarads (mF), microfarads (uF), nanofarads (nF), and picofarads (pF).
Since the capacity of the unit F is too large, we generally see the units of μF, nF, and pF.
Conversion: 1F=1000000μF, 1μF=1000nF=1000000pF

Capacitor Specifications: Ceramic, X7R, 0.1μF ±10%, 2V What does it mean?

See: Specifications of the full range of capacitors

Ceramic

Ceramic medium

X7R

Temperature coefficient/characteristics: working temperature range -55℃~125℃ (military grade)

    Component grade mainly refers to its operating temperature range, as follows:
    Commercial grade: 0℃~+70℃
    Industrial grade: -40℃~+85℃
    Automotive grade: -40℃~125℃
    Military grade: -55℃~+125 °C

0.1μF ±10%

0.1 μF capacity, tolerance is ±10%

2V

voltage rating, which can also be used to select capacitor size

3. Circuit diagram



At this point, the hardware part is finished! !


/////////////////////////////////////////////////////////////////////

The MPU6050 is briefly introduced above, and there are many concepts that I don't understand, such as 3-axis, 6-axis, 9-axis, accelerometer, magnetic needle, DMP and so on.

It's all shit. . . what! ! I don't know how to do this, it's too hard!

With these questions, continue to read the chip manual.

I. Overview

The MPU-60X0 consists of the following key blocks and functions:

1. 3-axis MEMS rate gyroscope sensor
with 16-bit ADC and signal conditioning 2. 3-axis MEMS accelerometer with 16-bit ADC and signal conditioning
3. Digital motion processor (DMP) engine
4, main I2C and SPI ( MPU-6000 only) serial communication interface
5, auxiliary I2C serial interface for 3rd party magnetometer and other sensors
6, clock
7, sensor data register
8, FIFO
9, interrupt
10, digital output temperature sensor
11, gyroscope and accelerometer self-test
12, bias and LDO
13, charge pump

Its system structure diagram:


Let's start watching them one by one.

2. Three-axis MEMS gyroscope with 16-bit ADC and signal conditioning

The MPU-60X0 consists of three independent vibrating MEMS rate gyroscopes that detect rotation angles X-axis, Y-axis and Z-axis . When the gyroscope rotates around any sensing axis, the Coriolis effect produces vibrations detected by the capacitive sensor.  The resulting signal is amplified, demodulated and filtered to produce a voltage proportional to the angular velocity. This voltage is sampled for each axis using a separate on-chip digitized 16-bit analog-to-digital converter (ADC).  The gyro sensor can be digitally programmed to ±250, ±500, ±1000 or ±2000 degrees per second (dps) over a full range.  The ADC sample rate is programmable from 8,000 samples per second to 3.9 samples per second, and a user-selectable low-pass filter enables a wide range of cutoff frequencies.

3. Three -axis MEMS accelerometer with 16-bit ADC and signal conditioning

The MPU-60X0's 3-axis accelerometer uses a separate proof mass for each axis.  Acceleration induces a displacement in the corresponding proof mass along a particular axis, and the capacitive sensor detects this displacement as a difference in displacement. The architecture of the MPU-60X0 reduces accelerometer sensitivity to manufacturing variations as well as thermal drift. When the device is placed on a flat surface, the measurements will be 0g on the X and Y axis and +1g on the Z axis.  The scale factor of the accelerometer is calibrated at the factory and is nominally independent of the supply voltage. Each sensor has a dedicated sigma-delta ADC to provide the digital output. The full-scale range of the digital output can be adjusted to ±2g, ±4g, ±8g or ±16g.

4. Digital Motion Processor (DMP)

An embedded Digital Motion Processor (DMP) resides inside the MPU-60X0, which offloads motion processing algorithms from the host processor.  DMP acquires and processes data from accelerometers, gyroscopes, and other third-party sensors such as magnetometers. The resulting data can be read from the DMP's registers, or it can be buffered in a FIFO. The DMP has access to one of the MPU's external pins, which can be used to generate interrupts.
The purpose of DMP is to offload the timing requirements and processing power of the host processor. Generally, motion processing algorithms should run at high speed, usually around 200Hz, to provide accurate results with low latency. This is required even if the application is updated at a lower rate. For example, a low-powered UI might update at 5Hz, but motion processing should still run at 200Hz. DMP can be used as a tool to minimize power consumption, simplify timing, simplify software architecture, and save valuable MIPS on the host processor for use in applications.

Five, the main I2C and SPI serial communication interface

The MPU-60X0 uses  SPI (MPU-6000 only) or  I2C serial communication to the system processor interface . The MPU-60X0 always acts as a slave device when communicating with the system processor .  The address of the I2C slave address of the LSB is set by pin 9 (AD0) (generally grounded).
The logic levels for communication between the MPU-60X0 and its host are as follows:
    MPU-6000: The logic level for communication with the host is set by the voltage on VDD
    MPU-6050: The logic level for communication with the host is set by the voltage on VLOGIC

6. Auxiliary I2C serial interface

The MPU-60X0 has an auxiliary I2C bus for communicating with off-chip 3-axis digital output magnetometers or other sensors

Two working modes:

I2C Master Mode, at this time MPU-60X0 is used as the master device to communicate with the external sensor; 

Pass-Through Mode, which is only used as a connection at this time, allows the MPU and external sensors to communicate with the chip at the same time.

Since I did not use a magnetic needle, this part will not be discussed in detail.


Here it is clear:

GY-521MPU6050 is a three-dimensional angle sensor , which is the world's first motion processing component integrated with a six-axis sensor.

The six-axis here means that it has a built-in three-axis MEMS gyroscope , a three-axis MEMS accelerometer, and a digital motion processing engine ( DMP ). It also has an auxiliary I2C serial interface for third-party digital sensor interfaces , such as when the auxiliary I2C serial interface is connected to a three-axis magnetometer , the MPU6050 can provide a full nine-axis fusion output to its main I2C port. 


The figure below shows the sensor's reference coordinate system (XYZ makes up the right-handed system) as well as the 3 measurement axes and the direction of rotation.

The positive direction of the rotation can be judged by the right-hand screw rule

        

7. Internal clock generation

The MPU-60X0 has a flexible clocking scheme that allows multiple internal or external clock sources to be used for the internal synchronization circuit. This synchronization circuit includes signal conditioning and
ADC, DMP and various control circuits and registers. The on-chip PLL provides flexibility to allow the input to generate this clock.
Allowed internal sources to generate internal clocks are:
    Internal relaxation oscillator
    Any X, Y or Z gyroscope (MEMS oscillator that varies by ±1% over temperature)
Allowed external clock sources are:
    32.768kHz square wave
    19.2MHz square The choice of the internal synchronous clock source for wave

generation depends on the availability of external sources and the requirements for power consumption and clock accuracy. These requirements will be the most likely to vary by mode of operation. For example, in a mode where power consumption is of primary concern, the user may wish to operate the MPU-60X0's digital motion processor to process accelerometer data while keeping the gyroscope off . In this case, the internal relaxation oscillator is a good clock choice. However, in another gyroscope -activated mode, selecting the gyroscope as the clock source provides a more accurate clock source . Clock accuracy is important because timing errors directly affect the distance and angle calculations performed by digital motion processors (and any processor extensions) . There are also start-up conditions to consider. When the MPU-60X0 is first powered on, the device uses its internal clock until programmed to operate from another source. This allows the user, for example, to wait for the MEMS oscillator to stabilize before being selected as the clock source.

Eight, sensor data register

The sensor data register contains the latest gyroscope, accelerometer, auxiliary sensor and temperature measurement data. They are read-only registers and can be accessed through the serial interface. The data of these registers can be read at any time. However, an interrupt function can be used to determine when new data is available.

9. FIFO

The MPU-60X0 contains a 1024-byte FIFO register accessible via the serial interface .  The FIFO configuration register determines which data is written to the FIFO . Possible choices include gyroscope data, accelerometer data, temperature readings, auxiliary sensor readings, and FSYNC inputs. The FIFO counter tracks the number of valid data bytes contained in the FIFO.  The FIFO registers support burst reads. The interrupt function can be used to determine when new data is available.

10. Interruption

The interrupt function is configured through the interrupt configuration register. Configurable items include INT pin configuration, interrupt latch and clear methods, and interrupt triggers. Items that can trigger an interrupt are:

(1) The clock generator is locked to the new reference oscillator (for switching clock sources); 

(2) New data can be read (from FIFO and data register); 

(3) Accelerometer event interrupt; 

(4) MPU-60X0 did not receive confirmation from auxiliary sensor I2C bus. 

The interrupt status can be read from the interrupt status register.

11. Digital output temperature sensor

An on-chip temperature sensor and ADC are used to measure the MPU-60X0 chip temperature. The reading from the ADC can be read from the FIFO or from the sensor data register .

12. Bias and LDO

The Bias and LDO sections generate the internal power and reference voltages and currents required by the MPU-60X0. Its two inputs are an unregulated VDD of 2.375 to 3.46V and a VLOGIC logic reference supply voltage of 1.71V to VDD (MPU-6050 only). At REGOUT, the LDO output is bypassed with a capacitor.

Thirteen, charge pump

An onboard charge pump generates the high voltages required by the MEMS oscillator. Its output is bypassed with a capacitor next to CPOUT.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325372188&siteId=291194637