F13: Quadcopter
Contents
Grading Criteria
- How well is Software & Hardware Design described?
- How well can this report be used to reproduce this project?
- Code Quality
- Overall Report Quality:
- Software Block Diagrams
- Hardware Block Diagrams
- Schematic Quality
- Quality of technical challenges and solutions adopted.
Quadcopter
Abstract
The Quadcopter is a four rotor remote controlled aircraft. It takes in remote commands from a hobbyest remote control, and achieves steady flight by utilizing a 3 axis accelerometer and a 3 axis gyroscope to determine the current attitude. It then takes the values from the remote control, and current attitude, and determines the needed changes to the motors to achieve the desired flight.
Objectives & Introduction
Objectives
The objective of this project is to build a remote controlled quadcopter that is capable stable flight. We will control the quadcopter via a Spektrum DX5E hobbyist controller. We will be creating an Inertial Measurement Unit(IMU) using a 3 axis accelerometer and a 3 axis gyroscope. The IMU will communicate with the SJ One Board via I2C. We will be implementing a complementary filter in software to estimate the quadcopter attitude, and will then have a PID control loop in software to generate outputs to the motors.
Introduction
Before we get started, we must first define a few aircraft terms, and describe how they are manifested on the quadcopter.
Aircraft Motion Primer
The motion of an aircraft can be described by three types of motion: Roll, Pitch and Yaw.
Roll is the rotation of the aircraft around the x axis and makes the aircraft turn left and right. Pitch is rotation about the Y axis, and in an airplane causes the aircraft to climb and dive. On a quadcopter, the pitch controls going forward and backward. Yaw is defined by rotation about the Z axis.
On a quadcopter, two of the rotors move in a counter-clockwise motion, and two move in a clockwise motion. The opposite rotation will allow for flight without uncontrollable yaw due to the angular momentum of the motor/propeller assemblies canceling each other out. Vertical motion is controlled by the motor speed for all rotors. Moving forward/backward is caused by pitching forward or pitching backward. To pitch forward, speed up the rear prop, and slow down the front prop. To pitch backward speed up the front rotor, and slow down the back rotor. To roll left, speed up the right rotor, while slowing down the left rotor. To roll right, speed up the left rotor, while slowing down the right rotor. To Yaw right, speed up both the left and right rotors, while slowing down the front and back rotors. To yaw left, speed up the front and back rotors, and slow down the left and right rotors.
Team Members & Responsibilities
- Craig Farless
- Airframe Design
- Sensor Design
- Remote Control Interface Design
- Flight Controller Software Design
Schedule
Task | Projected Completion Date | Actual Completion Date | Status | Notes |
Buy Parts | 1-Oct | 1-Oct | Complete | |
Build frame | 8-Oct | 8-Oct | Complete | |
Install Sensors | 15-Oct | 8-Oct | Complete | |
Code I2C i/f to sensors | 15-Oct | 15-Oct | Complete | |
Code Filters | 22-Oct | 15-Oct | Complete | More filtering may be needed |
Code accel/gyro conversion to angle | 22-Oct | 22-Oct | Complete | |
Integrate Power System | 22-Oct | 22-Oct | Complete | |
Code PWM input | 29-Oct | 15-Nov | Complete | Much more difficult than planned |
Code cmd translator | 29-Oct | 20-Nov | Complete | |
Code PID | 5-Nov | 17-Nov | Complete | Will continue tuning PID |
Code PWM Encode Driver | 12-Nov | 16-Nov | Complete | |
Integrate Processor with Aircraft | 12-Nov | 1-Nov | Complete | |
Tether Testing 2D stabilization (pitch, roll) | 19-Nov | 30-Nov | Complete | More sensor filtering and PID tuning may be needed |
Tether Testing 3D stabilization (pitch, roll, yaw) | 26-Nov | - | - | Went directly to Flight Testing |
Full Flight Testing | 26-Nov | 3-Dec | Initial Testing | More flight testing required |
Demo | 3-Dec | 3-Dec | Complete | |
Parts List & Cost
The table below summarizes the parts used and the cost for the Quadcopter project.
Qty | Description | Manufacturer | Part Number | Total Cost |
---|---|---|---|---|
4 | Electric Speed Controller (ESC) | Castle Creations | 010-0125-00 | $148.00 |
4 | Park 480 Brushless Outrunner 1020kV motor | E-Flight | EFLM1505 | $180.00 |
1 | Triple Axis Accelerometer Breakout - ADXL345) | Sparkfun | SEN-09836 | $27.95 |
1 | Tri-Axis Gyro Breakout - L3G4200D | Sparkfun | SEN-10612 | $49.95 |
1 | Triple Axis Magnetometer Breakout - HMC5883L | Sparkfun | SEN-10530 | $14.95 |
1 | SJOne Board | SJSU | - | $75.00 |
1 | Logic Level Converter Bi-Directional | Sparkfun | BOB-12009 | $2.95 |
1 | Quad 2 Input Or Gate | On-Semiconductor | MC14071BCP | $2.25 |
1 | DX5E 5 Channel 2.4Ghz Tx/Rx Remote Control | Spektrum | DX5e | $89.99 |
1 | 4000mAH 25C 3S Lipo battery | Hyperion | - | $45.00 |
5 | EC5 male and female connector | Hobby King | - | $20.00 |
1 | Black Silicon coated wire 12AWG 1 meter | Hobby King | - | $5.00 |
1 | Red Silicon coated wire 12AWG 1 meter | Hobby King | - | $5.00 |
1 | 12x24 Aluminum Treadplate (0.063) | Home Depot | - | $34.78 |
2 | 1/2" Aluminum Trim Channel, 4' | Home Depot | - | $22.54 |
- | Misc Nuts and Bolts | Home Depot | - | $30.00 |
Total Cost | $753.36 |
Design & Implementation
Hardware Design
The quadcopter consists of two main groups: the airframe, and the flight controller subsystem. The airframe consists of arms of 1/2 inch aluminum trim channel arms, sandwiched by 1/16 inch aluminum diamond plate. The assembled airframe is show below.
The quadcopter project flight controller subsystem block diagram is shown below. The major components are the SJ One board, the remote RX, the quad 2 input or gate, the accelerometer, the gyroscope, and the magnetometer, the 4 ESC modules, and the motors connected to the ESCs.
The quadcopter power distribution diagram is shown below. All power comes from the on board 3S 4000mAh 25C Lithium Polymer battery. The battery puts out 11.1V nominal, and the ESC takes in the 11.1V and outputs a 5V output for use by the rest of the flight controller. The SJ One board takes in the 5V and creates 3.3V to be used by the rest of the components.
Hardware Interface
PWM In From Remote Ctrl
The DX5e on board receiver outputs 5 channels of PWM input running at a 50Hz refresh rate. The voltage levels of the PWM in are 5V. The SJ One board is not 5V tolerant, and there are not 5 channels of input capture pins available. In order to get the values requested by the remote control, one needs to translate the voltage levels to 3.3V, and to try to combine the signals to a single input. After researching on line, an example design was found that took the 5 channels of input and or'ed all of them together to get a single pulse train out. The example design also suggested a 5V tolerant part that would output 3.3V. After investigating the hardware that is used on the Quadcopter project, it was decided that this could work. A logic analyzer capture of the receiver output is shown below, as well as the output of the or gate. As is shown, the pulse train does not overlap, so the or gate is sufficient to handle both the level shift to 3.3V and the combining of signals.
Below is a logical representation of how the or gate is wired.
PWM Out
Quadcopters by nature need fast refresh rate on current position, and need low latency thru the control loop to actual commands to the motors. To help keep the latency low, the output PWM was ran at a faster than normal rate. The output PWM is running at 400hz instead of the normal 50hz refresh rate. The minimum pulse width is approx 1ms and the maximum pulse width is about 2 ms.
I2C Sensor Bus
The sensors all run off of a single I2C bus. The accelerometers base address is 0xE5, the magnetometer base address is 0x48, and the gyroscope base address is 0xD3. The I2C bus clock rate is 400kHz to help minimize the control loop latency.
Software Design
Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.
PWM In Capture
Remote Command Translator
I2C Driver
Data Smoothing
Sensor Fusion
PID
PWM Out
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
Testing & Technical Challenges
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.
Include sub-sections that list out a problem and solution, such as:
Wifi Connection Issues
Many wifi connection issues were encountered. To solve this problem, a dedicated task was created to re-connect to wifi if the connection was ever lost.
Conclusion
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?
Project Video
Upload a video of your project and post the link here.
Project Source Code
Send me your zipped source code and I will upload this to SourceForge and link it for you.
References
Acknowledgement
Any acknowledgement that you may wish to provide can be included here.
References Used
List any references used in project.
Appendix
You can list the references you used.