1. First read the Register 117.
Register 117 – Who Am I
Reset value: 0x70
2. Reset mpu6500
0x6B,0x80,//Reset the internal registers and restores the default settings.
0x68,0x03,//Auto selects the best available clock source – PLL if ready, else use the Internal oscillator(20M)
0x6a,0x01,//Reset all gyro digital signal path, accel digital signal path, and temp digital signal path. This bit also clears all the sensor registers.
0x68,0x00,//Internal 20MHz oscillator
0x6a,0x00
3.Config mpu6500
Register 25 – Sample Rate Divider (default 1khz)
SAMPLE_RATE =
INTERNAL_SAMPLE_RATE / (1 + SMPLRT_DIV)
where INTERNAL_SAMPLE_RATE = 1kHz
Register 26 – Configuration //!!
Disables the FSYNC pin data to be sampled.
Register 27 – Gyroscope Configuration
Gyro Full Scale Select: 0x00:250,0x08:500,0x10:1000;0x18:2000
Register 28 – Accelerometer Configuration
Acc Full Scale select: 0x00:2g,0x08:4g,0x10:8g;0x18:16G
Register 29 – Accelerometer Configuration 2 (0x08, Acc Rate = 4KHz)
Register 106 – User Control (0x10, SPI mode only. ,也可以使用IIC)
Register 108 – Power Management 2
0x00(All sensor on:acc;xyz,gyro:xyz)
最好写入寄存器的值读出来看对不对。
4. 读取加速度和陀螺仪数据
Registers 59 to 64 – Accelerometer Measurements
59:acc_xout_h; 60:acc_xout_l 高位在前
61:acc_yout_h; 62:acc_yout_l
63:acc_zout_h; 64:acc_zout_l
Registers 65 and 66 – Temperature Measurement
65:temp_out_h; 66:temp_out_l
Registers 67 to 72 – Gyroscope Measurements
67:gyro_xout_h; 60:gyro_xout_l 高位在前
61:gyro_yout_h; 62:gyro_yout_l
63:gyro_zout_h; 64:gyro_zout_l
1. 6500时钟选择
An internal relaxation oscillator(20M) or MEMS oscillators。
2. FIFO : 512 字节,通过配置将什么数据写入FIFO(acc data,temp data,gyro data).
3. Interrupts 通过寄存器配置使能和如何触发。INT pin。
4 。Self-Test ,DMP , FactoryCalibration
6. DLPF: 数字低通滤波器(digital low-pass filter);
7. FSYNC:Frame synchronization digital input.Connect to GND if unused.
8. Communication with all registers of the device is performed using either I2C at 400kHz or SPI at 1MHz.
9. 16-bit ADCs: +-32768;
10. Auxiliary master I2C bus for reading data from external sensors (e.g. magnetometer)
11. 20MHz SPI serial interface for reading sensor and interrupt registers
--平放acc z轴 为1g(9.8) ; 如果量程是16g,输出在2048左右(32768/16 = 2048)
12. 校准,零漂
mpu6500
最新推荐文章于 2024-07-11 18:33:49 发布