Introduction to the MPU6050

1.What is the mpu6050?
The MPU6050 is an integrated 6-axis motion processing kit with a three-axis gyroscope and a three-axis accelerometer.
2.The function of MPU6050
Using the DMP hardware acceleration engine, 9-axis fusion data calculation can be output to the application through the main IIC interface.
3.Several important registers of the MPU6050
3.1.Power management registers1
DEVICE_RESET control reset, reset the MPU6050 when set to 1, and automatically clear the bit after the end.
SLEEP controls the MPU6050 operating mode, and after reset, this bit is 1 and enters sleep mode.
TEMP_DIS controls whether the temperature sensor is enabled, set to 0, it is enabled.
CLKSEL selects the clock source (usually set to 001).
3.2.Gyroscope configuration register
FS_SET [1:0] two bits to set the full-scale range of the gyroscope. Generally set to 3(±2000°/s).
3.3.Accelerometer configuration register
AFS_SEL [1:0] The two bits are generally set to 0(±2g).
3.4.FIFO enable registers
When reading simple data, you can use FIFO, and the corresponding bit can be set to 0.
3.5.Gyroscope sample rate divider registers
Set the gyroscope sampling frequency of the MPU6050 as follows: sampling frequency = gyroscope output frequency (1kHz) / (1+SMPLRT - DIV).
3.6.Configure the register
Focus on DLPF_CFG [2:0] these three digits, acceleration and gyroscopes are filtered according to these three configurations.
3.7.Power management registers2
Set the corresponding 6 bits to 0 and enter the working mode.
3.8.Gyroscope data output registers
Output gyroscope sensor data for three axes of x/y/z, with high byte first and low byte last.
3.9.Acceleration sensing data output registers
Output the accelerometer values of the three axes of x/y/z, with the high byte first and the low byte last.
3.10.Temperature sensor data output
Formula: Temperature=36.53+regval/340, where reval is the value read from 0x41 to 0x42.

4.Steps for MPU6050 initialization
4.1.Initialize the IIC interface
4.2.Reset the MPU6050
4.3.Sets the full-scale range of the angular velocity sensor and accelerometer.
4.4.Set other parameters (turn off interrupts, turn off the AUXIIC interface, disable FIFO, set gyroscope sample rate, etc.).
4.5.Configure the system clock and enable the angular velocity sensor and acceleration sensor

5.The use of DMP
DMP can directly convert the original data of the accelerometer and angular velocity sensor into a quaternion output, and after obtaining the quaternion, it can easily calculate the Euler angle, heading angle (yaw), roll angle (roll), pitch angle (pitch).

6.Calculation formula
q0=quat[0]/q30;q1=quat[1]/q30;q2=quat[2]/q30;q3=quat[03]/q30
pitch=asin(-2q1q3+2q0q2)57.3;
roll=atan2(2
q2q3+2q0q1,-2q1q1-2q2q2+1)57.3;
pitch=atan2(2(q1q2+q0q3),q0q0+q1q1-q2q2-q3q3)57.3;

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市镀赌,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌墙歪,老刑警劉巖样漆,帶你破解...
    沈念sama閱讀 218,386評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件爽醋,死亡現(xiàn)場離奇詭異,居然都是意外死亡纤子,警方通過查閱死者的電腦和手機篷牌,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,142評論 3 394
  • 文/潘曉璐 我一進店門睡蟋,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人枷颊,你說我怎么就攤上這事戳杀。” “怎么了夭苗?”我有些...
    開封第一講書人閱讀 164,704評論 0 353
  • 文/不壞的土叔 我叫張陵信卡,是天一觀的道長。 經(jīng)常有香客問我题造,道長傍菇,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,702評論 1 294
  • 正文 為了忘掉前任界赔,我火速辦了婚禮丢习,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘淮悼。我一直安慰自己咐低,他們只是感情好,可當我...
    茶點故事閱讀 67,716評論 6 392
  • 文/花漫 我一把揭開白布袜腥。 她就那樣靜靜地躺著见擦,像睡著了一般。 火紅的嫁衣襯著肌膚如雪羹令。 梳的紋絲不亂的頭發(fā)上鲤屡,一...
    開封第一講書人閱讀 51,573評論 1 305
  • 那天,我揣著相機與錄音福侈,去河邊找鬼执俩。 笑死,一個胖子當著我的面吹牛癌刽,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播尝丐,決...
    沈念sama閱讀 40,314評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼显拜,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了爹袁?” 一聲冷哼從身側(cè)響起远荠,我...
    開封第一講書人閱讀 39,230評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎失息,沒想到半個月后譬淳,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體档址,經(jīng)...
    沈念sama閱讀 45,680評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,873評論 3 336
  • 正文 我和宋清朗相戀三年邻梆,在試婚紗的時候發(fā)現(xiàn)自己被綠了守伸。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,991評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡浦妄,死狀恐怖尼摹,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情剂娄,我是刑警寧澤蠢涝,帶...
    沈念sama閱讀 35,706評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站阅懦,受9級特大地震影響和二,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜耳胎,卻給世界環(huán)境...
    茶點故事閱讀 41,329評論 3 330
  • 文/蒙蒙 一惯吕、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧场晶,春花似錦混埠、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,910評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至扳炬,卻和暖如春吏颖,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背恨樟。 一陣腳步聲響...
    開封第一講書人閱讀 33,038評論 1 270
  • 我被黑心中介騙來泰國打工半醉, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人劝术。 一個月前我還...
    沈念sama閱讀 48,158評論 3 370
  • 正文 我出身青樓缩多,卻偏偏與公主長得像,于是被迫代替她去往敵國和親养晋。 傳聞我的和親對象是個殘疾皇子衬吆,可洞房花燭夜當晚...
    茶點故事閱讀 44,941評論 2 355

推薦閱讀更多精彩內(nèi)容