2

I am relatively new with Arduino and I want to:

  1. Set the frequency of the IMU to 100 Hz.
  2. Synchronise GPS and MPU6050 in order to get data at the same time:

    1 set of IMU data and 1 set of GPS data ->
    99 sets of IMU data.     (//1 second) ->
    1 set of IMU data and 1 set of GPS data->
    99 sets of IMU data     (// 2 seconds)
    

I can't find anything that I can use/understand.

gre_gor
  • 5,546
  • 9
  • 35
  • 41

1 Answers1

2

There are several lengthy threads in the Arduino forums for the same kind of project. Here's a good starting point. Then check out powergravity's other threads here, here, here and here. The last version of his program is here. You've got a lot of reading to do. :)

It's difficult to summarize this information into something a "new Arduino" user can "use/understand", but I'll try:

  • The IMU and the GPS run off their own clocks; you can set the frequency, but you can't set when they happen. Their phases or time offsets could be different. The IMU could run slightly faster or slower than 100Hz, because it is based on its own oscillator, not the GPS atomic clock (in orbit).

  • There will be an average of 100 IMU samples per GPS data point (an exact 1000ms). But because the IMU and GPS are not synchronized, you may get 99 or 101 IMU readings for each GPS data point.

  • You don't explicitly state what you are doing with the data. Whatever that is, it must accommodate the different numbers of samples per GPS period. I recommend that your loop structure is based off of the GPS time. You can even use it to measure the true frequency of the Arduino crystal (and thus the micros() clock).

  • At these rates, you will need to choose your GPS serial port wisely. Here are some tips.

  • You will also need an efficient GPS parser. My NeoGPS library is smaller, faster, more reliable and more accurate than all other libraries.

slash-dev
  • 1,519
  • 2
  • 8
  • 9