The Process of Finding Angles
Thursday, December 8, 2016
DIY Drone: Dealing With Sensor Noise
Recently I’ve run into trouble trying to build my quadrotor. While trying to implement a PID controller to help balance my quadrotor, I realized that the sensor I was using was generating a lot of noise when the motors were running. The angle measurements were reading plus or minus 180 degrees! Over the past week I have been experimenting with different methods of cleaning up sensor data with the goal of getting my project off the ground.
The Process of Finding Angles
To find the angle values in the first place, the measurements from a gyroscope and accelerometer are combined. An accelerometer measures acceleration and a gyroscope measures the speed at which the angles are changing. Using a little geometry, it is easy to find the orientation of the drone (using gravity) as long as it is not accelerating. Unfortunately the drone accelerates a lot! This is where the gyroscope comes in. By finding the amount of time that has passed since the last measurement and the measured distance per unit time that the gyroscope provides, a running summation of the angle can be found, approximating the current orientation of the drone. The longer this runs however, the more inaccurate it becomes because of something called drift. The secret to accurate angle measurements is the combination of these two values which you can read more about here. This combination of gyro and accelerometer is used in a lot of applications and is called an IMU or an inertial measurement unit.
As mentioned earlier the measured angle values were sporadic when the motors were running. A good motto to follow in situations like this is: “Hardware before software”. If you can fix a problem physically it will likely be better in the long run than trying to fix it with a program. So to start, I tested different materials between the sensor board and the frame.
From foam to bubble wrap, any material I thought would absorb vibration I tried. For each test I ran two or three of the motors on high for two seconds, then cut the motors and collected data for another two seconds. I collected the raw readings for the gyroscope and accelerometer and judged the success of the noise damping on graphs of these values. After a few trials I realized that a lot of the noise was likely coming from the direct contact between the motors and the metal frame. I took a thin rubber material, folded it over four times, and attached it between the motors and the frame. After combining these two shock absorbers I got the noise down to a manageable level.
Combining the quieter data back together and averaging every thirty values results in the final product! (Right) It’s nowhere near perfect and will likely be difficult to reference during times like takeoff and landing, but overall it should be able to get the drone off the ground! When it does finally fly, I’ll make sure to let you all know.
– Ethan F