I would like to filter angular velocity data from a "cheap" gyroscope (60$). These values are used as an input of a nonlinear controller in a quadcopter application. I am not interested in removing the bias from the readings.
Edit: I'm using a l2g4200d gyroscope connected via i2c with an Arduino uno. The following samples are acquired with the arduino, sent via serial and plotted using matlab.
When the sensor is steady, the plot shows several undesired spikes.
How can I filter these spikes?
1st approach: Spikes are attenuated but still present...
Let's consider the following samples in which a couple of fast rotations are performed. Let's assume that the frequency components of the "fast movement" are the ones I will deal with in the final application.
Below, the discrete Fourier transform of the signal in a normalized frequency scale and the second order ButterWorth low pass filter.
With this filter, the main components of the signal are preserved.
Although the undesired spikes are attenuated by a factor of three the plot shows a slight phase shift...
And the spikes are still present. How can I improve this result? Thanks.
1./2. I am using a breakout board from Sparkfun. You can find the circuit with the Arduino and the gyro in this post: Can you roll with a L3G4200D gyroscope, Arduino and Matlab? I have added pullup resistors to the circuit. I would exclude this option because other sensors are connected via the i2c interface and they are working correctly. I haven't any decoupling capacitors installed near the integrated circuit of the gyro. The breakout board I'm using has them (0.1 uF). Please check the left side of the schematic below, maybe I am wrong.
Motors have a separate circuit and I have soldered all the components on a protoboard.
The gyro is in the quadcopter body but during the test the motors were turned off.
That is interesting. The sampling frequency used in the test was 200Hz. Increasing the update freq from 200 to 400 hz doubled the glitching.
I found other comments on the web about the same breakout board and topic. Open the comments at the bottom of the page and Ctrl-F