xyControl is a Quadrocopter Flight Controller based on Atmels Atmega2560 microcontroller. It features 512KB SRAM on-board, using the external memory interface of this processor. Also included is a switched power supply as well as a USB connection to communicate with and program the target. All I/O pins, including 3 additional UARTs, SPI, I2C (TWI) and 16 ADC Channels, are accessible via standard 2.54mm connectors. The Board can be powered from an external stable 5V supply, USB or 7V or more, via the on-board switched power supply. All voltage sources can be selected via jumpers.
Flight Control Software Flow
Three tasks are controlling the Quadrocopter Orientation in Space.
- The Orientation Task reads the Gyroscope and Accelerometer and calculates the current Roll and Pitch angles. They are stored in the global struct "orientation".
- The PID Task is then feeding these angles into two PID controllers. Their output is then used by...
- The Set Task, which calculates the motor speeds and gives them to...
- The motor task, which sends the new values via TWI to the motor controllers.
- Gyroscope L3GD20, code based on the Adafruit Example.
- Accelerometer and Magnetometer LSM303DLHC, code based on the Pololu Example.
- I got both of these Sensors on the MinIMU-9 v2.
- Brushless Motor Driver BL-Ctrl V1.2 with eg. the Robbe Roxxy Outrunner 2824-34 Brushless Motor.
- BTM-222 Bluetooth UART Bridge (PCB)
External Memory (xmem.h)
The external memory consists of a 512Kx8 SRAM, bank-switched onto the 16bit avr address space. This gives us 8 memory banks, consisting of 56KB. All memory from 0x0000 to 0x21FF is the AVRs internal memory. The memory banks are switched into 0x2200 to 0xFFFF. This gives us 8 banks with 56KB each, resulting in 448KB external RAM.
The data and bss memory sections, as well as the Stack are located in the internal RAM. The external RAM is used only for dynamically allocated memory.
Orientation Calculation (orientation.h)
Calculates the current angles of the platform, using Gyroscope and Accelerometer Data with a Kalman Filter. It is using this slightly modified Kalman Filter Implementation by Linus Helgesson.
PC and Android Tools
You can find some PC Software in the tools directory. Each one should be accompanied by it's own Readme file.
UART-Flight Status Packet Format
printf("t%.2f %.2f %.2f\n", kp, ki, kd); printf("u%.2f %.2f\n", pid_output, pid_output); // Pitch, Roll printf("v%i %i %i %i\n", motorSpeed, ..., motorSpeed); printf("w%.2f\n", orientation.pitch); printf("x%.2f\n", orientation.roll); printf("y%.2f\n", orientation.yaw); printf("z%.2f\n", getVoltage());
Peter Fleurys TWI Library (twi.c & twi.h) is released under the GNU GPL license.
Everything else is released under a BSD-Style license. See the accompanying COPYING file.comments powered by Disqus