Complementary Filtering

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
hypamat
Posts: 31
Joined: Wed Jul 16, 2014 11:38 pm
Has thanked: 6 times
Been thanked: 18 times

Complementary Filtering

Post by hypamat »

hi guys,

ive been playing with a MPU6050 accelerometer, gyro, and themo sensor, and it gives me the values, which is easy enough, but i have heard you can display a more accuracte figure if you do some calculations and use values from both accelerometer and gyroscope (complimentary filtering)

does anyone have any knowledge on this? like a simple calculation that can be done? ive found loads of info for arduino but none for flowcode pic :(

thanks,
matt

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Complementary Filtering

Post by Benj »

Hello Matt,

Have you seen this blog post, hopefully its exactly what your looking for.

http://www.flowcode.co.uk/blog/?p=82

hypamat
Posts: 31
Joined: Wed Jul 16, 2014 11:38 pm
Has thanked: 6 times
Been thanked: 18 times

Re: Complementary Filtering

Post by hypamat »

thanks for your reply, but i really dont understand this! ive had a look at the example code, and it features a rs232 component, which i do not have licence for and also there is no accelerometer data being read as far as i can see, im just after something to read the sensor then display it on a lcd, i wish i understood what was going on in the example, but it seems really complex!

could you dumb it down a bit for me? lol

thanks,
matt

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Complementary Filtering

Post by Benj »

Hi Matt,

I'm doing a few none standard things in the blog.

I have a firmware file which is sent to the ECIO which reads the sensor data and then passes the raw data to the USB connection.

The Flowcode simulation is then used to catch the USB data and do the processing.

The simulation code shows how to create the complementary filter to calculate roll and pitch which are then used to manipulate an item on the panel. Note that this code will not compile on the 8-bit PIC targets due to the lack of proper floating point support in the BoostC compiler.

You should be able to piece together the ECIO firmware and the Flowcode simulation programs to create a fully working complementary filter in firmware.

Post Reply