Datalogger for off-road vehicle monitoring

Hi,

I am building a off-road vehicle data logging system for my final year project at university that is built around the Arduino Mega 2560. The project will be tested at the SAE Mini Baja competition. It will be logging data from the following sensors:

1: Adxl345 Accelerometer
2: L3GD4200D Gyroscope
3: 4 potentiometers to measure suspension travel on the wheels.
4: 2 analog temperature probes for exhaust and intake temperature.
5: EM506 GPS module for Lat, Lon, bearing and actual ground speed.
6: 10 DOF accelerometer/gyroscope based on the MPU6050.

All the data will stored locally on the vehicle using an SD card, but the data will also be sent back to the pits using a pair of XBee S2B PRO radios.
So far i have coded most of the sensors but started realizing that my sampling rate of everything is a bit low. Another mechanical engineering student will be using the project data for his masters. He said that he needs at least 150hz sampling rate, whereas the highest i have gotten so far is 124hz. My coding is currently polling the sensors in a round robin fashion.
Can anybody give me advice on how to speed it up? Also if there are any mistakes or potential problems please do not hesitate to tell me. If needed i can upload my schematics.

Thanks.

Version_1_Mega.rar (7.56 KB)

Remove all unneeded floats. store/transmit raw data only - no text. Make it CSV-format for import to e.g. excel.
U can make the GPS talk faster.... (57kbit), but not sure if this will save much time

highest i have gotten so far is 124hz

to be honest that seems pretty good, I've done something similar on an aircraft, and I though I managed pretty well to read and log 10 samples per second for each sensor.
I guess you're using i2c devices? I've not used any of the devices you're quoting, but if a device requires that you request data and then wait for xx milliseconds for a response, then make sure you do something useful for that xx millisconds, for example you can go away and request data from the next device.

I've not used your specific GPS, but make sure you've turned off any unneeded NMEA sentences, they all take time to read even if you discard the data.

Do you need to sample everything at 150 hz? can you sample some of the less-important stuff at lower frequencies?

Finally, writing to an SD card can be time consuming have you considered making dedicated SD logger device maybe based on a mini-pro? That's what I did and it speeded things up considerably.

Hope this helps

I have actually been using a SPI for the most part, it is just the 10 DOF board that works only on I2C.

@knut_ny, I have commented out most of the text, the only reason they are still there is because i used them in the beginning to identify the different values.

Now i am off to find out how to create a CSV file on the SD. I have never used them, only heard about them.

This may not work for you as it stores bin files that must be converted but here's the link in case you can use it.
http://forum.arduino.cc/index.php?topic=228549.0

(I've used it to store 40,000 samples per second)

I have considered slaving some functions to other microcontrollers, but at the moment time and finances is not on my side.
So even if it does not work 100%, i am sure there is a few things that i can improve. The guys said that he would be able to work with 124hz, but it would be nice if we could squeeze out a bit more.