Difference between revisions of "S14: Quadcopter"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Software Design)
(Converting Remote Control Data to Motor Speed)
Line 204: Line 204:
 
==== Converting Remote Control Data to Motor Speed ====
 
==== Converting Remote Control Data to Motor Speed ====
 
The following steps are involved in converting raw RC (remote control) data to motor speed
 
The following steps are involved in converting raw RC (remote control) data to motor speed
1. Get the RC data. Usually a PWM signal
+
# 1. Get the RC data. Usually a PWM signal
2. Scale up/down this value using a pre-decided curve. (Linear/Exponential)
+
# 2. Scale up/down this value using a pre-decided curve. (Linear/Exponential)
3. Apply PID on Roll/Pitch/Yaw data.
+
# 3. Apply PID on Roll/Pitch/Yaw data.
4. Convert the output of PID into angles.
+
# 4. Convert the output of PID into angles.
5. Adjust the angles with the angles calculated by IMU (Inertial Measurement Unit)
+
# 5. Adjust the angles with the angles calculated by IMU (Inertial Measurement Unit)
6. Use these angles to adjust motor speeds and direction
+
# 6. Use these angles to adjust motor speeds and direction
  
 
=== Implementation ===
 
=== Implementation ===

Revision as of 19:59, 17 April 2014

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

Our team aims to build a Quadcopter (Quad-rotor helicopter), which is a multi-rotor aerial vehicle that is lifted and propelled by four rotors. The thrust generated by the propellers lifts the Quadcopter while the flight controller system govern the rotor speed for attitude control. A wireless remote control is used to interact with the flight controller system for changing the flight path. Our objective would be todesign and build a flight controller system that stabilizes the flight and accept commands from a hobbyist remote control during its flight.

Objectives & Introduction

The scope of our project can be divided into three parts:

  • Design and build interfaces to all the on-board electronic sensor such as IMU, barometer and distance sensors
  • Design and build interfaces to telemetry and radio modules to communicate with remote control and the computer
  • Process the various sensor inputs and control the brushless motors on board using an electronic speed control system to stabilize the aircraft

Team Members & Responsibilities

  1. Sree Harsha
    • PWM Design, Remote Control Input, Quadcopter assembly
  2. Balaji
    • Sensor Data Processing, Quadcopter Assembly
  3. Divya Kamath
    • Flight Controller Design, Code Integration

Schedule

Sl. No Start Date End Date Task Status Actual Completion Date
1 2/28 2/28 Order Components and Make a schedule Component Ordering Partially Completed (critical components done), Motors pending. (Update 4/14 - All components ordered) 3/7/2014
2 3/1 3/30 Components Procurement. Motors arrived but don't fit into the frame. Got motor mounts from Century Heli shop, drilled holes to fit the motors, backup IMU arrived.(Update 4/14 - All components ordered) 3/21/2014.
3 2/20 3/15 Establish communication with all sensors and validate data IMU done. 3/14/2014
4 2/28 3/5 Establish communication with radio module of remote control Coding complete. Testing in progress with Radio remote and receiver.
5 2/28 3/5 Speed control of motors Flashed SimonKK firmware to ESC. One of the ESC went kaput and 2 others have problem running at slower speeds. Tested with another set and motors work fine. Ordered Afro ESC with pre SimonKK firmware flashed. Another frame, radio and few other components ordered as backup. 3/29/2014
6 2/28 3/25 Flight Controller Algorithm (PID Controller) Coding. Playing with the coefficients. (Update 4/14 - Coding Completed, testing pending)
7 3/15 3/30 Create tasks and integrate complete code In progress. (Update 4/14 - PID completed, Flight Controller tasks completed. Device driver for RC input ready. Pending - PWM (motors), Math calculation for motor speed from Raw RC data and sensor angles, UART communication and parser for IMU data)
8 4/10 4/10 Assemble quadcopter Complete. Initial flight test with reference flight controller shows jitters with radio PWM input. Magnetometer goes crazy because of motor magnetic field. Control system and sensors will now be placed on an elevated platform. 3/29/2014
9 4/10 4/18 Initial testing and tweaks In progress
10 4/15 - End Final Testing

Parts List & Cost

Qty Description Manufacturer Part Number Total Cost
4 4x Electric Speed Controller (ESC) Turnigy Plush 25 $50.00
4 Turnigy Multistar 4822-690Kv 22Pole Multi-Rotor Outrunner Turnigy 9392000004 $180.00
1 Inertial measurement unit (IMU) MPU-9150 Sparkfun SEN-11486 $40.00
1 SJOne Board Preet LPC1758 SJSU CmpE Board $80.00
1 DX6i 6 Channel 2.4Ghz Tx/Rx Remote Control Spektrum DX6i $140.00
1 Turnigy nano-tech 6000mah Lipo battery Turnigy - $15.97
1 Quadcopter frame HJ MWC - $21.26
2 Motor mounts Century Heli - $25.94
2 10x4.5MR, 10x4.5MRP Propellers, Prop Adapter Ring Set APC $26.94
2 6000mAH 4S LIPO battery HJ MWC - $21.26
Total Cost increasing !

Backup Parts & cost

Qty Description Manufacturer Part Number Total Cost
1 6000mAH 4S LIPO battery hardcase Turnigy $50.00
2 Invensence 9150 IMU Breakout board ebay $17.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.

Pin Connections

Sl. No Port and Pin Number Pin Type Purpose
1 P0.0 and P0.1 UART 3 IMU Communication (Arduino)
2 P2.4, P2.5, P2.6, P2.7, P0.29, P0.30 GPIO Input Remote Control Receiver Input
3 P2.0, P2.1, P2. 2, P2.3 PWM PWM output to motors
4 P2.8, P2.9 UART2 ZigBee telemetry

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.

Current Design UART for reading sensor data PWM for motor control UART for telemetry

Software Design

MPU-9150

The MPU-9150 consists of a 3-axis accelerometer, 3axis Gyroscope and a 3 axis magnetometer. its a one chip IMU solution with onboard Motion processor for sensor fusion.Though it inherently supports on board Sensor Fusion, the IP is undisclosed. Therefore we used the library for arduino by Pansenti. (https://github.com/Pansenti) The 6 axis sensor fusion (accel+gyro) is done on the MPU and sent to an arduino where the magnetometer data is used for YAW correction. The arduino transmits the orientation data over UART which is recieved by the SJONE for further processing.

For testing, we coded a GUI in python. The code parses the serial data from the arduino and displays the orientation of the IMU in real-time using Vpython.(video and code to be linked).

PID Controller

For our flight controller algorithm, we are using a PID controller. PID (proportional, integral, derivative) controller is a feedback control system which attempts to minimize the error in the output using three constant values: P, I and D i.e. the proportional, integral and derivative values.

Converting Remote Control Data to Motor Speed

The following steps are involved in converting raw RC (remote control) data to motor speed

  1. 1. Get the RC data. Usually a PWM signal
  2. 2. Scale up/down this value using a pre-decided curve. (Linear/Exponential)
  3. 3. Apply PID on Roll/Pitch/Yaw data.
  4. 4. Convert the output of PID into angles.
  5. 5. Adjust the angles with the angles calculated by IMU (Inertial Measurement Unit)
  6. 6. Use these angles to adjust motor speeds and direction

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.

Mechanical Design

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:

My Issue #1

Discuss the issue and resolution.

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

  1. https://github.com/Pansenti
  2. https://code.google.com/p/sf9domahrs/
  3. http://www.rcgroups.com/forums/showthread.php?t=1284741
  4. http://blog.oscarliang.net/quadcopter-pid-explained-tuning/
  5. http://aeroquad.com/showthread.php?1167-Stable-Mode-Explained
  6. http://www.ece.ucdavis.edu/~spencer/195/datasheets/PID-Without-a-PhD.pdf
  7. http://support.motioneng.com/downloads-notes/tuning/pid_overshoot.htm

Appendix

You can list the references you used.