This project was completed in semester 2, year 2, with a group of 5. My role was in avionics. This involved design, making, and programming a semi autonomous flight computer. The rest of the team designed and built the wing.
For the flight computer, we were given:
- Arduino uno Rev3
- Ultimate GPS + SD card shield
- Arduino uno Rev3
- BMP085 pressure/temperature sensor
- LSM303DLHC compass/accelerometer
- L3GD20H gyro
- A 60A speed controller
- 6 Channel receiver
- Allow full manual control of the aircraft
- At the flick of a switch on the transmitter, change to autopilot mode
- In autopilot mode, maintain straight and level flight
- Log various data items throughout the flight for later analysis
After multiple iterations, the design was finalised, and the wiring could be layed out and fixed to the avionics tray. A sizeable portion of time was spent optimising the various systems to lower mass. Jumper cables would added later to connect the various components.
The software was written in parallel with hardware development. Given the use of an Arduino Uno, memory was severely limited. The program had to do 3 things:
- Read sensor data, and log it to an SD card
- Monitor if the autopilot switch on the transmitter is engaged
- Autonomously control the ailerons and elevator if the switch is engaged
- We were specifically told at the start of the project it was not possible to run all the sensors, and we'd have to use a limited subset of them. With careful library choice, we discovered that it was definitely possible. Unfortunately, the GPS logging was not very successful, due to the carbon fibre wing spar, and aluminium tail spar blocking the signal. The rest of the data logging was successful however.
- Monitoring the receiver channel was quite straight forward, by simply connecting the channel to a PWM pin on the Arduino. Many failsafes were built into this section, reverting to manual mode if the wire became disconnected, or if the signal is weak.
- To control the attitude of the aircraft, accurate measurements of pitch and roll were required. To do this, data from the accelerometer and gyro were combined with a complementary filter. Pitch and roll data was then fed into 2 PID controllers, one for elevator angle and one for aileron angle. Tuning the PID loops correctly was very difficult given we only had one test flight. Luckily, I have some experience with PIDs from a previous project, and using my engineering intuition, guessed approximate tuning values.