Quadcopter Flight Control System

Print   

02 Nov 2017

Disclaimer:
This essay has been written and submitted by students and is not an example of our work. Please click this link to view samples of our professional work witten by our professional essay writers. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of EssayCompany.

The purpose of the report being presented here is to examine the design of a control system used to pilot a Quadcopter. The control system will consist of three main components; an Arduino microcontroller board, sensors and ground station communication. The Arduino will interpret harvested from an array of sensors.

The sensors were characterised using harvested data to gain a greater understanding of how they operate and what their limitations are regarding flight control.

This report will also explore how this data will be integrated into an Arduino Programme. The use of Arduino microcontroller boards offers many benefits; they are relatively cheap, versatile, re-usable and have a large community of developers with support readily available. The objectives of this report are; writing programmes with the Arduino Programming application, and combining the Arduino and sensors.

Introduction

The aim of this Project is to develop a Flight Control System for a Quadcopter, using open source Technology. The idea for this Project came about through my interests in the Military, Aviation and Robotics where there is a new Technological breakthrough in the area of unmanned vehicles occurring at an ever increasing pace. For years the Technology for autonomous unmanned vehicles was highly expensive and used by government funded agencies like NASA for Space exploration and the Military with UAV’s (Unmanned Aerial Vehicles) such as the MQ-1 Predator, RQ-4 Global Hawk and RQ-170 Sentinel and more recently RUAV’s (Rotary Unmanned Aerial Vehicles) such as the MQ-8 Fire Scout, all of which are all used for intelligence gathering and armed attacks while keeping the operator in a safe location.

As was mentioned previously, this project set out to develop a Flight Control System for a Quadcopter using open source technology with an Arduino microcontroller board at its heart. The control system is intended to interpret the data being received by sensors, and then compute a response to any instability present in order to maintain flight.

Aims and Objectives

Project Aim

The primary aim of the project presented here is to programme an open source Arduino microcontroller board capable of maintaining flight at an altitude to be determined by the user. The Arduino will be aided by several sensors including an accelerometer, magnetometer, sonar rangefinder and a gyroscope. The Arduino will then interpret the data from each sensor and implement them into the control system compute the necessary motor reactions required to maintain flight.

Project Objectives

This project consists of five sequential phases, each having its own objectives.

Research:

Open Source Technology.

Research Arduino, its programming language and how it works.

Quadcopters and how they are controlled.

Learn:

Arduino Programming.

Quadcopter Flight controls.

Design:

Review existing Quadcopters.

Design Quadcopter Control system.

Order the required parts.

Build:

Assemble the Quadcopter test bed.

Assemble the Arduino microcontroller and sensors.

Write Arduino code.

Incorporate Sensors into the Arduino code.

Incorporate Wireless communication.

First test flight of the Quadcopter.

Verify:

Debug the Arduino code.

Final flight testing.

Construct Theses.

Final Project Submission.

Literature Review

What is open source

Open source is a philosophy; it promotes the distribution of a products design or source code to the end user free of charge. The source code is usually protected under the open source license; the source code is made available for end users to access and modify to their own preferences if necessary. A person or persons cannot redistribute the software without going through the correct licensing process. There are many benefits to open source technology, the main one being it is free to download and use by anybody. The real benefits of using open source technology come from allowing other end users access to the software, as a community of volunteer developer’s, programmers and engineers have the ability to improve on work carried out by the original product developer. In recent surveys, it has been indicated that the adoption of open source technology has saved consumers billions of dollars. Open source software has become a major player in today's market due to the reliability and stability of the platforms available. This project and its component parts where conceived using open source software and technology that was readily available via the internet. [Open Source 2012]

What is a Quadcopter

A Quadcopter is a multicopter with four arms; each arm has a motor coupled with a Propeller with symmetrically pitched blades mounted at its end providing lift and propulsion. In the typical configuration the rotors are arranged with two rotors turning clockwise and two rotors turning counter-clockwise. See Figure : Quadcopter Motor layout, located below.

http://upload.wikimedia.org/wikipedia/commons/2/2a/Quadrotor_yaw_torque.png

Figure : Quadcopter Motor layout

The motors are arranged in this configuration so that the net aerodynamic torque in the yaw axis is zero; this eradicates the need for the stabilisation rotor seen in conventional Helicopter designs. Each pair of blades rotating in the same direction controls its associated axis, either roll or pitch, and increasing thrust for one rotor while decreasing thrust for its counterpart will maintain the torque balance required for yaw stability and induce a net torque about the roll or pitch axes. Using this configuration, fixed rotor blades can be made to maneuver the Quadcopter in all dimensions. See Figure : Quadcopter axis for a diagram describing the yaw, pitch and roll axis of a Quadcopter.

Sensors

This project aims to analyse the data from numerous sensors simultaneously to control the flight of a Quadcopter. This is achieved using the following sensors.

Accelerometers: 3 axis accelerometers are used to detect the magnitude and direction of proper acceleration (Proper acceleration g= 9.81 m/s2) as a vector quantity to determine the Quadcopters orientation to the Earth’s surface. When the Quadcopter is tilted, the Accelerometer measures the change in orientation with respect to the Earth’s surface, See Figure : Hover (Flight Physics 2012), located in the appendices. An accelerometer behaves in the same way as a damped mass on a spring. When the accelerometer experiences acceleration, the mass is displaced to the point that the spring is able to accelerate the mass at the same rate as the casing. The displacement is then measured to give the acceleration. An Inertial Navigation System is a navigation aid that uses sensors and accelerometers to continuously calculate orientation, and velocity of the Quadcopter. Modern accelerometers, such as the MPU – 6000 found on the ArduIMUv3+ are small micro electro-mechanical systems (MEMS), made up of little more than a cantilever beam with a proof mass.

Sonar rangefinders: Sonar was originally an acronym for Sound Navigation and Ranging, but the term is also used for the equipment which is used to generate and receive the sound waves. There are two main types of sonar; Passive Sonar which only listens for other sounds, and Active sonar which emits sound and listens for the echoes produced by that sound. See below Figure : Active Sonar.

http://upload.wikimedia.org/wikipedia/commons/thumb/0/07/Sonar_Principle_EN.svg/400px-Sonar_Principle_EN.svg.png

Figure : Active Sonar

The Acoustic frequencies used in sonar vary from infrasonic, meaning very low frequencies to ultrasonic, meaning very high frequencies. Active sonar; which is used in this project, creates a pulse of sound; known as a ping, and then listens for echo. This pulse of sound is generally created electronically using a sonar projector consisting of several components, usually a signal generator, power amplifier and electro-acoustic transducer. A beam former is then employed to concentrate the acoustic power into a beam directed at the distance to be measured.

To measure the distance to an object, a ping is first generated, this activates a timer (usually milliseconds); when the echo returns to the sonar device the timer is stopped. To covert this value to a distance it is then scaled to the speed of sound in air and divided by two.

Magnetometers: A magnetometer is a device used to measure the strength and direction of magnetic fields; they are capable of measuring the Earth’s magnetic field as well as smaller localised magnetic fields of Magnets or Ferrous Metals. Recently, magnetometers have been miniaturised and incorporated into integrated circuits creating a low cost compass solution which is used in consumer devices.

Magnetometers fall into one of two categories; Vector magnetometers are capable of measuring the magnetic field in a particular direction. Scalar Magnetometers are only capable of measuring the strength of a magnetic field.

A 3 axis vector magnetometer such as the HMC5883L is used in this project for orientating the Quadcopter to the correct bearing direction. Since the Earth’s magnetic field at any given point can be calculated a vector.

Gyroscopes: A gyroscope can be defined a device for measuring or maintaining orientation. MEMS (Micro Electro Mechanical systems) Gyroscopes which are typically mounted on an electronic circuit consist of two oscillating masses which constantly move in opposing directions. This type of gyroscope is capable of measuring angular acceleration and angular displacement. In the case of this project an MPU – 6000, 3 axes Gyroscope are used as a relatively inexpensive attitude indicator to detect the Quadcopters’ change in Attitude whilst hovering or manoeuvring. Gyroscopes are used in this configuration when magnetometers not sufficient to stabilize flying vehicles such as a Quadcopter.

Controllers

A Microcontroller in the simplest of terms is a small computer on a single integrated circuit containing a processor, memory, and programmable input/output peripherals. Microcontrollers are designed for fixed applications, which differ from microprocessors used in areas such as Mobile devices, personal Computer and other general purpose applications. Microprocessors usually preform a multitude of task simultaneously; a microcontroller on the other hand is typically dedicated toward a single task. Microcontrollers consist of four main components; the first is a CPU (Central Processing Unit), this is the brain of the microcontroller which preforms all of the calculations and logic operations enabling the programme to perform its task as required, the CPU extracts programme data from its location in the memory and executes the programme. The second is memory; the memory allows a microcontroller to store information so it can be recalled at a later time when it is needed. The third component is the system clock which is based off an oscillator, typically quartz crystal is used due to its high frequency stability, and the frequency of an oscillator has a direct impact on the synchronisation of internal operations and the speed at which a programme is executed. The final component is the microcontroller’s peripherals, in order to input data or receive data from a microcontroller peripherals are a necessity; the peripherals on a microcontroller are usually associated with an input or output pin; an input pin typically receives data from an external sensor which is then interpreted by the CPU, the CPU will then perform the required calculations and logic operations to determine whether an output is required, such as activating an external component.

This project utilizes two very similar microcontroller boards the Arduino Uno R3 and the Arduino Mega R3. The Arduino Mega and Uno differ in a small number of features as seen below in Table : Arduino differences.

Arduino Mega

Arduino Uno

Microcontroller

Atmega2560

Atmega328

Digital I/O pins

54 (15 PWM)

14 (6 PWM)

Analog Pins

16

6

Flash Memory

256 KB

32 KB

SRAM

8 KB

2 KB

EPROM

4 KB

1 KB

Table : Arduino differences

This project will utilize an Arduino Mega microcontroller board which will interpret information from input pins connected to the sensors, and calculate a response to any instability which has been detected, and then it will send a signal to the required output pins with a corrective action to counteract any instability. An Arduino Uno will possibly act as a Ground Station establishing communication with the Arduino Mega after succesful testing with a tether.

Communication

RF Modules (Radio Frequency Modules) are small electronic circuits used to transmit and receive radio signals over a range of frequencies; in order to receive a radio signal the use of an Antenna is essential, however since an Antenna can potentially detect thousands of frequencies at any one time, a resonator is then used to tune into a particular frequency range to establish communication. A resonator amplifies frequencies within the desired frequency range and filters out frequencies which do not fall within the selected frequency range.

Xbee Modules are a drop in solution to the problem of wireless communication; they are capable of providing wireless communication between devices over extended ranges, up to 45 kilometres in models such as the Xbee-Pro XSC (S3B) with the use of a high gain Antenna and clear line of sight between modules.

The Xbee 802.15.4 series are relatively cheap and provide close range, low latency and predictable communication; it also connected with the large open source developer community associated with Arduino.

Bluetooth technology is a universal standard for short range radio communications which is utilised in billions of devices throughout the world; which range from cars and medical equipment to mobile devices as a means of eliminating wires and cables. One of the key advantages of Bluetooth wireless technology is the ability to simultaneously handle data and voice transmissions; which provides the user with a range of solutions such as the synchronization of their mobile phone and computer content, while using a hands free headset to answer a call.

A Bluetooth device consists of a Transceiver chip which simultaneously sends and receives data following the Bluetooth communication protocols. Bluetooth operates on the 2.4 – 2.485 GHz frequency band as do many other devices but with one key difference; Bluetooth makes use of AHF (adaptive frequency hopping). AHF reduces interference between a Bluetooth enabled device and others which operate within the 2.4 GHz spectrum: this is accomplished by detecting the frequency other devices occupy and evading those frequencies in 1 MHz intervals.

Range is application specific feature of Bluetooth and although a minimum range of 10 meters is mandated by the Core Specification, there is not a limit and manufacturers can tune their device to support the range they require. 

Range will vary depending on class of radio used in device:

Class 3 radios – have a range of up to 1 meter.

Class 2 radios – found in mobile devices – have a range of 10 meters.

Class 1 radios – used primarily in industry – have a range of 100 meters.

Implementing Bluetooth into an Arduino project is relatively simple and in some cases just requires the user to include a pre written library in the Arduino code and to pair the devices using a configuration tool such as SSCOM to enable serial communication and is growing in popularity among the Arduino community. A Bluetooth module provides a cheap drop in solution which is dependable, has very low power consumption and low latency communication.

Ground Station

A ground station is most commonly known as a telecommunication point between Earth, manned space stations, and orbiting Satellites; but in the case of this project the primary function will be to establish wireless communication to the Arduino located on the Quadcopter via an Xbee, or another wireless module.

A Ground station for this application may consist of either a Laptop or Arduino wirelessly connected to the Quadcopter. The Ground station could then be used to deliver commands to the Quadcopter whilst simultaneously receiving telemetry data from the sensors connected to the Arduino on board the Quadcopter giving real time information to the operator. Possible enhancements to the Quadcopter to Ground station partnership might include the introduction of a colour/infrared imaging system, a payload delivery system, or environmental sensors to assess whether or not an area is safe for humans to enter such as gas sensors to survey air quality, or radiation sensors to analyse ambient radiation levels, keeping the operator at a safe distance from the potential hazard.

Project Plan

Timeline

As for any project, good project management and a clearly defined schedule are vital to success. A project is best managed when a large task is broken down into smaller individual tasks. This method makes a project more manageable, with each task having its own deadline it is easier to see what has been done so far and what task needs to be completed before moving on to the next one. See Figure : Gantt chart located in the Appendix G.

Bill of Materials

The Bill of materials is a list of the required components required to build the control system and Quadcopter for testing. See Table : Bill of Materials shown below.

Part

Number Required

Price €

Arduino Uno

1

0

Arduino Mega

1

0

Wireless Modules

1

0

Wireless Adapter

2

0

Inertial measurement Unit

1

0

Sonar Rangefinder

1

0

Electronic Speed Controller

4

0

Brushless Motors

4

0

Table : Bill of Materials

Technical description

Design overview

The design overview, which is shown below Error: Reference source not foundw, is a simple block diagram describing how each element of the control system is connected to one another.

Figure : Basic Design Overview

Electrical schematic

The electrical schematic for the project, Error: Reference source not found shown below; explains how each component is electrically connected to the power supply, and to one another for communication.

Figure : Electrical Schematic

Programming the Arduino

The programming of this project will be carried out using the Arduino IDE (development environment). The Arduino IDE contains an editor used to write programmes (known as sketches) in a programming language modelled heavily on another language called Processing.

When uploading a programme to the Arduino, the code is first converted to a C programme, and then complied. This process produces a binary code that can be understood by the Arduino; The Programme is uploaded by a computer connected to the Arduino via a USB connection, the programme is then stored on the Arduino’s flash memory.

Writing the Arduino Program

When writing a programme it is essential to have a clear list of criteria the code has to meet to be successful. In the case of this project, several pieces of code have to be composed before writing the main programme to control the Quadcopter.

Writing the IMU Program

The first piece of code to be written was the communication bridge between the IMU board and Arduino. The ArduIMU board is comprised of three main components; an MPU-6000 combined accelerometer/gyroscope each having 3 axis, the HMC-5883L 3 axis magnetometer and an Atmega 328 microcontroller, this results in an IMU capable of 9 degrees of freedom. Programming a solution to this problem begins with outlining the steps involved in utilising the IMU data which is transmitted to the Arduino board via Serial communications protocol, shown in Figure : IMU Code Diagram below. Engineering a solution to this problem involved using methods which had limited literature available as the Arduino programming language is missing several C commands such as Serial.Split() which enables the programme to easily separate several comma separated values from one serial string; because this command is missing, a more complicated approach must be taken which involves separating individual values from the array based on their position.

The next step in this programme involves verifying that the values which have been separated are useable in the main programme; this is done by capping the amount of comma separated values in the string, and only reading them if it contains ASCII characters between 0 and 9 (including negative values).

After the data has passed the criteria, the value is temporarily stored in the Arduino’s memory where it remains until it is either utilised or replaced by the next value of that particular variable.

Figure : IMU Code Diagram

Writing the Sonar Program

The second programme to be written is to be used for gathering data from the Sonar device used to calculate the vertical position of the Quadcopter. The MaxSonar EZ-4 is a combined transmitter and receiver module which is capable of taking measurements at a rate of 20 Hz. The EZ-4 has three methods of communication at its disposal; Serial, Analogue and PWM (Pulse Width Modulation). In the case of this project PWM has been chosen for its straightforward implantation into an Arduino code with a scaling factor of 58 µs per cm.

Composing the Sonar code was relatively straightforward as the MaxSonar series of devices are very popular throughout the Arduino community where support and examples of how the device can be implemented are easily obtained.

When the programme is initiated, the Sonar transmits a ping and starts a timer simultaneously, when the Sonar receives the echo from the ping it transmitted earlier the timer stops and this sequence is repeated until power is removed from the device. The Sonar then transmits the length of time taken to receive the echo via the PWM pin. When the Arduino receives this data it implements the scaling factor to convert the time taken into distance measured and stores the value as part of an array, this process is completed eight more times until the array has been filled. Once the array has been filled, the mean or if it is impossible to calculate one, the mode will be calculated. When the mean/mode has been calculated it is temporarily stored within the Arduino’s memory to be called up when it is needed by the main Quadcopter programme. See Error: Reference source not found for an example of how the code is constructed; located on page 23

Figure : Sonar Code Diagram

Writing the Motor control Program

Writing the motor control program involved the use of an Arduino standard library to gain the required functionality from the Arduino board. Since there is no library for brushless motors the "Servo.h" library was utilised in the motor control program. The Servo library is used to control standard servo motors using a digital Pulse Width Modulated (PWM) signal through their full range of motion from 0° to 180°; with 90° as the home or zero position, 0° being the maximum counter clockwise rotation and 180° being the maximum clockwise rotation.

Understanding how the servo library works, it was then much easier to write the code responsible for arming the motors. To arm the motors, a PWM signal of 100% power is sent from the Arduino, to the ESC; the signal is maintained for 5 seconds before being stopped. If the arming procedure has been successful to motor should be able to operate when it receives the next signal from the Arduino as seen in Figure : Motor control.

Figure : Motor control

In the case of the motor test program "6.3 Testing the Motors" the same

Integrating the Programs

Designing the Control system

Testing

Testing of the Quadcopter has been concentrated on the two main sensors involved in controlling flight:

The first is the IMU board (Inertial Measurement Unit) which is composed of three sensors; an accelerometer, used to measure the acceleration in the three body axis (X, Y and Z); a magnetometer, which is used to measure the magnetic field in the three body axis and calculate magnetic north; and a gyroscope, used to measure the rate of turn in the three axis.

The second is the Sonar, which is responsible for measuring the distance vertically from the Quadcopter to the earth.

Testing the IMU

Testing of the IMU, more specifically to the HMC5883L 3 Axis Magnetometer located on the IMU board. See below Figure : Magnetometer Static test & Figure : Magnetometer being rotated; these tests have only included two of the three axis available, the X and Y; the Z axis will be included in further testing. The Z axis accounts for tilting so the IMU does not need to be mounted on a flat surface. See appendices Figure : ArduIMUv3+ Axis for a diagram of axis available to the ArduIMUv3+.

To extract the data a test programme was installed on the IMU board, the IMU board is itself an Arduino with and Atmega 328 processor on board to calculate the data from its three sensors; the data is then transmitted via a serial connection to another Arduino using either the ASCII or Binary programming languages, the data is then interpreted by the Arduino, or in this case a Computer. In Figure : Magnetometer Static test 20 random data points where selected for evaluation; in Figure : Magnetometer being rotated 30 data points were selected to demonstrate the effect of the IMU being rotated.

MGX= gauss detected in the ‘X’ axis.

MGY= gauss detected in the ‘Y’ axis.

Figure : Magnetometer Static test

Figure : Magnetometer being rotated

Testing the Sonar

The second sensor under test was the MaxSonar EZ-4, see Figure : Sonar datasheet located in the appendices. The test was carried out at a distance of approximately 65cm and obstacles were introduced and removed to simulate the Quadcopter traversing over uneven ground.

While testing the Sonar, several issues became apparent. The first version of the Sonar programme under test simply read the values returned by the Sonar; it had several issues and was prone to returning spurious data such as large spikes in measured distance, shown in Figure : Sonar Direct Distance below, this could trigger aggressive responses to non-existent obstacles, causing the Quadcopter to collide with a real obstacle.

The second issue involved certain materials such as carpet, which could absorb the sound transmitted by the Sonar and prevent the echo from returning to the electro-acoustic transducer causing a strange affect where there was a -480cm value returned as seen in Figure : Sonar Absorbent Material below, the Sonar would become unusable in such an environment and would have to be supplemented with a barometer and or an infrared sensor to construct a more dependable system for measuring the altitude of the Quadcopter.

Figure : Sonar Direct Distance

Figure : Sonar Absorbent Material

The second attempt at writing a programme for the Sonar was for more successful and returned reliable data, but this reliability means the Arduino receives useable data at a slower speed.

To calculate the distance a filter was applied that stores several values as an array, the array is then used to calculate the mean distance value or if this is unobtainable, the mode value is substituted in its place. This programme produced results which were much more consistent when compared with previous attempts, see Figure : Sonar Mean/Mode below which demonstrates the output as obstacles are introduced and removed at varying distances.

Figure : Sonar Mean/Mode

Testing the Motors

The final testing which was carried out in this project was the Motors and ESC’s; the motors require the use of ESC’s to receive commands form the Arduino, the Arduino sends the ESC a digital Pulse Width Modulated signal which then provides the motors with the necessary voltage from the power supply.

Testing was broken into two steps. The first test consisted of arming a single motor, then ramping the speed from 0% to 40% in 5% increments, when the motor has reached 40% there is a delay of five seconds to ensure the motor and program are functioning correctly before stopping the motors and disarming them.

The second test was intended to ensure that all motors and ESC’s were functioning correctly when activated simultaneously. The procedure, as before involved ramping the speed from 0% to 40% in 5% increments with the delay of five seconds once the motors had reached 40%, followed by stopping and disarming the four motors.

Problems encountered during testing

Through testing it became evident that there were several issues with the Motors and ESC’s.

During the second test in "6.3 Testing the Motors" only one of the motors functioned as expected, which was the same used in previous tests. It was discovered through troubleshooting every possible combination that three of the four motors, and three of the four ESC’s had become damaged and worked with varying functionality; some motors where working at reduced speed and others not at all. It remains unclear if this was an issue which originated during they’re manufacturing or an electrical fault while testing the components, as they were each supplied the same current then the remaining Motor and ESC; which was used in the first test should have been damaged also.

Due to the time and budget constraints, ordering new components was not feasible and further testing involving controlling the motors was abandoned.

Conclusion

The primary goal of this project is to investigate the process of developing a Control system capable of piloting a Quadcopter without human interaction.

This project has provided an extensive view of how different systems are linked with one another to make a unified control system. The knowledge of multiple aspects of engineering starting from the control theory, to sensor analysis and programming has to be implemented to ensure the Quadcopter will perform as expected.

The project has strayed from the schedule as seen in Figure : Gantt chart located in the appendices, but this had been expected as early as assessment 2. Implementation of sensors has proved to be tricky in the case of the IMU with communication issues causing setbacks as regards the development of the main Quadcopter programme.

There is a considerable amount of learning involved in the areas of programming, robotics, control theory and flight dynamics for this project which then has to be implemented to be considered a success. If there are significant delays and an effort to model the control system in Simulink may be investigated.

Future work

The project has several objectives for the next assessment; the first is to iron out communication problems between the IMU and Arduino.

The second is to implement a simplified state-space control model which takes inputs from the IMU and Sonar and computes the responses for each motor necessary to maintain flight. The third objective is to begin testing the assembled control system.



rev

Our Service Portfolio

jb

Want To Place An Order Quickly?

Then shoot us a message on Whatsapp, WeChat or Gmail. We are available 24/7 to assist you.

whatsapp

Do not panic, you are at the right place

jb

Visit Our essay writting help page to get all the details and guidence on availing our assiatance service.

Get 20% Discount, Now
£19 £14/ Per Page
14 days delivery time

Our writting assistance service is undoubtedly one of the most affordable writting assistance services and we have highly qualified professionls to help you with your work. So what are you waiting for, click below to order now.

Get An Instant Quote

ORDER TODAY!

Our experts are ready to assist you, call us to get a free quote or order now to get succeed in your academics writing.

Get a Free Quote Order Now