kriswiner / MPU9250

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion
1.03k stars 469 forks source link

madgwick filter #419

Open 29676 opened 4 years ago

29676 commented 4 years ago

Hi I have a question about how to filter mpu9250 data. I read the raw data of the sensor, but I had trouble getting Quaternion. The output q is unstable at all, and the data of the roll, pitch, and yaw I obtained are constantly increasing. Most likely they are wrong. How can I solve this problem? If you can help, thanks

kriswiner commented 4 years ago

This https://github.com/kriswiner/MPU9250/tree/master/AK8963_as_slave sketch has methods that work well for this.

On Mon, Jun 1, 2020 at 5:53 AM 29676 notifications@github.com wrote:

Hi I have a question about how to filter mpu9250 data. I read the raw data of the sensor, but I had trouble getting Quaternion. The output q is unstable at all, and the data of the roll, pitch, and yaw I obtained are constantly increasing. Most likely they are wrong. How can I solve this problem? If you can help, thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQP74FPX22FB3MOEYTRUOQE7ANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Thanks for the response. I wrote the program with atmega32 and in codvision , and to do this I repeated the madgwick filter 100 times using the loop, then I printed q. Outputs are constantly increasing or decreasing and not stable . Can uncalibrated data cause quaternion unstability? I have listed quaternion data below . This data is in a position where the sensor is fixed and has no movement.

thanks for your help.

q0=0.952220, q1=-0.100866, q2=-0.100129, q3=-0.264017 q0=0.946733, q1=-0.103507, q2=-0.101369, q3=-0.281663 q0=0.941104, q1=-0.105357, q2=-0.102238, q3=-0.298993 q0=0.935290, q1=-0.106757, q2=-0.102158, q3=-0.316268 q0=0.929400, q1=-0.107310, q2=-0.102020, q3=-0.333046 q0=0.923336, q1=-0.107924, q2=-0.101661, q3=-0.349420 q0=0.917256, q1=-0.107638, q2=-0.100741, q3=-0.365423 q0=0.911033, q1=-0.107042, q2=-0.099944, q3=-0.381050 q0=0.904832, q1=-0.106224, q2=-0.098741, q3=-0.396071 q0=0.898601, q1=-0.105470, q2=-0.097243, q3=-0.410565 q0=0.892194, q1=-0.104208, q2=-0.095513, q3=-0.425011 q0=0.885881, q1=-0.102844, q2=-0.093752, q3=-0.438720 q0=0.879550, q1=-0.101485, q2=-0.091820, q3=-0.451984 q0=0.873104, q1=-0.099661, q2=-0.090195, q3=-0.465026 q0=0.866777, q1=-0.097886, q2=-0.088298, q3=-0.477438 q0=0.860479, q1=-0.096014, q2=-0.086519, q3=-0.489385 q0=0.854239, q1=-0.094317, q2=-0.085004, q3=-0.500781 q0=0.848075, q1=-0.092283, q2=-0.083003, q3=-0.511849 q0=0.842057, q1=-0.090524, q2=-0.081202, q3=-0.522283 q0=0.836008, q1=-0.088794, q2=-0.079476, q3=-0.532463

kriswiner commented 4 years ago

Yes, you have to calibrate your sensors other wise you will get garbage output.

On Tue, Jun 2, 2020 at 12:11 AM 29676 notifications@github.com wrote:

Thanks for the response. I wrote the program with atmega32 and in codvision , and to do this I repeated the madgwick filter 100 times using the loop, then I printed q. Outputs are constantly increasing or decreasing and not stable . Can uncalibrated data cause quaternion unstability? I have listed quaternion data below . This data is in a position where the sensor is fixed and has no movement.

thanks for your help.

q0=0.952220, q1=-0.100866, q2=-0.100129, q3=-0.264017 q0=0.946733, q1=-0.103507, q2=-0.101369, q3=-0.281663 q0=0.941104, q1=-0.105357, q2=-0.102238, q3=-0.298993 q0=0.935290, q1=-0.106757, q2=-0.102158, q3=-0.316268 q0=0.929400, q1=-0.107310, q2=-0.102020, q3=-0.333046 q0=0.923336, q1=-0.107924, q2=-0.101661, q3=-0.349420 q0=0.917256, q1=-0.107638, q2=-0.100741, q3=-0.365423 q0=0.911033, q1=-0.107042, q2=-0.099944, q3=-0.381050 q0=0.904832, q1=-0.106224, q2=-0.098741, q3=-0.396071 q0=0.898601, q1=-0.105470, q2=-0.097243, q3=-0.410565 q0=0.892194, q1=-0.104208, q2=-0.095513, q3=-0.425011 q0=0.885881, q1=-0.102844, q2=-0.093752, q3=-0.438720 q0=0.879550, q1=-0.101485, q2=-0.091820, q3=-0.451984 q0=0.873104, q1=-0.099661, q2=-0.090195, q3=-0.465026 q0=0.866777, q1=-0.097886, q2=-0.088298, q3=-0.477438 q0=0.860479, q1=-0.096014, q2=-0.086519, q3=-0.489385 q0=0.854239, q1=-0.094317, q2=-0.085004, q3=-0.500781 q0=0.848075, q1=-0.092283, q2=-0.083003, q3=-0.511849 q0=0.842057, q1=-0.090524, q2=-0.081202, q3=-0.522283 q0=0.836008, q1=-0.088794, q2=-0.079476, q3=-0.532463

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-637338640, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKWWOZGLDYUM5RVSGVLRUSQ2JANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Should I enable fifo to calibrate the sensor or can it be calibrated without fifo? Thank you

kriswiner commented 4 years ago

either way

On Tue, Jun 2, 2020 at 8:55 AM 29676 notifications@github.com wrote:

Should I enable fifo to calibrate the sensor or can it be calibrated without fifo? Thank you

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-637643074, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQBI2KQQADTVCH7GUDRUUOF3ANCNFSM4NPZNKGQ .

29676 commented 4 years ago

I have a few questions I get compass data in two ways, but I don't know if they're right, how can I be sure? And for the madgwick filter, how many times should the loop be repeated to make the correct outputs? If possible, help me calibrate the sensor. Does the madgwick filter give stable outputs or Kalman? which one is better? How to get GyroMeasError values, and GyroMeasDrift? Thank you for your help

kriswiner commented 4 years ago

" help me calibrate the sensor."

See sketches in the repository.

Madgick filter should be iterated 10 - 20 times per new data set, again, see sketches, such as here https://github.com/kriswiner/MPU9250/tree/master/AK8963_as_slave.

On Tue, Jun 2, 2020 at 10:42 AM 29676 notifications@github.com wrote:

I have a few questions I get compass data in two ways, but I don't know if they're right, how can I be sure? And for the madgwick filter, how many times should the loop be repeated to make the correct outputs? If possible, help me calibrate the sensor. Does the madgwick filter give stable outputs or Kalman? which one is better? How to get GyroMeasError values, and GyroMeasDrift? Thank you for your help

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-637702019, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKRMGYFURUXS2PLQAD3RUU2ZPANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Hi , Thanks a lot for the response, I have a problem with the calibration function Do you get the values ​​of magBias and magscale from the magcalMPU9250 function? values ​​of magCount (in the following function that is inside the main program) are raw data or the outputs of the magcalMPU9250 function?

MPU9250.readMagData(magCount);

  mx = (float)magCount[0]*mRes*magCalibration[0] - magBias[0];  
  my = (float)magCount[1]*mRes*magCalibration[1] - magBias[1];  
  mz = (float)magCount[2]*mRes*magCalibration[2] - magBias[2];  
  mx *= magScale[0];
  my *= magScale[1];
  mz *= magScale[2]; 

}
And another question, where is the output of the magcalMPU9250 function used in the main program ?

kriswiner commented 4 years ago

Which main program are you using?

On Wed, Jun 3, 2020 at 9:03 AM 29676 notifications@github.com wrote:

Hi , Thanks a lot for the response, I have a problem with the calibration function Do you get the values ​​of magBias and magscale from the magcalMPU9250 function? values ​​of magCount (in the following function that is inside the main program) are raw data or the outputs of the magcalMPU9250 function?

MPU9250.readMagData(magCount);

mx = (float)magCount[0]mResmagCalibration[0] - magBias[0];

my = (float)magCount[1]mResmagCalibration[1] - magBias[1];

mz = (float)magCount[2]mResmagCalibration[2] - magBias[2];

mx *= magScale[0];

my *= magScale[1];

mz *= magScale[2];

} And another question, where is the output of the magcalMPU9250 function used in the main program ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-638293256, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTSNBAZLHSK75RN4Q3RUZX6RANCNFSM4NPZNKGQ .

29676 commented 4 years ago

In this program, that madgwick filter is called and the roll, pitch and yaw are also calculated
AK8963Slave0_MPU9250_Ladybug.ino

kriswiner commented 4 years ago

line 159

On Wed, Jun 3, 2020 at 9:58 AM 29676 notifications@github.com wrote:

In this program, that madgwick filter is called and the roll, pitch and yaw are also calculated AK8963Slave0_MPU9250_Ladybug.ino

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-638325637, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQSROBTJKVN5Q2Y62LRUZ6LZANCNFSM4NPZNKGQ .

29676 commented 4 years ago

So the values ​​of magbias and mag scale (in The following function) are obtained from the magcalMPU9250 function. And mag count[0] ,mag count[1] , mag count[2] are raw values magnet that get than readMagData function . it's true?

MPU9250.readMagData(magCount);

  mx = (float)magCount[0]*mRes*magCalibration[0] - magBias[0];  // get actual magnetometer value, this depends on scale being set
  my = (float)magCount[1]*mRes*magCalibration[1] - magBias[1];  
  mz = (float)magCount[2]*mRes*magCalibration[2] - magBias[2];  
  mx *= magScale[0];
  my *= magScale[1];
  mz *= magScale[2]; 
}
kriswiner commented 4 years ago

yes

On Wed, Jun 3, 2020 at 10:30 AM 29676 notifications@github.com wrote:

So the values ​​of magbias and mag scale (in The following function) are obtained from the magcalMPU9250 function. And mag count[0] ,mag count[1] , mag count[2] are raw values magnet that get than readMagData function . it's true?

MPU9250.readMagData(magCount);

mx = (float)magCount[0]mResmagCalibration[0] - magBias[0]; // get actual magnetometer value, this depends on scale being set

my = (float)magCount[1]mResmagCalibration[1] - magBias[1];

mz = (float)magCount[2]mResmagCalibration[2] - magBias[2];

mx *= magScale[0];

my *= magScale[1];

mz *= magScale[2];

}

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-638342613, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKV3AK627APEKI4AMSDRU2CBDANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Can you tell me how the values ​​GyroMeasDrift and GyroMeas Error are obtained? Should they be calculated by testing?

kriswiner commented 4 years ago

These are irrelevant.

On Wed, Jun 3, 2020 at 11:12 AM 29676 notifications@github.com wrote:

Can you tell me how the values ​​GyroMeasDrift and GyroMeas Error are obtained? Should they be calculated by testing?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-638371077, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKRAODBN5RXDTI5GT7TRU2HAXANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Sorry i don't understand. Does this mean that the two are fixed in all program that are used in the filter madgwick or their value does not important? thanks alot .

kriswiner commented 4 years ago

Not important, verify this for yourself...

On Wed, Jun 3, 2020 at 11:27 AM 29676 notifications@github.com wrote:

Sorry i don't understand. Does this mean that the two are fixed in all program that are used in the filter madgwick or their value does not important? thanks alot .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-638379855, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKSZL2NLY5Y6BADELCTRU2IZXANCNFSM4NPZNKGQ .

29676 commented 4 years ago

thanks. Is it important to read the temperature register in sensor and also Gyro chip temperature?

What are the benefits of temperature values?

kriswiner commented 4 years ago

calibration changes with temperature.

On Wed, Jun 3, 2020 at 12:04 PM 29676 notifications@github.com wrote:

thanks. Is it important to read the temperature register in sensor and also Gyro chip temperature?

What are the benefits of temperature values?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-638400249, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKXYBA26HOLYU7KYAODRU2NFLANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Hi kris, Thank you for your help I have a question I don't want to use fifo. If I don't use this feature, will there be a problem? I saw that it was used in the calibration function. Is it possible to calibrate the sensor without it?

kriswiner commented 4 years ago

Don't need to use it. Just convenient and useful.

On Thu, Jun 4, 2020 at 8:13 AM 29676 notifications@github.com wrote:

Hi kris, Thank you for your help I have a question I don't want to use fifo. If I don't use this feature, will there be a problem? I saw that it was used in the calibration function. Is it possible to calibrate the sensor without it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-638915601, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKU723QFVJMV2ZHGYNTRU6225ANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Hi kris, I saw in your program that you read Magnet data in two ways , which method is better? and , Why the value ​​of this register read first , then written ? uint8_t c = readByte(MPU9250_ADDRESS, ACCEL_CONFIG2);
c = c & ~0x0F; c = c | 0x01; writeByte(MPU9250_ADDRESS, ACCEL_CONFIG2, c);

I will replace this part of the code * (it,s the below) ،use loop (for (i = 0; i < 20; i += 1) ) for madgwick filter , Is this wrong or i can use the loop Instead of the below code?

and the function( accelWakeOnMotion( ) ) is important? If I don't write it, what's the problem?

thanks a lot for your help

kriswiner commented 4 years ago

This sketch uses the internal I2C bus to Tx mag data to the MPU6500 so that all host reads are to MPU6500 registers. Tjis is best.

Bits to be written should be cleared first in such a way as not to change the bits that are not to be written.

On Fri, Jun 5, 2020 at 9:40 AM 29676 notifications@github.com wrote:

Hi kris, I saw in your program that you read Magnet data in two ways , which method is better? and , Why the value ​​of this register read first , then written ? uint8_t c = readByte(MPU9250_ADDRESS, ACCEL_CONFIG2); c = c & ~0x0F; c = c | 0x01; writeByte(MPU9250_ADDRESS, ACCEL_CONFIG2, c);

I will replace this part of the code * (it,s the below) ،use loop (for (i = 0; i < 20; i += 1) ) for madgwick filter , Is this wrong or i can use the loop Instead of the below code?

-

Now = micros(); deltat = ((Now - lastUpdate)/1000000.0f); lastUpdate = Now;

sum += deltat; // sum for averaging filter update rate sumCount++;

and the function( accelWakeOnMotion( ) ) is important? If I don't write it, what's the problem?

thanks a lot for your help

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-639619335, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKRHVNSGVN3Z3JLGIQLRVENYTANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Ok,thanks, but, why read data mag by slave is best? and i don,t use the function (accelWakeOnMotion( ) ) is it nead?

kriswiner commented 4 years ago

fastest and no.

On Fri, Jun 5, 2020 at 10:41 AM 29676 notifications@github.com wrote:

Ok,thanks, but, why read data mag by slave is best? and i don,t use the function (accelWakeOnMotion( ) ) is it nead?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-639659326, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKX46LKVHNOT2Y6VDBTRVEU3VANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Hi kris ; I get the raw values ​​of the sensor correctly" I wrote the calibration function And I made the settings like your program, Now that I'm running the Madgwick filter, it gives the value q0= 1 and other quaternion to zero, which is the same initial values ​​I've defined for them.

I don't know what to do to solve the problem Thank you for your help

kriswiner commented 4 years ago

Plenty of examples in the repository to consult.

On Thu, Jun 11, 2020 at 7:27 AM 29676 notifications@github.com wrote:

Hi kris ; I get the raw values ​​of the sensor correctly" I wrote the calibration function And I made the settings like your program, Now that I'm running the Madgwick filter, it gives the value q0= 1 and other quaternion to zero, which is the same initial values ​​I've defined for them.

I don't know what to do to solve the problem Thank you for your help

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-642694673, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTRGNOKPFNZ32VFE2TRWDSVPANCNFSM4NPZNKGQ .

29676 commented 4 years ago

In some programs I saw that the input of the filter is in the form MadgwickAHRSupdate(gx, gy, gz, ax, ay, az, mx, my, mz); and in some it is like this: MadgwickQuaternionUpdate(-ax, ay, az, gxpi/180,-gypi/180,-gz*pi/180, -my,mx, mz); How do I know which one is correct?

29676 commented 4 years ago

In some programs I saw that the input of the filter is in the form MadgwickAHRSupdate(gx, gy, gz, ax, ay, az, mx, my, mz); and in some it is like this: MadgwickQuaternionUpdate(-ax, ay, az, gxpi/180,-gypi/180,-gz*pi/180, -my,mx, mz); How do I know which one is correct?

kriswiner commented 4 years ago

Read Madgwicks paper.

On Thu, Jun 11, 2020 at 8:40 AM 29676 notifications@github.com wrote:

In some programs I saw that the input of the filter is in the form MadgwickAHRSupdate(gx, gy, gz, ax, ay, az, mx, my, mz); and in some it is like this: MadgwickQuaternionUpdate(-ax, ay, az, gxpi/180,-gypi/180,-gz*pi/180, -my,mx, mz); How do I know which one is correct?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-642747222, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTEO34OMEAASXJ3OSLRWD3FFANCNFSM4NPZNKGQ .

29676 commented 4 years ago

ok ,thanks; and if i not write self test function and not call it in main program has problem?

kriswiner commented 4 years ago

No

On Thu, Jun 11, 2020 at 9:21 AM 29676 notifications@github.com wrote:

ok ,thanks; and if i not write self test function and not call it in main program has problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-642786106, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKRY6JV4VVRSAUANHH3RWEAANANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Hello kris ; Thank you for your answers and help

I have a few questions:

1) I wrote the program with mega 32 and i2c with 100k frequency. Can low speed cause an error in the output of the madgwick filter?

2) What is the need to use RTC in the program? If not, is there a problem?

3) Is it better to write a program using spi or i2c?

4) What number should I use if I didn't use fifo in this part of the program? instead( fifo_count) packet_count = fifo_count/12;// How many sets of full gyro and accelerometer data for averaging

for (ii = 0; ii < packet_count; ii++)

thanks alot again

kriswiner commented 4 years ago

1) I would use 400 kHz, but this alone will not cause an error. If the fusion rate is much lower than the data sample rate, then you will get poor results.

2) The RTC is specific to the STM32L4 and not necessary for the Madgwick filter to work.

3) Either will do well but SPI is faster. Unless you are running the sample rates at 8000 Hz I2C is simpler.

4) If you don;t use the FIFO you will have to rewrite this calibration function, it is designed for FIFO use.

On Sat, Jun 20, 2020 at 6:56 AM 29676 notifications@github.com wrote:

Hello kris ; Thank you for your answers and help

I have a few questions:

1.

I wrote the program with mega 32 and i2c with 100k frequency. Can low speed cause an error in the output of the madgwick filter? 2.

What is the need to use RTC in the program? If not, is there a problem? 3.

Is it better to write a program using spi or i2c? 4.

What number should I use if I didn't use fifo in this part of the program? instead( fifo_count) packet_count = fifo_count/12;// How many sets of full gyro and accelerometer data for averaging

for (ii = 0; ii < packet_count; ii++)

thanks alot again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-646998689, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKS4GOOSGCQASJOGQWTRXS5XNANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Thank you So if I use i2c with 100k, the output of the madgwick function is not wrong, only the speed is low, right? And when I activate fifo, do I have to activate the general intrrupt for micro?

kriswiner commented 4 years ago

The accuracy will depend on the speed.

So you want sensor sample rate of 200 - 400 Hz abd sensor fusion rate 10x faster. Can you MCU do this? AVRs cannot...

On Sat, Jun 20, 2020 at 11:44 AM 29676 notifications@github.com wrote:

Thank you So if I use i2c with 100k, the output of the madgwick function is not wrong, only the speed is low, right? And when I activate fifo, do I have to activate the general intrrupt for micro?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-647032073, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQB5PQRM2EUD3N47SDRXT7RVANCNFSM4NPZNKGQ .

29676 commented 4 years ago

What should I do to get a good output? What should be the relationship between sampling rate and micro speed? Can I get a good output with spi whit speed 1 meg? How much should I set the spi speed to? And in this case, how much should I set the sampling rate to? Please help me more .thanks

kriswiner commented 4 years ago

What MCU are you using?

Might want to get one of these https://www.tindie.com/products/tleracorp/ladybug-stm32l432-development-board/ .

On Sat, Jun 20, 2020 at 12:20 PM 29676 notifications@github.com wrote:

What should I do to get a good output? What should be the relationship between sampling rate and micro speed? Can I get a good output with spi whit speed 1 meg? How much should I set the spi speed to? And in this case, how much should I set the sampling rate to? Please help me more .thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-647035735, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKU32PASALUUPZPJHR3RXUDYFANCNFSM4NPZNKGQ .

29676 commented 4 years ago

At mega32

29676 commented 4 years ago

Can't get a good output with this micro?

kriswiner commented 4 years ago

8 bit, 8 MHz CPU, are you kidding? This will never work for sensor fusion....

On Sat, Jun 20, 2020 at 12:46 PM 29676 notifications@github.com wrote:

At mega32

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-647038217, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKVH2SL22K5NQPMBHDLRXUG3HANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Hi kris What is the best amount of spi speed to be set with this 8-bit micro(mega32) to good work sensor fusion...? Thank you so much for your help.

kriswiner commented 4 years ago

8 bit 16 MHz...you are wasting your time with this...

On Mon, Jun 22, 2020 at 7:46 PM 29676 notifications@github.com wrote:

Hi kris What is the best amount of spi speed to be set with this 8-bit micro(mega32) to good work sensor fusion...? Thank you so much for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-647873444, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKXRXE3FP3RDUP6PBJLRYAJPDANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Do you mean to use other micro? What do you think I should do? I don't have much experience, please help me thanks

kriswiner commented 4 years ago

https://www.tindie.com/products/tleracorp/ladybug-stm32l432-development-board/

Or buy a Teensy 3.2

On Mon, Jun 22, 2020 at 8:15 PM 29676 notifications@github.com wrote:

Do you mean to use other micro? What do you think I should do? I don't have much experience, please help me thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-647881941, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKUEFC4T6UOGRKSWI2TRYAM3ZANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Ok thanks Mr Kris; But what is the reason that this micro is not suitable for this job? Because of speed? Or accuracy? Or filter? Or not stable output filter? Roll and pitch and yaw obtained by this method Not valid? Thanks alot again for your answers and your help.

kriswiner commented 4 years ago

The fusion rate needs to be 10 - 20x the gyro sample rate, the gyro sample rate is typically 200- 400 Hz for the MPU9250, so the MPU needs to be able to iterate the Madgwick solution 10 - 20 times for every new gyro sample. An 8 bit, 8 MHz AVR MCU cannot do this, best https://github.com/kriswiner/MPU6050/wiki/Affordable-9-DoF-Sensor-Fusionthat it can do is ~100 Hz fusion rate.

On Tue, Jun 23, 2020 at 12:06 AM 29676 notifications@github.com wrote:

Ok thanks Mr Kris; But what is the reason that this micro is not suitable for this job? Because of speed? Or accuracy? Or filter? Or not stable output filter? Roll and pitch and yaw obtained by this method Not valid? Thanks alot again for your answers and your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-647952647, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTHNOWQYLJASEO2VWTRYBH7RANCNFSM4NPZNKGQ .

29676 commented 4 years ago

Hello Kris; Thank you very much for your help ; I want to use stm32 for mpu9250 ; Is it needed another tools ، besides Mic for this job? Should I use special board/Piece for calibration ?

kriswiner commented 4 years ago

Why do you need a Mic?

On Mon, Jul 20, 2020 at 7:19 AM 29676 notifications@github.com wrote:

Hello Kris; Thank you very much for your help ; I want to use stm32 for mpu9250 ; Is it needed another tools ، besides Mic for this job? Should I use special board/Piece for calibration ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/419#issuecomment-661069160, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKX4SYIGO6COLZEOOYDR4RG6DANCNFSM4NPZNKGQ .

29676 commented 4 years ago

I mean, other than Mcu stm32, do I need another board or device for get output and calibration sensor?