The flight controller’s primary goal is to maneuver the aircraft in the desired manner as well as keep it from falling out of the sky. It operates by reading in data from an array of sensors as well as commands sent from the main processor. The main processor sends commands via UART communication to the XMEGA128, which acts as the control for the flight controller. The XMEGA128 then takes these commands, and runs it through different algorithms to convert the command to separate PWM signals that can be sent to the servos and motors to control the aircraft. The XMEGA128 is also reading in data from 4 seperate sensors to gain knowledge about its current orientation as well as predict its motion and help compensate for unwanted changes in position.

The first sensor that the flight controller is interfaced with is the gyroscope. The gryoscope communicates with the XMEGA128 via SPI communication protocol. The gyroscope is used to determine the angular acceleration of the aircraft, so the flight controller can determine if unwanted rotation is beginning to occur on any axis. The gyroscope that is being used is the L3G4200D by STMicroelectronics. This gryoscope offers a number of features that are beneficial to the flight controller. It offers three selectable resolution modes that give a resolution of either 250, 500, of 2000 degrees per second. This will provide us with a high accuracy for low angular accelerations as well as solid accuracy for high angular accelerations. This gyroscope also utilizes an external filter to provide better readings, which consists of R9, C9, and C10 in the schematic. To provide a more steady supply voltage and also improve results further, decoupling capacitors (C7 and C8) are added to the voltage input of the gyroscope.

In order to further monitor the position of the aircraft, two accelerometers are used on the flight controller. The accelerometers that are being utilized are the ADXL345 by Analog Devices. The reason that two accelerometers are being used is so an averaging of the two signals can be performed. Averaging the two signals will allow for a more accurate reading of the orientation of the aircraft and will help to compensate for the noise generated by the vibration of the motors and aircraft in general. The accelerometers provide many nice features including four selectable resolution modes (2G, 4G, 8G, and 16G), as well as data transfer via SPI. The accelerometers also provide programmable interrupt pins that can be used to trigger interrupts on events such as 0-G detection, and activity detection with programmable thresholds. This will allow for full customization so that the accelerometers will tailor to all of the important needs. This accelerometer also utilizes many different decoupling capacitors (C1, C2, C3 for accelerometer 1, and C4, C5, C6 for accelerometer 2) to better clean the input voltage and allow for more accurate results. The reason that three are chosen is so there is a wider frequency response to any noise generated on the line.

Another device which is being utilized is the proximity sensor. The proximity sensor that was chosen was the XLEZ4 by Max Sonar. This sensor will be used primarily in landing sequences, where a high resolution value for altitude is required. This sensor provides an accuracy of 1cm anywhere between 1cm and 765cm. This will allow the flight controller to determine its height very precisely and land without smashing into the ground. This proximity is ideal not only for its long range and high resolution, but also for its UART communication. The only issue faced with this sensor, is that it runs off of 5V, and the UART is between 0 and 5 volts. This is handled with the use of two level shifters which each consist a 2N7002 NMOS (U11 and U12) and 4 10k resistors (R10, R11, R12, and R13). These level shifters convert the 5V signals to 3.3V signals and 3.3V signals to 5V signals, all while requiring very little power to operate.

The flight controller also provides an override system for the user. It utilizes the current receiver on the aircraft, and becomes enabled when the remote control is powered on. The outputs of the receiver are connected into the flight controller and are attached to an array tri-state buffers. The servo outputs of the flight controller are also connected to an array of tri-state buffers. The tri-state buffers that are being used are the SN54HC365, which have 6 internal tri-state buffers as well as enable pins to enable all six tri-state buffers. In order to switch between the flight controller and the override, an inverter is placed on the input of one of the buffer chips, so that when the receiver triggers an override, one buffer is enabled and the other one is disabled, switching which signal is driving the servos. The inverter that is being used is a low power SN74LVC1GU04DBVR.

Lastly, the flight controller provides an array of LED’s. D1 and D2 are being used to signal that power is connected and are being current limited with R14 and R15. D3 through D10 are connected to PORTA of the XMEGA and are used for testing purposes and as status LED’s. They are being current limited by R1 through R8.