lucsong 发表于 2012-5-4 16:41:01

关于mpu6050调试

入手一个mpu6050的六轴。在测试时发现加速z轴读数很高,其它5轴都差不多。但是读数都很不稳定。我是放在桌子上的。
这些读数要怎么换算成角度和加速度谢谢各位?

弘毅 发表于 2012-5-20 10:51:10

GeMarK 发表于 2012-5-20 03:59 static/image/common/back.gif
其实我一直有一个疑问,通过加速度传感器,是否可以计算出位移量?利用积分?积分运算放大器?
是不是还有 ...

加速度传感器和陀螺仪,一般用作姿态识别。位移方面现在貌似有问题。

位移如果是飞行器基本都是通过GPS,气压计等进行计算。

如果是小车之类的,基本就是通过码盘,计算轮子转了多少圈,然后通过电子罗盘,记录位移方向。

lucsong 发表于 2012-5-4 16:42:18

忘了说。那个arduino的调试程序看的我头大:dizzy:

Randy 发表于 2012-5-4 17:24:37

lucsong 发表于 2012-5-4 16:42 static/image/common/back.gif
忘了说。那个arduino的调试程序看的我头大

能不能把数据和模块图片贴出来,我的MPU6050也出现一堆问题,不能成功!

lucsong 发表于 2012-5-4 20:42:17

这个事串口显示的数据。陀螺仪式平放在桌面上的。
加速度aZ数值好大。不知道为什么?

Malc 发表于 2012-5-4 20:48:46

怎么大家都入手mpu6560了,我慢了一步啊
是不是寄存器没配置好啊

lucsong 发表于 2012-5-4 21:05:02

这个是用arduino自带的测试程序读出的数值。
那个程序在下是才疏学浅到现在还是没有看明白。

Malc 发表于 2012-5-4 21:21:01

lucsong 发表于 2012-5-4 21:05 static/image/common/back.gif
这个是用arduino自带的测试程序读出的数值。
那个程序在下是才疏学浅到现在还是没有看明白。

arduino自带的?贴出来看看

lucsong 发表于 2012-5-4 21:22:34

// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class
// 10/7/2011 by Jeff Rowberg <[email protected]>
// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
//
// Changelog:
//   2011-10-07 - initial release

/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright (c) 2011 Jeff Rowberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================
*/

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#include "Wire.h"

// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050.h"

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;

int16_t ax, ay, az;
int16_t gx, gy, gz;

#define LED_PIN 13
bool blinkState = false;

void setup() {
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin();

// initialize serial communication
// (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
// it's really up to you depending on your project)
Serial.begin(38400);

// initialize device
Serial.println("Initializing I2C devices...");
accelgyro.initialize();

// verify connection
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

// configure Arduino LED for
pinMode(LED_PIN, OUTPUT);
}

void loop() {
// read raw accel/gyro measurements from device
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

// these methods (and a few others) are also available
//accelgyro.getAcceleration(&ax, &ay, &az);
//accelgyro.getRotation(&gx, &gy, &gz);

// display tab-separated accel/gyro x/y/z values
Serial.print("a/g:\t");
Serial.print(ax);
Serial.print("\t");
Serial.print(ay);
Serial.print("\t");
Serial.print(az);
Serial.print("\t");
Serial.print(gx);
Serial.print("\t");
Serial.print(gy);
Serial.print("\t");
Serial.println(gz);

// blink LED to indicate activity
blinkState = !blinkState;
digitalWrite(LED_PIN, blinkState);
}

以上就是

lucsong 发表于 2012-5-6 21:51:08

终于自己搞定了,就是调整mpu6050精度上还要费些时间。

lucsong 发表于 2012-5-7 22:10:45

g:        0.07        -0.02        0.09        0.15        -0.26        -0.36
a/g:        0.09        -0.00        0.06        0.41        -0.79        -0.20
a/g:        0.08        -0.02        0.04        0.32        -0.64        -0.04
a/g:        0.08        -0.01        0.05        0.32        0.26        -0.47
a/g:        0.07        -0.01        0.06        0.22        0.14        -0.36
a/g:        0.07        -0.01        0.08        0.41        -0.81        0.02
a/g:        0.07        -0.02        0.05        0.25        -0.56        -0.09
a/g:        0.08        -0.02        0.05        0.52        0.28        -0.10
a/g:        0.08        -0.00        0.06        0.28        0.20        -0.04
a/g:        0.07        -0.01        0.08        0.34        -0.38        -0.50
a/g:        0.05        -0.03        0.10        0.49        -0.47        -0.20
a/g:        0.09        -0.00        0.06        0.48        -0.12        -0.33
a/g:        0.07        -0.01        0.06        0.29        0.22        -0.24
a/g:        0.07        -0.01        0.06        0.26        0.00        -0.35
a/g:        0.07        -0.03        0.07        0.26        -0.04        -0.27
a/g:        0.07        -0.03        0.06        0.37        -0.23        -0.12
a/g:        0.07        -0.02        0.05        0.55        0.05        -0.10
a/g:        0.08        -0.00        0.04        0.26        0.40        -0.33
a/g:        0.08        -0.02        0.06        0.17        0.08        -0.38
a/g:        0.06        -0.02        0.09        0.38        -0.93        -0.09
a/g:        0.08        -0.02        0.04        0.55        -0.58        -0.41
a/g:        0.08        -0.02        0.04        0.43        -0.43        -0.18
a/g:        0.07        -0.01        0.07        0.43        0.32        -0.27
a/g:        0.08        -0.02        0.07        0.19        -0.04        -0.50
a/g:        0.07        -0.02        0.07        0.72        -0.44        -0.12
a/g:        0.08        -0.02        0.06        0.43        -0.03        -0.41
a/g:        0.09        -0.01        0.06        0.46        0.38        -0.29
a/g:        0.08        -0.02        0.06        0.41        0.02        -0.17
a/g:        0.08        -0.03        0.08        0.34        -0.70        -0.15
a/g:        0.08        -0.02        0.05        0.72        -0.10        -0.17
a/g:        0.09        -0.02        0.05        0.41        -0.04        -0.17
a/g:        0.08        -0.02        0.07        0.12        0.23        0.15
a/g:        0.08        -0.03        0.09        0.34        -0.35        -0.38
a/g:        0.07        -0.02        0.08        0.35        -0.26        0.05
a/g:        0.08        -0.03        0.06        0.54        -0.18        -0.36
a/g:        0.08        -0.02        0.05        0.40        -0.01        -0.07
a/g:        0.08        -0.04        0.06        0.28        -0.10        -0.24
a/g:        0.06        -0.00        0.06        0.57        -0.32        -0.18
a/g:        0.08        -0.01        0.05        0.58        0.28        -0.32
新数据终于趋于正常。

弘毅 发表于 2012-5-7 22:37:48

{:soso_e142:} 不错不错。。。不知道randy的调好了没

Randy 发表于 2012-5-7 22:52:23

lucsong 发表于 2012-5-7 22:10 static/image/common/back.gif
g:        0.07        -0.02        0.09        0.15        -0.26        -0.36
a/g:        0.09        -0.00        0.06        0.41        -0.79        -0.20
a/g:        0.08        -0.02        0.04        0.3 ...

我的可能是板子有问题了,需要重新画板才行,您能否解析一下您测试的结果呢?

牧牛人 发表于 2012-5-8 11:24:14

lucsong 发表于 2012-5-6 21:51 static/image/common/back.gif
终于自己搞定了,就是调整mpu6050精度上还要费些时间。

你好。能说说你是如何调好的吗?有哪些要特别注意的。不胜感激!

qinjihu 发表于 2012-5-8 15:05:21

放代码看看:D

syfok 发表于 2012-5-12 01:04:16

lucsong 发表于 2012-5-6 21:51 static/image/common/back.gif
终于自己搞定了,就是调整mpu6050精度上还要费些时间。

怎么搞定的呀,我也是这种情况
页: [1] 2 3 4 5 6 7
查看完整版本: 关于mpu6050调试