Go Down

Topic: Kalman Filtered Nunchuck & Wii Motion Plus (Read 56414 times) previous topic - next topic


I have started a new thread and posted the code and example output of the complimentary filter there:


Perhaps if we switch to posting there it will reduce the access problems people have been having due to sheer awesomeness of this thread :-)


sorry to bring up that old thread again, but i can't compile the code from duckhead v0.3 because of the missing angle&degrees function.

i tried it myself and managed already to read nunchuck an wm+ data in passthrough mode. somehow my nunchcuk-Z-axis values needed to be divided by 2 to get to the same level of values, anyone else to do that?

so i have got everything for a kalman filtering: all 3 gyros value, already zerod and all 3 acceleration value (z, as mentioned divided by 2).

coud you help me providing code for a 6 DOF kalman filtering?

thank you!


Post your the code that won't compile or send it privately.

I'll take a look.



This is a brilliant

Im am trying to figure out how I can use this with Max Msp

since the Firmata code  seems to be the easiest way to get arduino and Max Msp to talk together I am wondering if this code for the wm+ and nunchuck can somehow be ingrained into the firmata code?

Or is that just silly?

What would be the best way to use wm+, nunchuck, arduino mega and Max Msp together?


If your arduino is writing to the serial port check out the max object 'serial.read'. No extra code on the arduino necessary.

This is essentially how the firmata set up for max works, but can do so more efficiently if you're thru-putting many separate variables.


I'm new to kalman filter and the gyroscope sensor, but is it possible to implement the filter to a single wii motion plus and use it on a self-balancing robot?


Mar 14, 2010, 09:54 am Last Edit: Mar 14, 2010, 09:55 am by ardvark Reason: 1
is it possible to implement the filter to a single wii motion plus and use it on a self-balancing robot?


For an alternative simpler approach see also:



Actually the MAX object I refer to above is called "serial" not "serial.read"


a little help here guys. im having trouble understanding the method by which the bias is computed. i see that the estimated angle is found using:
Code: [Select]
kalman->x_angle += dt * (dotAngle - kalman->x_bias)
from my understanding, this would imply that the x_bias is in the units of (angle/second). however, from the update equation i see that the bias is computed via
Code: [Select]
kalman->x_bias  += K_1 * y; where y is
Code: [Select]
const float y = angle_m - kalman->x_angle;. forgive my weak skills in math but i seem to see that the bias is simply a constant (k_1) multiplied by a difference in angle (angle_m - kalman->x_angle). doesnt this mean the bias is already in the units of (angle) which will lead to
Code: [Select]
kalman->x_angle += dt * (dotAngle) - (kalman->x_bias). thank you for your inputs

Go Up