MPU9250 icon indicating copy to clipboard operation
MPU9250 copied to clipboard

1Khz sample Accel and Gyro

Open AM498 opened this issue 8 years ago • 8 comments

Hi kris, I have some quick questions I'm wondering why in your Accel+Gyro configuration you choose:

// Disable FSYNC and set accelerometer and gyro bandwidth to 44 and 42 Hz, respectively; // DLPF_CFG = bits 2:0 = 010; this sets the sample rate at 1 kHz for both // Maximum delay is 4.9 ms which is just over a 200 Hz maximum rate writeByte(MPU9250_ADDRESS, CONFIG, 0x2);

200Hz and not 1Khz? I don't really understand, it means that inside the MPU it sample the datas at 1000Hz but you can read these datas at maximum 200Hz?

For another purpose, if I want to sample my accel and my gyro at 1Khz I just have to change writeByte(MPU9250_ADDRESS, CONFIG, 0x0); right?

Thank you very much

AM498 avatar Apr 25 '16 21:04 AM498

Setting the sample rate for the MPU9250 is complicated and must be done in two registers. One to set the sample rate and one to set the decimation, in this case by a factor of 5. This means the accel and gyro are sampled at 1000/5 Hz in my code. I would recommend you consult the data sheet.

Kris

-----Original Message----- From: AM498 [mailto:[email protected]] Sent: April 25, 2016 2:24 PM To: kriswiner/MPU-9250 Subject: [kriswiner/MPU-9250] 1Khz sample Accel and Gyro (#59)

Hi kris, I have some quick questions I'm wondering why in your Accel+Gyro configuration you choose:

// Disable FSYNC and set accelerometer and gyro bandwidth to 44 and 42 Hz, respectively; // DLPF_CFG = bits 2:0 = 010; this sets the sample rate at 1 kHz for both // Maximum delay is 4.9 ms which is just over a 200 Hz maximum rate writeByte(MPU9250_ADDRESS, CONFIG, 0x2);

200Hz and not 1Khz? I don't really understand, it means that inside the MPU it sample the datas at 1000Hz but you can read these datas at maximum 200Hz?

For another purpose, if I want to sample my accel and my gyro at 1Khz I just have to change writeByte(MPU9250_ADDRESS, CONFIG, 0x0); right?

Thank you very much

You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/kriswiner/MPU-9250/issues/59 <https://github.com/notifications/beacon/AGY1qpNtqwETjYOaKVy-WzuTj1XKfiboks5 p7TDfgaJpZM4IPYBG.gif>

kriswiner avatar Apr 25 '16 22:04 kriswiner

Hum well I'm kind of lost with the datasheet: For this: // Disable FSYNC and set accelerometer and gyro bandwidth to 44 and 42 Hz, respectively; // DLPF_CFG = bits 2:0 = 010; this sets the sample rate at 1 kHz for both // Maximum delay is 4.9 ms which is just over a 200 Hz maximum rate writeByte(MPU9250_ADDRESS, CONFIG, 0x2); we have cfg

And SMPLRT_DIV just divide SAMPLE_RATE= Internal_Sample_Rate / (1 + SMPLRT_DIV)

So If I want 1Khz accel and Gyro I can just

writeByte(MPU9250_ADDRESS, CONFIG, 0x0); means :

  •      |   ACCELEROMETER    |           GYROSCOPE
    
  • DLPF_CFG | Bandwidth | Delay | Bandwidth | Delay | Sample Rate
  • ---------+-----------+--------+-----------+--------+-------------
  • 0 | 260Hz | 0ms | 256Hz | 0.98ms | 8kHz

accel+gyro sample at 8Khz and after that I use SMPLRT_DIV =7 to get SAMPLE_RATE= 8Khz/ (1 + 7)

I am right? thank you very much for your precious help

AM498 avatar Apr 26 '16 14:04 AM498

Yes, for the gyro. I think the max rate on the accel is 1 kHz.

kriswiner avatar Apr 26 '16 17:04 kriswiner

Hi Kriswiner, do you know how to change the accelerometer sampling rate of MPU6515 to 4000hz? I checked the datasheet, it should be able to do so. But I have little knowledge on coding. Appreciate your help if you would. Thank you!

tiancaipipi110 avatar Apr 07 '18 18:04 tiancaipipi110

Configure in register 29, see Table on page 15 of the register map. So set bit 3 to 1, 0x08...

On Sat, Apr 7, 2018 at 11:13 AM, tiancaipipi110 [email protected] wrote:

Hi Kriswiner, do you know how to change the accelerometer sampling rate of MPU6515 to 4000hz? I checked the datasheet, it should be able to do so. But I have little knowledge on coding. Appreciate your help if you would. Thank you!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/59#issuecomment-379488711, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qnBnzawEsrjlReotoImnSSFqUfa8ks5tmQHFgaJpZM4IPYBG .

kriswiner avatar Apr 07 '18 18:04 kriswiner

Thanks Kriswiner!

tiancaipipi110 avatar Apr 08 '18 04:04 tiancaipipi110

Hello Kriswiner Could you please guide us to set the sample rate of MPU 9250 at any custom rate like 200Hz. Please help me it would be so nice of you and how we get error free roll pitch and yaw readings

iotsanjeev avatar Sep 22 '20 09:09 iotsanjeev

Sample rate is set in the initialization function. Select 1 kHz rate and then use SampleRateDivide to divide this by 4 + 1 to get 200 Hz. Please consult the data sheet and register map.

On Tue, Sep 22, 2020 at 2:20 AM iotsanjeev [email protected] wrote:

Hello Kriswiner Could you please guide us to set the sample rate of MPU 9250 at any custom rate like 200Hz. Please help me it would be so nice of you and how we get error free roll pitch and yaw readings

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/59#issuecomment-696606346, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTJLBLKTWIQPY4TRVLSHBT6XANCNFSM4CB5QBDA .

kriswiner avatar Sep 22 '20 16:09 kriswiner