I'm attempting to implement a Kalman filter for the SparkFun IMU 5 Degrees of Freedom to get somewhat accurate pitch and roll information from the device. My ultimate plan is to attach it to an AVR ATmega168 and have it present the pitch and roll information over an I2C interface. I'm implementing the Kalman filter as described at the following URLs:

http://tom.pycke.be/mav/71/kalman-filtering-of-imu-data

http://academic.csuohio.edu/simond/cour ... kalman.pdf

My code is based on the linked embedded systems article linked above and can be found here:

http://home.comcast.net/~michael.p.thom ... man_test.c

I realize the code as implemented is hopelessly inefficient to run on an AVR microcontroller, but for now I want to get some confidence I can get the algorithm working and then optimize the hell out of it later. For now I'm feeding samples gathered over several seconds on the AVR microcontroller as static data to the kalman_update() function. The output looks somewhat reasonable, but perhaps I'm being to optimistic. I'm just about a day into learning about gyros, accelerometers and combining inputs through the Kalman filter.

The main question I have at this point is how to determine the values for the measurement noise covariance value Sz and the process covariance matrix Sw for SparkFun IMU 5 unit. I'm not even really certain at all what the Sw matrix would look like. The articles I'm referencing basically say this has to be found by doing experiments. Can anyone provide me some tips on way I might determine these values?

Any suggestions would be very much appreciated. I'll be willing to share the final results of the project with the community here as I think there might be interest in a Kalman filter on an AVR MCU attached to the IMU 5. Hopefully I'm not being overly optimistic, but it hasn't stopped me before .

-Mike