This is a followup to the aliasing discussion in http://diydrones.com/forum/topics/arducopter-drift-issues
Here is a short summary of the analysis done by us regarding the aliasing possibility.
Same as before click on the images below to get the animation if it is not showing directly in the thread.
This data is collected with two copters, one built by me. Using circurlar 10mm aluminium tubing for the arms. And older version of the Oilpan, Foxtrap 2.2. Olivier was so kind to send be some data from a official Arducopter frame with square tubing for the arms and new Hotel Oilpan, with the lowpass filters enabled for the Gyros.
On the images you will see two vertical magenta lines, These are estimate of the rotational speed of the motor in HZ. They ware measured on my particular motors (BL 2217/9) with fresh 3 cell lipo batteries. So they will not be exactly positioned correctly with the big disturbance spikes in the FFT which was measured with not so fresh batteries. This is especially true for the data I got from Olivier which has different motors than me.
Also on the images you see two red vertical lines. Those lines denote approximate bandwidth of the down sampled data. The main loop, should run at 200Hz, which means bandwidth of 100Hz maximum. I draw the red vertical lines at 80Hz.
All the images show FFT of data sampled from the yaw gyro or the x axis on the accelerometer. These are channels 0 and 4 respectively on the ADC. We can see that the disturbance power follows the rotational speed of the motors which are the main source of vibration.
You can see that the data on the first two pictures on my quadcoter the 2nd overtone of the base frequency is passed easilly thought the quadcopter structure. I am using circular tubing for the quadcopter arms. This indicates a non optimal frame. This is not the case for Olivier's quadcopter which is the official Arducopter frame with square arms.
As you can see in the animation then the vibration disturbance very soon moves out of the 80Hz bandwidth of the main loop. This means that all data beyond the 80Hz will be aliased down to the band of the main loop where it will look like slower rotation/gravity signal depending on the channel.
But it also means that with proper signal processing and or analog filtering most of the vibrational disturbances can be gotten rid of. Making the life of the DCM and control much easier.
The accelerometer data (last animation below) has also indication that there is aliasing of data from above 1000Hz. It is hard to prove though since the APM is getting close to it's limits with the 2000Hz sampling used for creating these images. To prove or disprove higher sampling of 4000Hz+ would be needed.
I am not sure about the filtering bandwidth of the DCM. It has surely norrower bandwidht than 80-100Hz so in many cases where the aliasing is not to bad the DCM will successfully reject the disturbance. But as soon as the aliasing gets worse, i.e. the disturbance noise gets closer to 160Hz the DCM will not be able to distinguish between the aliased disturbance and the normal fluctation of the gyro because of movement of the quadcopter. Making the motors rotate faster or slower will move the aliased disturbance in and out of the working bandwidth of the DCM.
The two two animations measured on my quadcopter are different in the lowpass filter bandwidht on the Oilpan. In the second image I soldered 3.3uF capacitor in parallel, which should give 62Hz bandwidth of the analog signal. This does not seem to work. I am still looking for a good reason for that. There is also an internal lp filter in the gyro with bandwidth of 140Hz. But as can be clearly seen from all the images that there is a lot of energy in the band above 140Hz.
In theory there are possible ways to fix this on the digital side but because of how close the disturbance is to the usable data these require some serious oversampling, i.e. the digital filters have to be quite sharp.
Attaches is a zip file with all the data and the script to generate the images. Hopefully some of you can find a bug in the script and prove me wrong.
First image is my copter with standard 0.1uF capacitor. Oilpan is older Foxtrap 2.2.
Channel is channels 0 the yaw gyro.
Second image is my copter with large 3.4uF capacitor.
Channel is channel 0 the yaw channel.
Third image is sampled from Olivier's copter, Arducopter frame, Hotel Oilpan with capacitors activated.
Channel is channel 0 the yaw gyro channel.
Channel is channel 4 the x-axis acellerometer.
I've just found those informations. Could be usefull to some of us with vibration problems or just to check.
It is particularly interesting to see that sometimes an unbalanced propeler can compensate for an unbalanced motor if it is mounted with the right angular offset.
Could you repost 2 please with the correct data
Yes, I would say so. This is in theory can be decimated down to the main loop bandwidth without aliasing assuming 400Hz base sampling.
From my tests (I am still testing) I am much more concerned with the accs than the gyros.
The accs seem to have much more aliasing and are more "not according to theory" than the gyro channels. There is something in the accs I am missing.
I have some more pictures to post and will probably do so tonight (GMT time).
Here are some interesting results for the accelerometers. I am using ch4 in these images but they all (4,5, and 6) behave the same way. All the data is sampled at 4000Hz, one channel at a time.
So in the first animation and picture is the behavior if the capacitor is removed. Here we can see that the accelerometers are really sensitive beasts. Note the different Y axis scale.
The second animation and image are for the standar 100nF capacitor which should give us 50Hz bandwidth.
The third set is for 470nF capacitor which should give 10Hz bandwidth. The filtering is obvious but the effect is
far from being powerful enough. Remember that the red vertical lines are at the 80Hz marks.
Basically the assumption has to be that the vibration sensitivity so high that the disturbance is basically breaking up
through the stop band of the filter. Next I have to find/buy/build some higher order analog filters and see how effective they are.
Attached is the dataset, octave script to generate the images in the animation and the code to measure the data.
First the data with no caps. First the FFT
The data for 100nF caps. First the FFT
Finally the 470 caps modification. First the FFT
Kari, you could use switched cap filters, 4th or 5th order. So that you can change easily the corner frequency.
I would use a spectrum analyser for faster testing, a good audio card and a software analyser could be ok, would give 20 or 40 kHz bandwith if sampling is set at 96 Khz.
The advantage of using an hardware analyser is that you can more easily trust it.
Isn't the input on a sound card low impedance?
Can I hook it up directly without any buffering/level shift/gain?
I found few of these swiched cap filters at digikey, even in a DIP package that I can solder :)
Professional balanced microphone or line intputs only are low impedance (600 ohms).
Most audio card or mixing desk line inputs are in the 2 kohm to 20 kohm range.
Some external audio box have a high impedance switch on at least one input, so that you can connect high impedance instruments, like guitars. (about 100 kohm)
I have an Edirol UA-25 box with such a high impedance input.
Next there are many good software spectrum analysers available, some of them are free.
Some of them like FFT properties from DEW Research do allow to apply custom digital filters and decimation, this is usefull for analog filter choice. There is a version with a trial period if i remember well.
Eventually you can do digital filtering simply in an audio editor like Audacity.
Send me a message if you need some help.