Electronic – Arduino + gyro/accelerometer == flight controller …


Can I use the combination of an Arduino Mega + MPU-6050 gyro/accelerator module instead of a flight controller? Is there something else needed?

It is said that the gyro/acceleration can be used to maintain the balance of the flying vehicle. How is this achieved?

Is it a must that a gyro/acceleration module is read at a higher rate, almost like continuously?

Best Answer


It sound a little bit limited.

I assume that a flight controller performs dead reckoning by double integrating the measured accelerations. And because this computation is relative and not absolute, errors will sums up and you will have a drift. Thus you have to reduce every sources of errors. One of them is the quantization noise due to the fixed point math. Of course you could use high precision floating point math. But if you think of the amount of required computations and the fact that the ATMega does not have floating point support, it looks difficult. And if you want to add a GPS and implement some Kalman filters for sensor fusion, it will definitely be too demanding for that MCU.

To be more specific:

  • To maintain the balance of a flying vehicle you have to determine the relative angles of your vehicle. This cannot be achieved by a simple reading of an accelerometer output because the accelerometer will measure the gravity vector AND the accelerations of your vehicle. In real systems, high precision gyroscopes are used. But it's expensive, bulky and not practical. A cheaper way to do this is to use a rate gyro sensor. It's small, easy to interface and cheap. The output of a rate gyro is a signal which is proportional to the angular speed measured by the chip. If you integrate this signal ( sum ) you have the angular position of the chip. It sounds nice. But the problem is the drift. You have to continuously add measured values. But in real systems measured value is defined by : $$ measuredValue = measuredEffects + errors $$ After some times, even if the vehicle is no moving at all, the angles returned by your algorithm will be significantly different from the real position of the vehicle due to the fact that errors sum up too. In order to avoid that, you have to sample your sensor at a high rate, reduce sources of noise (especially in the computation by using high precisions ) and use the fact that your vehicle should be flat most of the time and use that to try to cancel the drifts.

  • And yes, you have to continuously read the rate gyro output and sum the read value. But continuous things do not exist in a discrete world... Thus you have to do it at a high rate. I have values such as 100Hz or 1kHz in mind. This has to be checked.

  • For the control of the vehicle itself: Once you have a measurement of the attitude, you can apply standard PID control. But it's not easy because axis are not independents...