- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
In my project(program in attached file), I am using a MPU6050 for selfbalancing purposes. I got the raw MPU data, processed it, and obtained an angle. However, when I push the device, it returns a 'noise value' as shown below:
The angle of the MPU6050 is :0 deg
The angle of the MPU6050 is :0 deg
The angle of the MPU6050 is :0 deg
The angle of the MPU6050 is :-62 deg
The angle of the MPU6050 is :21 deg
The angle of the MPU6050 is :1 deg
The angle of the MPU6050 is :1 deg
The angle of the MPU6050 is :0 deg
The angle of the MPU6050 is :0 deg
The angle of the MPU6050 is :0 deg
The angle of the MPU6050 is :0 deg
Usually a kalman filter is used for this (I think), but I don't know how to do this/I don't understand it. Does anyone know how to do this?
Thank you and have a nice day.
Solved! Go to Solution.
- Labels:
-
PSOC5 LP MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A Kalman filter is used to predict the next output based on a series of inputs; it is usually based on knowledge of system performance, for example how fast a system can move or a sensor can realistically respond. For simple impulse noise rejection, look at a median filter. This is good for rejecting impulse noise. There are a few community threads on this topic.
I took your data and padded it with 0 for a few samples before and after.
The raw data is in red, a moving average looks back at the last 5 samples.
The IIR looks back with last_out*(1-1/8) + input/8.
The median filter looks at the middle of 5 samples, 2 previous, current, and2 future; this will of course
require a 3 sample delay. It does the best job of limiting the spike noise, assuming that your system
doesn't really move fast enough to generate real jumps of 61 counts.
---- Dennis