I wanted to start a conversation around the roll and pitch of Arducopter drifting as you fly.


The reason is I just assembled new hardware and problems that weren't there before have now shown up in a bad way. Flying indoors in a 5ft space I was able to get up to 30° error in roll and around 10-15° in pitch. I was able to control it and it flew perfectly level the whole time, I just had to hold the stick into the corner of the radio. Lading and waiting corrects the issue.


What could cause this. I had been flying an older version of the IMU this whole time. This version has an analogue filter for the gyros where the new hardware has it as an option. You must solder the pads around the gyros to enable them. I was also flying with two slightly tweaked motors giving off a lot of vibration. This could affect the accels. 


My question is: If you have a problem like this, what is the vibration level on your copter, and do you have the filter pads soldered? 


And notice I didn't say "loss of control" or "it didn't fly stable". I had control, and it flew perfectly. It just lost it's reference to the ground and I had to compensate with the stick. Had it been worse than 45° I would have lost control. 

There are three pairs of pads, each with a white outline. (look for GYRO-XY near the relay).

Jani Solders his to enable the filter. I have never flown this board until now. I will solder them to test the filters this week.


Views: 5253

Replies are closed for this discussion.

Replies to This Discussion

Forgot to mention the program to run in is in the examples folder of the ADC library, called AP_ADC_RAW.

Be careful, it will rotate one of the motors at maximum throttle, without any warnings.

Just connect to the serial port and you will notice 3 coulumnn output.

If you want to send it to me just copy the entire output and paste to a text document.

Note the arducopter frame you have, the version of the oilpan and if the optional filters are enabled.

Looked at the Oilpan in eagle. There the lowpass filter is set at 750ohm against 0.1uF, i.e. a 1st order lowpass filter with -3dB at 2.1 kHz. That means a minimum of 4.2kHz sampling.

So I went for the soldering iron and augmented the z-gyro channel with 1.1uF capacitor, which results in -3dB point at 192 Hz. The result follows, the high frequency vibrations are much better contained, but the 800Hz disturbance still breaks through... What are these 800hz? Maybe a higher order analog filter is needed.


For the current ADC code, which basically samples at 200Hz at least 2.2uF capacitor is needed, to take the bandwidth down to 96Hz.

Click on the image to see the animation and compare to the other animation above.


Actually when I look at it it seems that these 800+Hz is aliasing from somewhere above.

Notice how the spike slides in from the border, i.e. disturbance frequency lowers as the disturbance source (motor) frequency gets higher. That sure looks like aliasing.

Good analysis Kári. How about a compromise solution. Stick with a single pole filter in hardware, but set its breakpoint a bit lower, maybe 50Hz, and increase the sampling rate of the ADC to some level that is sustainable in the current code, maybe 800 Hz. Now the 75Hz filter will have a chance to so something useful, because by 400 Hz it will be 18dB or so down.

Could you model that in your test?



Kári, dumb question, how do I open your .tgz file on a Windows machine? And will there be any other hurdles after that to get it to load and run on the Quad from Windows?




Perhpas it could be usefull to use a switched cap analog filter for testing, or even on production IMU boards.


So that it is easy to have a 5th order filter with programmable corner frequency.




The corner frequency can be adjusted with a clock input : Fc = Fclock / 100. So it is possible to make dynamic adjustments.

Or it is possible to set a fixed Fc, with a simple external capacitor.


5th order is a good compromize between efficiency and stability / linearity.

For a better linearity from DC to Fc, butterworth is recommanded.


What about aliasing an X and Y gyros ?



You could use TAR for windows.




Should go without problems.

Eventually, you'll need to convert text files from linux to windows format, using Notepad++ or similar text editor.


Line returns code are different between Windows and Linux.



Sorry its an old habit.

Here is the same stuff in a zip file.

There should be no hurdles. Just point your Arduino to the files, open the sketch,


and download to your AP. 

Please make sure that no propellers are attached to the quadcopter when running this code.


It is basically the same problem on all the ADC channels.

Little different "personality" on the Accelerometer channels but still aliasing.

I think 800Hz sampling is to heavy on the CPU. It leaves to little time for the main loop.

Besides 800Hz sampling would still give me this 800Hz disturbance noise aliased.


Maybe this 800Hz disturbance is something that is bound to my frame.


It is clearly something that is triggered by the motor spinning, but still it survives the "improved" analog filtering. 


I am really curious to see some data for the official arducopter frames and the newer oilpans (with and without filters).


Maybe the simplest solution is to build vibrationless frame.... :)

Actually it looks bad..


But same analysis applies, there is a lot of disturbances above 100Hz, which will aliased down to 0-100Hz band when only sampled at 200Hz.


Same as before, click the image for animation, this is channel 4 on the ADC, i.e. the X axis on the accelerometer.

Kári, thanks for that.

I am not currently set up to compile anything - I have always uploaded pre-compiled firmware using the Mission Planner. Will I be able to upload this test using Mission Planner or do I need some Arduino infrastructure installed first? I would like to be able to help you with some data.

I have a completely standard AC2 kit with the purple motors.

A thought, presumably the vibrations will be very different when props are attached, and motor speeds will be slower? Could you run your test with the copter tied to the ground and props fitted?


I havent looked at the Mission Planner yet :( I am not sure that this kind of test/hack is suitable to Mission Planner installation. The code is not interactive and there is no MAVLink or whatnot that I assume mission planner expects...


In the Zip (and tgz) there are the sources to the test program.

To compile you will need the Ardiuino IDE. You can find it at http://arduino.cc/en/Main/Software.

I find it simple to install. Once installed you can compile this stuff.


Yes I have thought of tying down the copter to run the code with propeller attached. But then again the string will somewhat dampen or change the natural vibration we are trying to estimate/measure/visualise.


What I think I will try to do first is to put small propeller on the motor, so small that there is little lift but vibrations are amplifed due to the propeller. I think it will give better idea on what is happening. But I need a small propeller first. :)


© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service