1

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!

Community
  • 1
  • 1
Allen Jee
  • 719
  • 2
  • 7
  • 14
  • @PeterGriffin From your answer, I know you also encountered this problem, could you tell me the solution? Sorry for the abrupt @. – Allen Jee Jan 04 '13 at 02:57

1 Answers1

0

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

Helio Santos
  • 6,606
  • 3
  • 25
  • 31
  • Thanks for suggestion. :) Actually, in about 5 seconds, accelerometer has 40 samples while gyro has 1332 samples. Since the reading frequency is determined by the hardware, we can't define it through software. So I don't know how to control them to let them synchronized. – Allen Jee Jan 04 '13 at 03:36
  • That would be a sample every 496 millisecond. Is enough? – Helio Santos Jan 04 '13 at 03:42
  • 1
    Could you explain how 496 come out? Maybe the gyro has a high sampling frequency, so I can just ignore some sample of gyro. :> – Allen Jee Jan 04 '13 at 04:07
  • I used your values to improve the post – Helio Santos Jan 04 '13 at 04:21