The main aim of this project is to create a flight controller using fairly cheap components that will provide stable motion. Though there will be user control to begin with, I would like to gradually give more and more of the control over to the controller.
You can see the current status in this video (in which I am controlling the throttle, and am making minor adjustments to pitch and roll angles).
General set up The quadcopter uses a pre-built kit for the frame, motors and ESCs. The flight controller is built around an Atmega328P 8-bit microcontroller and uses an nRF24L01+ module for communication, and an MPU-6050 IMU and HMC5883L magnetometer for motion control.
User control The quadcopter is controlled through radio using the nRF24L01+ chip connected to the microcontroller on the quadcopter. The transmitter has a similar setup of microcontroller+radio chip (there are more details on the radio controller section of the linked website). The transmitter sends a data package which contains all user inputs (joysticks plus flight mode). The quadcopter ackowledges this package and reports its status including battery level. If connection is lost for more than a short period of time, the quadcopter will attempt to land and then shut down the motors.
Flight controller An inertial measurement unit (MPU-6050) provides gyroscope and accelerometer readings, and there is a separate magnetometer (HMC5883L). Angular rate is taken directly from the gyroscope measurement. Attitude/absolute orientation is calculated from the integrated gyroscope measurements and combined with the orientation calculated from accelerometer (for pitch and roll) and magnetometer measurements (for yaw) in a complementary filter in order to counteract gyro drift. There are two levels of control. The inner control loop uses gyroscope measurements directly and attempts to achieve a given angular rate. The outer control loop attempts to achieve an absolute orientation, and its output is the required angular rate for the inner loop to achieve. There is a PID controller on each axis in both inner and outer control loops. The outer loop can be toggled on/off during flight. If it is on the control inputs will dictate orientation. If it is off the control inputs will dictate angular rate.
Future developments Add range finder and/or barometer for altitude hold Test more advanced sensor fusion algorithms e.g. Extended Kalman Filter Re-make on Teensy or RaspberryPi and add significant ‘autonomous’ functionality e.g. GPS
I would not have got as far as I have without the enormous amounts of information that has been contributed to this forum.