Tilt compensated AHRS/Fusion Algorithm for mpu-9250 or icm-20948

I am looking for a AHRS/fusion algorithm I could use with either the ICM-20948 or the MPU-9250 sensor.

I know there are a number of popular libraries out there that work well and I did try them (jremington, Kris Winer, Sparkfun, etc;). The problem is; while they are giving pretty stable results overall, one critical point they all seem to fail is; they are very susceptible to fast and sudden acceleration changes which is a very common scenario in my case as the device I am working on is wearable and tracks the user's hand movement. This is very evident even when the AHRS is tilt compensated.

Does anyone know one that would satisfy my requirement? I tried the icm-20948 DMP (Sparkfun) on Mega and it works really well but it's too large to fit on a nano which I am using for my project.

Thanks in advance.

All of the popular AHRS algorithms for Arduino assume that the accelerometer is reporting 1 g in the UP direction. The gyro can to some extent compensate for the failure of that assumption in the case of rapid reorientation or high acceleration, but probably not in your case.

Once the wrist is static, the algorithm should recover the proper orientation, with a rate that depends on the tuning parameters. You could try optimizing them.

You might also try the proprietary DMP algorithm built into the ICM-20948 to see if it works any better, but it has problems of its own, extensively discussed on the Sparkfun ICM-20948 Github page (see issues).

Edit: I see you did. The Nano is a poor choice for your application anyway. You need a 32 bit processor for the more advanced algorithms, e.g. the Adafruit Kalman filter.

BTW the term "tilt compensated" is useful for electronic compasses, but is not really relevant to the fusion algorithms.

What particular aspect of hand movement are you interested in? My own interest is in measuring tremor in the hand/forearm. Perhaps we could share some ideas?

I think in my case the movement is far more cursory. I am building an air-drumming application where the IMU sensor is on the user's wrist (mounted on a glove). Acceleration/deceleration is used to determine when a drum hit is produced and at what velocity (how load a sound will be produced) and I want to use heading (pitch and yaw) to determine where that hit occurred (eg; to determine if the player intended to hit the snare, hihat, crash, tom , ride or the floor tom).

I am running it on nano and things work pretty well. For the IMU I was using the Bosch BNO055 which produced really great results using its onboard DMP but it is increasingly difficult to find it and if you do find it, it costs north of $60 so I wanted to find a cheaper substitute but I seem to be having trouble with stable yaw readings.

I know this is a pure software issue but while I have a basic understanding of how AHRS algorithms work, refactoring them to my purpose is way beyond my pay grade :slight_smile:

Having said that, if you think I can help, I am open to exchange ideas.

Interesting application you are building. I'm working on a 'sensor glove' which will measure all the tremors in the hand/forearm. 5 DOF not counting the fingers/thumb with will each need their own 6DOF IMU. I decided early in my design that the weight of the processor+SD card+power, would interfere with measurements of the tremors so opted for a bus structure with the 'brains' on a belt around the waist. CAT5/6 cable with an I2C extender over the shoulder and down the arm to a dorsal mounted extender terminator and a mux on the forearm above the wrist joint and I2C cables to the IMUs on the hand/finger/thumb/forearm. I'm going the use the BNO085 from Adafruit for all but the finger/thumb.

Take a look at Adafruit 9-DOF Orientation IMU Fusion Breakout - BNO085 It the same basic IMU as the BNO055 but with a firmware upgrade. $24.95

Currently out of stock at Adafruit. I signed up for notification on their website. I took 3 notifications before I managed to purchase a couple of them. Haven't tried them out as I have other items to finish.

Your project sounds interesting. My initial design was similar, having cables running to the "brain" but I abandoned it in favour of a wireless design. I am using RF radios (nrf24l01) on all wearable devices that communicate with a receiver which is plugged into a computer via USB. These things are super cheap (you can get them under a dollar on aliexpress.com), have a very low memory footprint and are super fast, saved me a lot of cable :slight_smile:

I also tried the BNO08x line, I used to get them from aliexpress.com for about $10.00 but I think these chip fell victims to the global chip shortage, prices are way out of whack ($70-$80).

I'll have a look at the nrf24l01 Is that why you are using a nano?

You can use the nrf24l01 with pretty much any microcontroller that supports SPI. I am actually using a board that I designed myself. It is a bare bone nano, basically ripped out everything the nano has that I am not needing to reduce power consumption and I am just left with the atmega328 chip and some bare bone components that are needed to run it. This also reduced the physical size considerably.