TheEnginerd Posted August 7, 2014 Report Share Posted August 7, 2014 I'm using the MPU9150_raw.ino file. I've modified it so that instead of serial.print, i'm using dataFile.print from the SD.h library. The program works just fine, but I noticed my sample rate was slower than desired, something around 20 Hz. So I just commented out all the MPU read data (but leaving in the routine to read these values from the MPU) and had it write millis() to the SD card. Sure enough, I get between 18 and 25 samples per second.I'd like to achieve 100-125 samples per second from the MPU9150. I've sped I2C to 400kHz, no change. I am hypothesizing that the program itself takes 30-40 milliseconds to run, maybe because the SD.h requires the .txt file on the SD card to be opened and closed during each loop. Has anyone had success modifying the MPU9150_raw/source code/writing new code to achieve a 100+Hz sampling rate? And has anyone successfully written it to an SD card? I am using the Sparkfun microSD shield with a Class 10 microSDHC on an Arduino Uno 5V/16Mhz. Thanks. Quote Link to comment Share on other sites More sharing options...
cambazz Posted August 14, 2014 Report Share Posted August 14, 2014 Hello, I have ported this MPU9150Lib to Tiva-C series platform, and I am not able to go faster than 20hz as well. I also tried the same library on arduino due, and it was limited to 20hz. But when runnning on an arduino nano i can get speeds up to 200hz. I think this is an i2c speed issue, or when we read: if ((intStatus & (MPU_INT_STATUS_DMP | MPU_INT_STATUS_DMP_0)) != (MPU_INT_STATUS_DMP | MPU_INT_STATUS_DMP_0)) return false; This part might be returning false, so sensor read is taking too long. Have you had any success? Best Quote Link to comment Share on other sites More sharing options...
cambazz Posted August 14, 2014 Report Share Posted August 14, 2014 Hello, Please see: forum.stellarisiti.com/topic/2066-mpu9150-working-with-msp430-and-tiva-c-almost/ I had the same problem, but now it is solved. If you are using energia or arduino, it is probably due to i2c functions having delay statements in them. Below is a graph of sensor reads vs time, averaging 5ms for 200hz update rates. Best. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.