Filtering the MPU 6050 data

Hi, I am a beginner for Arduino coding.

I need to filter (lowpass) the MPU 6050 Gyro data. I am using a Mega 2560 Arduino board.

The required filter process is three order lowpass Butterworth filter with a 12Hz cut-off frequency for my application. I’ve never had to filter data before, I’m not sure how to use the filtering process.

How can I write code for filtering in my case? Suggest me how to implement the same in Arduino.

Thank you for your help in advance.

Hi, welcome to the forum.

Can you read Gyro data from the sensor ? Can you read with a certain sample rate ? For example 100 times per second ?

Read about the Butterworth filter on Wikipedia, and maybe watch a Youtube video about it.

Then search for a Butterworth library for Arduino on

Let us know how far you get.

You could use Python numpy to calculate the discrete coefficients for the transfer function.
If you try to search online it is likely that you will also find some "ready to use" Jupiter notebooks

You don't even need Python, you can do all of it on the Arduino: Arduino Filters: Butterworth.ino