Search code examples
accelerometergyroscope

unmatched sampling frequency of accelerometer and gyroscope


I'm working on the IMU of mobile phones. I need to get reading from accelerometer and gyroscope at the same time.

But I find their reading frequency isn't the same. How could I to retrieve reading from them at the same interval?

Actually, the first answer to this post also find the problem, but the guy doesn't give the solution.

Any help is appreciated!


Solution

  • Can't you just multiply the frequency of the accelerometer by the frequency of the gyroscope?

    Imagine that f1 samples every four time units and f2 samples every three time units. If the sampling is regular and they begin to sample at same time they will meet every twelve time units.

    enter image description here

    e.g.

    if the accelerometer has 40 samples every 5 seconds and the gyro has 1332 samples in the same amount of time.

    to calculate the frequency: the accelerometer has 40/5 = 8 samples per second the gyro has 1332/5 = 266.4 samples per second

    to calculate the period (in milliseconds): the accelerometer samples every 1000/8 = 125 millisecond the gyro samples every 1000/266.4 = 3.75 millisecond

    therefore they will meet every 125 * 3.75 = 469 millisecond