S14: Tricopter

From Embedded Systems Learning Academy
Revision as of 18:47, 20 May 2014 by Proj user2 (talk | contribs) (Design & Implementation)

Jump to: navigation, search

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.

Code name Cerberus

Abstract

The goal of this project is to produce a stable hovering tricopter. This craft will hover using three motors with three propellers, one of which is mounted on a swivelling piece that allows the raft to have more yaw control. The plan for this project is to use COTS parts for all but the flight controller which will be our software on an SJOne board. The flight controller is responsible for determining how fast each motor spins and the angle of the swivelling motor using inputted data from an accelerometer, a gyroscope, and possibly a magnetometer. The tricopter will elevate itself to a fixed height and using a barometer will stay stabilized at this height.

Introduction

Fig 1.Orientation

Multrirotor unmanned arial vehicles (UAV), have recently grown in popularity due to the reduced cost in parts. A highly agile variation of these multirotor copters are the tricopters. Tricopters apply equivalent principles of balance and orientation to that of traditional multirotors. Unlike symmetrical multirotors, tricopters require an additional servo to counteract yaw. Roll is controlled exclusively by the front left and right motors, where pitch is adjusted through a combination of all three.

Objectives

The objective of this project is to produce a Tricopter capable of rising to a given altitude, hovering in one position for at least 15 seconds, and then landing safely in the same position it took off from.

Maintaining stable flight is the key requirement for this project. Orientation is calculated using an accelerometer and gyroscope. The height above ground is determined using the output of an ultrasonic sensor.

Team Members & Responsibilities

  • Carlos Fernandez-Martinez
  • Shane Loretz
  • Michael Schneider

Schedule

Show a simple table or figures that show your scheduled as planned before you started working on the project. Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals. The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.

Week# Date Task Actual
1 3/21 Create schedule Delayed due to wiki-login issues
2 3/28 Build Tricopter frame, establish PWM communication Completed, PWM driver had to be replaced
3 4/4 Establish connection with IMU, create an orientation task Completed, no issues encountered
4 4/11 Complete the wiring of the frame, build power regulator for 5v Completed, regulator circuit unneeded, ESCs provide adequate power
5 4/18 Integrate motor control task with orientation task Completed, no issues encountered
6 4/25 Balancing and orientation test In progress

Parts List & Cost

Give a simple list of the cost of your project broken down by components. Do not write long stories here.


Name Quantity Price
Turnigy Park480 3 $61.47
Hobby King 30A ESC 3 $30.45
Corona 919MG Servo 1 $7.01
Sunkee 10DOF 1 $20.00
Hobbyking X900 1 $32.16
Prop 9047 3 $9.48
Truningy 5800mah 1 $27.85
Cables / Connectors N/A $20.00
SJSU One Board 1 $80.00
Total $292.00

Design & Implementation

The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.

Hardware Interface

In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.

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.

--


Major Tasks: Orientation (incl. sensor data acquisition, orientation calcs)

Motor Control (incl. motors & servo control, fail safe, timer)

Orientation

The orientation is calculated with a combination of the accelerometer and gyroscope readings.

Orientation is expressed in radians from a level position

X (roll) Y (pitch) Z (yaw)
Positive Rolled left Pitched down Yawed counter clock wise
Negative Rolled right Pitched up Yawed clock wise

Angular velocity is specified in radians per second

X (roll) Y (pitch) Z (yaw)
Positive Rolling left Pitching up Yawing counter clock wise
Negative Rolling right Pitching down Yawing clock wise

Accelerometer

The accelerometer readings give the instantaneous acceleration. When the accelerometer is not moving, the only acceleration comes from gravity. If the device is flat, the entire gravitational acceleration is in the vertical (Z) component of acceleration, as shown below:

<<pic flat acceleration>>

The accelerometer reading in this instance would be <0g, 0g, 1g>, where g ~= 9.8m/s^2. However, if the accelerometer is not flat, the gravitational acceleration splits into both horizontal and vertical components, as shown below:

<<pic tilted acceleration>>

With simple trigonometry, the angle that the accelerometer is at can be calculated using these two components and an inverse tangent function:

146 s14 tricopter accel angle calc.png

Gyroscope

The gyroscope readings give the angular velocity. To calculate an angle, these readings can be integrated:

146 s14 tricopter angle calculation.png

However, these readings are subject to "drift", where they do not return back to 0 due to small errors in the integration process.

Orientation Calculation

The solution to both of the accelerometer and gyroscope shortcomings is to filter and combine them. The accelerometer data can be trusted in the long term, since it is accurate when the craft is stable. Therefore the accelerometer data is low pass filtered. The gyroscope data can be trusted in the short term, since it is accurate when the craft is moving. Therefore, the gyroscope data is high pass filtered. The two are then combined to produce a fairly accurate orientation value.

146 s14 tricopter orientation x formula.png

146 s14 tricopter orientation y formula.png

The accelerometer cannot give any acceleration data for the Z (yaw) axis, so the orientation is only calculated using the integral of the gyroscope data. In testing, this proved to be accurate enough for our uses since the craft does not yaw significantly.

146 s14 tricopter orientation z calculation.png


Motor Control

Motor speeds are increased and decreased to get back to an orientation of (0,0,0) (level flight). The motors are controlled by electronic speed controllers (ESC's). These take a servo PWM signal as input and use the pulse width to control the speed of a 3-wire brush-less motor. The tricopter has three motor/ESC pairs.

Motor 1 Front left
Motor 2 Front right
Motor 3 back (with servo)



Balancing Algorithm

The first balancing algorithm we tried was the following

Correcting Roll options

  • Increase 1, decrease 2
  • Decrease 1, increase 2

Correcting Yaw

  • Rotate 3

Correcting Pitch

  • Increase 1 and 2
  • Decrease 1 and 2

Correcting height

  • Increase all
  • Decrease all


Fail safe

The fail safe kills all power to the motors by sending the lowest throttle position signal to the ESCs

Reasons fail safe activates

  • X orientation exceeds 45 degrees
  • Y orientation exceeds 45 degrees
  • Height exceeds 18 inches
  • Time is less than 5 seconds since bootup
  • Time is greater than 30 seconds since bootup

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:

Issue #1

The first issue encountered was related to interfacing the ESCs with the SJSU-ONE PWM driver. The PWM driver would provide a pulse-width of 5ms, thus exceeding the required 1-2ms range. To resolve this issue, the team wrote a new driver in order to preserve the 1-2ms pulse-width range. The new driver largely mimicked the provided one, however the calculation for the pulse-width was modified to:

                         pulseWidth = sys_get_cpu_clock() * ( (percent/100 * (MAX_PULSE - MIN_PULSE) ) + MIN_PULSE );


Issue #2

The Sunkee 10DOF IMU being a low end device, proved to be susceptible to the vibrations from the motor. This susceptibility lead to erratic measurements. To resolve this issue the motors and IMU where placed on rubber mounts. This aided in reducing the erratic measurements, however due to the severe vibrations induced by the motors additional software filtering was needed. Both the gyroscope and accelemoter data where placed through a rudimentary low-pass software filter. To further counteract system noise, a average of the calculated orientation value is computed prior to being sent to the balancing algorithm.

Issue #3

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

Appendix

You can list the references you used.