kriswiner/EM7180_SENtral_sensor_hub

How to increase the Sensor Fusion rate as well as the low pass filter bandwiths?

Opened this issue · 7 comments

GM223 commented

Hi,
I recently bought the board and the results are pretty amazing.
I am able to get an output data rate of 100hz by using your provided sketch but for my application i require as high a data rate possible.
400hz (which is max hardware fusion rate) of filtered quaternion output should be good enough but here lies the problem.
I have changed various parameters such as :
writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x01); // same data rate as gyro rate
writeByte(EM7180_ADDRESS, EM7180_AccelRate, 0x28); // 400/10 Hz writeByte(EM7180_ADDRESS, EM7180_GyroRate, 0x28); // 400/10 Hz

But the quaternion output rate has not increased over 130 Hz max.
Any help would be appreciated.

Thank you
image

@GM223

ODR and Kalman update rate are two different things.

According to the EM7180 register map:

  • quaternion registers within SENtral will be updated at the GyroRate, regardless of QRateDivisor (point 4.3)
  • changing the QRateDivisor value will not affect power consumption nor motion-
    tracking and heading performance (point 4.3)
  • Kalman update rate normally is fixed at 30 Hz. However, if any of the sensor
    output data rates are set below 30 Hz, then the Kalman update rate will match the output data
    rate of the slowest sensor. For instance, setting MagRate to 10 Hz will result in the Kalman
    updating at 10 Hz as well. (point 4.1)
  • Bit [1] is the AlgorithmSlow bit, where ‘1’ indicates the Kalman update rate is less than
    expected. The expected Kalman update rate is 30 Hz or the lowest sensor output data
    rate, whichever is lowest. Normally this bit will remain ‘0’. But if the sensor rates are
    set too high, SENtral gives priority to handling the interrupts and this may result in
    deferred Kalman code execution, thus setting the AlgorithmSlow bit to ‘1’ (point 3.7)

So it seems that:

  • Kalman filter updates at 30 Hz
  • Quaternions are updated at GyroRate
  • Manipulating QRateDivisor has only sense if you need data more often, it will not affect accuracy

Also:

  • when setting sensor rates high one should make sure that AlghorithmSlow flag is not set
  • it seems that with too high sensor update rate you may get worse result if Kalman update rate drops

@kriswiner

since the divisor is applied as 1/(1 + qratedivisor)

Interestingly you are correct despite that this contradicts documentation in several places:

  • Write 0x01 to the QRateDivisor Register. This sets the quaternion output data rate to
    equal the GyroRate (EM7180 datasheet, page 22)
  • For example, if the GyroRate is set to 200 Hz (0x14) and the QRateDivisor register value is set to
    0x04, then the quaternion interrupt rate will be 50 Hz (EM7180 register map, point 4.3)
  • The rate at which quaternion interrupts are sent to the host is equal to GyroRate divided by the QRateDivisor register (EM7180 register map, point 4.3)
  • and more

I have measured the rate at which I get quaternion interrupts and:

  • you are correct ( 1/(1 + qratedivisor )
  • EM7180 documentation is wrong (1/qratedivisor)

Not sure if you will get the full 400 Hz this way, if you need even faster rates you could try to increase the gyro rate to 1 kHz.

With USFS I got:

  • 333 Hz ODR at 330 Hz Gyro & Accel
  • 500 Hz ODR at 500 Hz Gyro & Aceel
  • 833 Hz ODR at 1000 Hz Gyro & Accel

Neither of those resulted in setting AlghoritmSlow flag.

ODR was measured as frequency of quaternion interrupts (interrupts that result in quaternion data ready flag)

According to the EM7180 documentation:

  • the outputs are updated at a rate limited to the gyro output data rate (ODR), to a maximum of 400 Hz

It remains unclear whether:

  • interrupt is generated more often but quaternions updated at 400 Hz
  • quaternions are updated at higher rate contradicting documentation

Hi.
I have a difference between the rate printed by the sketch and the rate measured with an oscilloscope on the INT pin.

The maximum output I get is approx 60Hz while the sketch says 1khz. I'm using an Arduino UNO with your sketch.

https://photos.app.goo.gl/hST84zsg75DaEPqZ6

Is there any factor in your sketch rate print?

Thanks