Jump to content

[Library] Six Axis or 6 DOF Complementary Filter

Recommended Posts

I've been working on getting the MPU-6050 up and running on the Tiva C and thought I might share the complementary filter library that I created. TI provides a 9 DOF DCM Complementary Filter, but it will not work unless you also have the magnetometer data to go with it. Anyway, hope this helps out anyone who might need to use it.





Link to post
Share on other sites

I'm building an auto-balancing robot and found that the MPU-6050 suited my needs as an orientation sensor as I only really require orientation about the X or Y axes. I decided that I would go ahead and form a library and make it public for anyone who also wants to use the MPU-6050 and other 6 DOF (degrees of freedom) sensors. TI already provides an MPU-6050 driver, so with this filter, it will make that device's output more noise free.


I'm surprized that there are almost no simple, generic 6 DOF complementary filters out there on the web. I had to remedy that!


I'm just glad the Tiva C microcontrollers are Cortex-M4F and thus have FPUs (floating-point units) as this library relies on floating point arithmetic and trigonometry. Thus, this library would not be too useful for the MSP430 unless I could rework it into using fixed-point arithmetic instead.

Link to post
Share on other sites
  • 1 month later...
  • 3 weeks later...



I revised the complementary filter. It should work better than before now. I realized I had a bug floating around in the library. It is corrected and works a treat.

That is great news.


The complementary filter you have reworked, is it for the MPU-6050 or 9150?


Which board are you using for MPU? (SensorHUB, FreeIMU, custom board, etc...)


Thank you

Link to post
Share on other sites

It is for the MPU-6050. Although, I suppose you could technically use this library with the MPU-9150 (since it is mostly an MPU-6050 with a magnetometer bolted on) but TI provides a more useful Comp, DCM Filter.


I'm using the GY-521 board. It's pretty cheap. I got it for about 8 dollars.

Link to post
Share on other sites
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...