You are on page 1of 47

Design of an unmanned aerial vehicle based on the AUTOPILOTING

NIKHIL G MADHU VISHNU S V ANISH J SAJIN GUIDE : SAGAI FRANCIS BRITTO

ABSTRACT

This project focuses on the design, modeling, implementation and testing of an autonomous unmanned aerial vehicle. The controller is based on an Ardupilot board which is a custom PCB with an embedded processor (ATMega168) combined with circuitry to switch control between the RC control and the autopilot control. It controls navigation (following GPS waypoints) and altitude by controlling the rudder and throttle. It uses flight stabilization system (co-pilot), a sensor pack, Global Positioning System (GPS) and an RF transceiver to monitor and report crucial parameters such as altitude, speed, pitch, roll, and position. An embedded software algorithm has been developed to enable the aerial vehicle accomplish the required autonomy and maintain satisfactory flight operation. The autopilot features an advanced, highly autonomous flight control system with an auto-launch and auto landing algorithms.

TABLE OF CONTENT

SL NO.

TITLE

PAGE NO.

ABSTRACT 1. 1.1 1.2 1.3 1.4 2. 2.1 2.2 2.3 2.4 INTRODUCTION Description of UAV Classification of UAV General functions of UAV DESIGN Top View Bottom View Design parameters NACA Airfoil 2.4.1 Airfoil Terminology 2.4.2 Airfoil Types 2.4.3 Four Digit Series 2.4.4 Equation for Four Series Symmetrical Airfoil 2.4.5 Characteristics of NACA 4415 Airfoil 2.4.6 Characteristics of NACA 0012 Airfoil
3

2.5 3. 3.1 3.2 3.3 3.4

Twin Boom POWERPLANT Key Features Specifications Working Propeller 3.4.1 Pusher Type Propeller

4.

REFERENCE

CHAPTER-1 INTRODUCTION

A growing area in aerospace engineering is the use and development of unmanned aerial vehicles (UAV) for military and civilian applications .There are difficulties in the design of these vehicles due to the varied and non intuitive nature of the configurations and missions that can be performed . Currently there has been a huge demand for UAVs and services for real time and remote sensing. Unmanned aerial vehicles can be deployed to solve a number of civilian tasks. It can be used as an effective means of search, detection and identifying of objects or subjects of interest as well as their precise coordinates. UAVs are also very useful in disaster management. In the occurrence of a forest fire, for instance, it is very difficult to have a precise data on the development of the situation. But with the deployment of a UAV which is capable of flying at low altitudes and able to navigate with GPS waypoints and machine vision, the situation can be controlled very efficiently. We named this UAV as NAVS. NAVS is a light weight low altitude short/ medium-range surveillance and intelligence gathering UAV.NAVS have a wing span of 1600mm and length of 1200mm.The propeller using is a puller type one. Power-plant is an air-cooled glow engine seated at the rear of the fuselage with a puller propeller. Undercarriage is tricycle type landing gear. Solid spring shock absorbers are employed to reduce the impact during landing. The entire structure of NAVS is made up of light weight balsa wood, which has high strength to weight ratio. Vinyl sheet forms the skin. The avionics includes a six channel radio controller and receiver, seven servos and a 7.4 volt lithium battery. The NAVS can facilitate a shock-resistant camera along with its transmitter and receiver, an autopilot system with Global Positioning System (GPS) navigation. The merits of NAVS are that it offers minimum drag and hence good fuel economy. Its light weight makes it portable and can be easily disassembled and reassembled. It can serve both civil and military purposes. It is also of great use in emergency rescue operations and in disaster management.

1.1 DESCRIPTION OF THE UAV NAVS


The entire aircraft (wings and fuselage) can be constructed using light weight balsa wood. Its fuselage is designed to house fuel, a glow engine and a rear pusher propeller unit. Effectively, there are five control surfaces on the UAV. These are the left and right ailerons on the wings, single elevator and two rudders on the boom mounted tail unit. These control the pitching, rolling and yawing on this UAV. The aircrafts small, single-cylinder, 120mm bore ASP S^! engine sits at the rear of the craft with a puller propeller .The craft can be maneuvered easily via a joystick on the ground control unit. An aircraft constructed
5

with a pusher configuration has the engine mounted forward of the propeller - which faces in a rearwards direction - giving an appearance that the aircraft is pushed.

1.2 UAV CLASSIFICATION:


UAVs typically fall into one of six functional categories (although multi-role airframe platforms are becoming more prevalent):

Target and decoy - providing ground and aerial gunnery a target that simulates an enemy aircraft or missile Reconnaissance - providing battlefield intelligence Combat - providing attack capability for high-risk missions (see Unmanned combat air vehicle) Logistics - UAVs specifically designed for cargo and logistics operation Research and development - used to further develop UAV technologies to be integrated into field deployed UAV aircraft

Civil and Commercial UAVs - UAVs specifically designed for civil and commercial applications. Handheld 2,000 ft (600 m) altitude, about 2 km range Close 5,000 ft (1,500 m) altitude, up to 10 km range

1.3 GENERAL UAV FUNCTIONS: 1.3.1 REMOTE SENSING:


UAV remote sensing functions include electromagnetic spectrum sensors, biological sensors, and chemical sensors. A UAV's electromagnetic sensors typically include visual spectrum, infrared, or near infrared cameras as well as radar systems. Biological sensors are sensors capable of detecting the airborne presence of various microorganisms and other biological factors. Chemical sensors use laser spectroscopy to analyze the concentrations of each element in the air.

1.3.2 TRANSPORT:
UAVs can transport goods using various means based on the configuration of the UAV itself. Most payloads are stored in an internal payload bay somewhere in the airframe. With fixed wing UAVs, payloads can also be attached to the airframe, but aerodynamics of the aircraft with the payload must be assessed. For such situations, payloads are often enclosed in aerodynamic pods for transport.
6

1.3.3 SCIENTIFIC RESEARCH:


Unmanned aircraft are uniquely capable of penetrating areas which may be too dangerous for piloted craft.

1.3.4 ARMED ATTACKS:


UAVs armed with missiles are now used as platforms for hitting ground targets in sensitive areas. The advantage of using an unmanned vehicle, rather than a manned aircraft in such cases is to avoid a diplomatic embarrassment when the aircraft is shot down and the pilots captured.

1.3.5 SEARCH AND RESCUE:


UAVs will likely play an increased role in search and rescue operations in regions inaccessible to humans.

1.3.6 ARDUPILOT (PCB):


ArduPilot is a full-featured autopilot based on the open-source Arduinoplatform . The Ardupilot is a custom PCB with an embedded processor (ATMega 168) combined with circuitry to switch between RC control and the autopilot control (i.e., the multiplexer/failsafe; otherwise known as a MUX). This controls navigation (following GPS waypoints) and altitude by controlling the rudder and throttle. These components are all open source. This autopilot is fully programmable and can have any number of GPS waypoints (including altitude) and trigger camera or other sensors. Features of the ArduPilot .It can be used for an autonomous aircraft. The built-in hardware failsafe uses a separate circuit to transfer control from the RC system to the autopilot and back again. It includes the ability to reboot the main processor in mid-flight. It makes provision for the use of multiple waypoints. It also provides a 6-pin GPS connector for the 1hz EM406 GPS module.

CHAPTER 2 DESIGN
UAV NAVS has a blended wing design with a twin boom attached to the rear of the aircraft. The empennage is mounted on the booms. The wings blend smoothly with the fuselage; hence it offers minimum drag and improves fuel efficiency. Twin boom ensures better longitudinal stability and better field of view for camera mounted in front. The airfoil used is Symmetrical airfoil for the main plane and NACA 0012 for the tail unit. The control surfaces include two ailerons on wing, two rudders and a single elevator which performs rolling, yawing and pitching movements respectively. Engine is mounted at the rear of the fuselage with a pusher propeller attached. Undercarriage is tricycle type landing gear. Solid spring shock absorbers are employed to reduce the impact during landing. The design was finalized after a number of iterations.

2.1TOP VIEW

Fig1 Top View of NAVS

2.2 BOTTOM VIEW

Fig 2 Bottom View of NAVS


9

2.3 DESIGN PARAMETERS


Wing span Length Height Mean aerodynamic chord Wing area Wheelbase (long) Wheelbase (lat) Aerofoil wing Aerofoil horizontal stabiliser Table 1 Design Parameters 1600 mm 1200 mm 580 mm 270mm 2.667 m2 576 mm 247 mm Symmetrical aerofoil NACA 0012

2.4 AEROFOIL :
UAV NAVS uses Symmetrical airfoil for wings and NACA 0012 airfoil for its tail unit. An airfoil is the shape of a wing or blade as seen in cross-section. An airfoil-shaped body moving through a fluid produces a force perpendicular to the motion called lift. Subsonic flight airfoils have a characteristic shape with a rounded leading edge, followed by a sharp trailing edge, often with asymmetric camber. Airfoils design is a major facet of aerodynamics. Various airfoils serve different flight regimes. Asymmetric airfoils can generate lift at zero angle of attack, while asymmetric airfoil may better suit frequent inverted flight as in as aerobatic aero plane. As a wing moves through the air, the air spilt and passes above and below the wing. The wings upper surface is shaped so the air rushing over the top speeds up and stretches out. This decreases the air pressure above the wing. The air flowing below the wing moves in a straight line, so its speed and air pressure, the air below the wing pushes upward toward the air above the wing. The wing is in middle, and wing is lifted. The faster an airplane moves, the more lift there is. And when the force of lift is greater than the force of gravity, the airplane is able to fly.
10

2.4.1 AIRFOIL TERMINOLOGY:


The various terms related to airfoil are defined below:

2.4.1.1 MEAN CAMBER LINE:


The mean camber line is a line drawn between the upper and lower surfaces.

2.4.1.2 CHORD LINE:


The chord line is a straight line connecting the leading and trailing edges of the airfoil, at the ends of the, mean camber line.

2.4.1.3 CHORD:
The chord is the length of the chord line and is the characteristic dimension of airfoil section.

2.4.1.4 MAXIMUM THICKNESS:


The maximum thickness and the location of maximum thickness are expressed as a percentage of the chord.

2.4.1.5 AERODYNAMIC CENTER:


The aerodynamic center is the chord wise length about which the pitching moment is independent of the lift coefficient and the angle of attack.

2.4.1.6 CENTRE OF PRESSURE


The center of pressure is the chord wise location about which pitching moment is zero.

2.4.2 AIRFOIL TYPES:

2.4.2.1 SUBSONIC AIRFOIL:


Subsonic airfoils have a round edge which is naturally insensitive to the angle of attack. In subsonic airfoil, the leading edge is more towards the shape of a cylinder and the trailing edge is more towards the shape of a sharp edged knife.

11

Fig 3 Subsonic airfoil Profile geometry 1: Zero lift line; 2: Leading edge; 3: Nose circle; 4: Camber; 5: Maximum thickness; 6: Upper surface; 7: Trailing edge; 8: Main camber line; 9: Lower surface

Fig 4 Airfoil Parameters A: blue line=chord, green line = camber, B: leading edge radius, C: x-y-coordinates for the profile geometry (Chord = x-Axis; y-Axis line on that leading edge) The NACA airfoils are airfoil shapes for aircraft wings developed by the National Advisory Committee for Aeronautics (NACA). The shape of the NACA airfoils is described using a series of digits following the word "NACA." The parameters in the numerical code can be entered into equations to precisely generate the crosssection of the airfoil and calculate its properties.
12

2.4.3 FOUR-DIGIT SERIES:


The NACA four-digit wing sections define the profile by: 1. One digit describing maximum camber as percentage of the chord. 2. One digit describing the distance of maximum camber from the airfoil leading edge in tens of percents of the chord. 3. Two digits describing maximum thickness of the airfoil as percent of the chord. For example, the NACA 2408 airfoil has a maximum camber of 2% located 40% (0.4 chords) from the leading edge with a maximum thickness of 8% of the chord. Four-digit series airfoils by default have maximum thickness at 30% of the chord (0.3 chords) from the leading edge. The NACA 0012 airfoil is symmetrical, the 00 indicating that it has no camber. The 15 indicates that the airfoil has a 12% thickness to chord length ratio: it is 12% as thick as it is long.

2.4.4 EQUATION FOR A SYMMETRICAL 4-DIGIT NACA AIRFOIL:


The formula for the shape of a NACA 00xx foil, with "xx" being replaced by the percentage of thickness to chord, is:

Where:

c is the chord length, x is the position along the chord from 0 to c, y is the half thickness at a given value of x (centerline to surface), and t is the maximum thickness as a fraction of the chord (so 100 t gives the last two digits in the NACA 4digit denomination).

The two different types of airfoils used in this model are NACA 0012 and NACA 2408.
13

2.4.5 AIRFOIL PARAMETERS:


Thickness: Camber: Trailing edge angle: Lower flatness: 9.0% .40% 9.7o 72.9%

Leading edge radius: 0.8% Max CL: Max CL angle: Max L/D: Max L/D angle: Max L/D CL: Stall angle: Zero-lift angle: 0.928 12.5 48.121 4.0 0.724 4.5 -2.0

Table 2 Symmetrical aerofoil Parameters

2.4.6 CHARACTERISTICS OF 0012:

Fig 5 NACA 0012 airfoil


14

CHAPTER 3 POWERPLANT
The NAVS use S61 nitro engine.The fuel used is the misture of 80%methanol and 20%caster oil. Nitro engines use a carburetor to mix the nitro and air together. The carburetor can either be sliding or rotary. On a rotary carburetor, the slide is opened as the arm is turned by the servo. On a slide carburetor the slide is opened by sliding the arm out by the servo. Both are held open slightly by an idle screw which allows the engine to receive a very small amount of fuel to keep the engine running when the vehicle is at a stop. The carburetors usually feature 2 needles used to tune the mixture. A high speed needle tunes how much fuel is allowed into the carburetor at mid to high RPM, and a low speed needle determines how much fuel is allowed into the carburetor at low to mid range RPM. Turning either needle in a clockwise motion will lean the engine out. Lean describes the amount of fuel in the fuel / air mixture. To a point this will make the engine run faster with better performance, but once too lean the engine will overheat, and wear out prematurely due to not receiving enough lubrication. Turning either needle counterclockwise will richen the engine. Rich is the opposite of lean, it means more oil is entering the engine. If the engine is too rich, it will run poorly, and fuel that has not yet been burnt may start to spit out of the exhaust. The engine will run very slow and seem to have no power and possibly cut out from being flooded with fuel. Although, being too rich is better than being too lean, because being too rich just means the engine is getting too much oil which is perfectly fine, although performance may not be as good as if the engine were lean. A properly tuned engine will last a long time with good performance throughout its life.

15

3.1 KEY FEATURES


2-stroke nitro engine from one of RC's top brands 9.95cc displacement rivals similarly sized 2 strokes Includes: Ignition, Muffler, carburetor and Motor Mount Built for the utmost in reliability and performance RPM ranges from 2000-18000 Power 1.85bhp Available in traditional silver case

Fig 6 ASP S61 Nitro Engine

3.2 SPECIFICATION

Type: 2 stroke gasoline engine Displacement: 9.95 cc Bore: 24 mm Stroke: 22 mm Total weight: 602g for Motor + Mount + Muffler + Ignition Prop range:12*6,11*7 RPM range: 2000 - 18000 rpm
16

Fuel: 20% caster oil and 80% methanol Mounting dimensions: 124mm x 85mm x 173mm Muffler type: Cast Power: 1.85 kWatts

3.3 WORKING:

To start a glow engine, a direct current (around 3 amps and 1.25 to 2 volts, often provided by a single, high current capacity rechargeable Nickel Cadmium, Nickel metal hydride or lead-acid battery cell, or a purpose-built "power panel" running on a 12VDC source is applied to the glow plug, initially heating the filament. The name 'glow plug' comes from the fact that the plug's filament glows red hot. The engine is then spun from the outside using a manual crank, built-in rope-based recoil starter, spring-loaded motor or purpose-built electric motor, or by hand, to introduce fuel to the chamber

Once the fuel has ignited and the engine is running, the electrical connection is no longer needed and can be removed. Each time combustion keeps the glow plug filament glowing red hot, allowing it to ignite the next charge, thus sustaining the power cycle.

Lead-acid battery cells that are used to ignite a model engine glow plug, due to their two volt output when freshly charged, usually cause a regular 1.5 volt glow plug to burn out instantaneously, and either a resistor of the proper value and wattage, or a high-power germanium transistor's base/emitter junction (in a series connection with one of the plug's terminals) can reduce the lead-acid cell's voltage to a suitable 1.5 volt level for engine starting. Technically a glow plug engine is fairly similar to a diesel engine and hot bulb engine in that it uses internal heat to ignite the fuel, but since the ignition timing is not controlled by fuel injection (as in an ordinary diesel engine), or electrically (as in a spark ignition engine), it must be adjusted by changing fuel/air mixture and plug/coil design (usually through adjusting various inlets and controls on the engine itself.) A richer mixture will tend to cool the filament and so retard ignition, slowing the engine. This "configuration" can also be adjusted by using varying plug designs for a more exact thermal control. Of all internal combustion engine types, the glow plug engine resembles most the hot bulb engine, since on both types the ignition occurs due to a "hot spot" within the engine combustion chamber.

Glow plug engines can be designed for two-cycle operation (ignition every rotation) or four-cycle operation (ignition every two rotations). The two-cycle (or two-stroke) version produces more power, but the four-cycle engines have more low-end torque, are less noisy and have a lower-pitched, more realistic sound.

17

3.4 PROPELLER:
A propeller is a type of fan which transmits power by converting rotational motion into thrust. A pressure difference is produced between the forward and rear surfaces of the airfoil-shaped blade, and air or water is accelerated behind the blade. Propeller dynamics can be modeled by both Bernoulli's principle and Newton's third law. Aircraft propellers convert rotary motion from piston engines or turboprops to provide propulsive force. They may be fixed or variable pitch. Early aircraft propellers were carved by hand from solid or laminated wood with later propellers being constructed from metal. The most modern propeller designs use high-technology composite materials. There are actually two types of Propeller. They are: (1) Pusher Type Propeller (2) Tractor Type Propeller

3.4.1 PULLER TYPE PROPELLER:


UAV NAVS has a 12x6 composite puller type propeller. Puller configuration has the engine mounted forward of the propeller - which faces in a rearwards direction - giving an appearance that the aircraft is "pushed" through the air. Sometimes the propeller is situated at the rear of the fuselage - more often at the rear of a nacelle rotating between tail booms. Wing mounted pusher propellers are typically situated behind the trailing edge of the wing. This means that the airframe has a stress applied to it in compression from the rear rather than in tension from the front.

18

CHAPTER 4 CONSTRUCTION
The complete fuselage and wing of the UAV NAVS is made up of Balsa Wood. For the construction purpose we had brought balsa wood from the out source of Banglore.Different grade of balsa wood has been bought as of 2mm, 4mm, 6mm and 8mm.The overall fuselage length of the UAV NAVS is 120mm and the wing span is 160mm.The mode of construction of the is same as we see in a plywood. A 4 mm balsa sheet is pasted in between two 2 mm balsa sheet to complete the fuselage structure. The wing is constructed by cutting the balsa sheet in the shape of the symmetrical aerofoil and combined by joining it in a long balsa rod. The fuselage and wing is joined with the help of epoxy gum.The fuselage and wing area of the aircraft is coated with polycote.This will provide a smooth surface which will reduce the drag force formed during flying.

Fig 7 Fuselage Construction

19

CHAPTER 5 RADIO SYSTEM 5.1 SERVO MOTOR

Fig 8 Servo Motor

A Servo is a small device that has an output shaft. This shaft can be positioned to specific angular positions by sending the servo a coded signal. As long as the coded signal exists on the input line, the servo will maintain the angular position of the shaft. As the coded signal changes, the angular position of the shaft changes. In practice, servos are used in radio controlled airplanes to position control surfaces like the elevators and rudders. They are also used in radio controlled cars, puppets, and of course, robots. Basically it works on a electromagnetic induction. Servomechanism or servo is an automatic device that uses error-sensing negative feedback to correct the performance of a mechanism. The term correctly applies only to systems where the feedback or errorcorrection signals help control mechanical position or other parameters. For example, an automotive power window control is not a servomechanism, as there is no automatic feedback that controls position the operator does this by observation. By contrast the car's cruise control uses closed loop feedback, which classifies it as a servomechanism.

5.2 LIPO BATTERY


Li-poly batteries are also gaining favor in the world of radio-controlled aircraft as well as radiocontrolled cars, where the advantages of both lower weight and greatly increased run times can be sufficient justification for the price. Some air soft gun owners have switched to LiPo batteries due to the above reasons and the increased rate of fire they provide. However, lithium polymer-specific chargers are required to avoid fire and explosion. Explosions can also occur if the battery is short-circuited, as tremendous current passes through the cell
20

in an instant. Radio-control enthusiasts take special precautions to ensure their battery leads are properly connected and insulated. Furthermore fires can occur if the cell or pack is punctured. Radio-controlled car batteries are often protected by durable plastic cases to prevent puncture. Specially designed electronic motor speed controls are used to prevent excessive discharge and subsequent battery damage. This is achieved using a low voltage cutoff (LVC) setting that is adjusted to maintain cell voltage greater than (typically) 3 V per cell.

5.3 TRANSMITTER & RECIVER


The transmitter that we are using is 9 channels Fly sky 2.4 GHz. It provide three modes of operation such as glider mode, helicopter mode and aircraft mode. The transmitter is of latest model in which we can program ourself. The Fly Sky FS-TH9X is modular system, so specifications may vary depending on the module you select. The transmitter itself is loaded with features, some of which you will usually only find on some high end transmitters.

Number of Channels: 8ch PPM/9ch PCM Display: 128*64 LCD Support Type: Heli/Acro/Glid User Models: 8 Stick Modes: 4 Encoder Type: PPM/PCM Sub Trim: Yes Simulator Interface: Yes Buzzer: Yes Low Voltage Display: Yes

21

FIG 9 Transmitter

Fig 10 Reciver The menus are clearly and easy to navigate using the 12864 pixel LCD display. The only issue I had was that the +/- buttons are back to front with the positive on the left.

22

CHAPTER 6 ARDUPILOT BOARD


The ArduPilot Controller board, shown in Figure 6, was used as the main platform for the flight control system due to the functionality and availability of open-source support. The blogs hosted by Chris Anderson of DIYDrones provided a means of communication with experienced hobbyists familiar with the components and troubleshooting procedures.

Figure 11: ArduPilot Controller Board Based on the Arduino open-source hardware platform, ArduPilot is a full-featured autopilot using infrared (thermopile) sensors or an Inertial Measurement Unit (IMU) for stabilization and GPS for navigation. The ArduPilot features include: use for an autonomous vehicle, built-in hardware failsafe that uses a multiplexer chip and ATTiny processor to toggle control from the RC system to the autopilot, ability to reboot the main processor in mid-flight, multiple 3D waypoints (limited only by memory), altitude controlled with the elevator and throttle, a 6-pin GPS connector for the 4Hz uBlox5 or 1hz EM406 GPS module, six spare analog inputs (with ADC on each) and six spare digital input/outputs for additional sensors. Furthermore, the board supported the addition of wireless modules for real-time telemetry and was based on a 16MHz Atmega328 processor. The total onboard processing power was approximately 24 MIPS. The 30mm x 47mm board could be powered by either the RC receiver or a separate battery. Four RC-in and out channels could be processed by the autopilot, in addition to the autopilot on/off channel. The board offered LEDs for power, failsafe (on/off), status and GPS satellite lock. Programmability and use required the free Arduino IDE to edit and upload the code to the board. The Arduino environment simplified the code production, modification, and upload procedures for the ArduPilot. Capable of running on Windows, Mac OS X, and Linux, the environment was composed in Java and based on Processing, avr-gcc, and other open source software.

23

6.1 ARDUPILOT SHIELD V2 KIT WITH AIRSPEED SENSOR


The ArduPilot Shield V2 Kit introduces the capability of monitoring height, speed, and battery level. The kit in Figure 7 includes: ArduShield Board, Female Pin Headers, Male Pin Headers, Pitot Tube, custom-made FMA cable, Housing Connector Header, Three-Servo Extension, Bind Plug, Reset button, and extra wire.

Fig 12 Shield kit

With a compact design that matched the ArduPilot board, compatibility issues were reduced and the following features pertained: on-board differential pressure sensor (MPXV5004DP) for airspeed measurement, 3.3V Voltage Regulator, voltage divider to measure battery level (up to 4 cell LIPOs), dedicated port for infrared sensors, support for 3Volts GPS including 3v3 TTL conversion, and mirrored status LED's for Power, Status and GPS Lock. The Bind Plug served as an Auto-Shutdown GPS to eliminate the need to unplug the GPS when uploading new code or writing to the ArduPilot with the FTDI cable. Figure 8 shows a closer image of the Shield Board, where the black hub atop the board is the pitot tube connection.

Figure 12: ArduPilot Shield Board


24

6.2 ARDUPILOT FTDI CABLE


Programming for the I/O controller board was accomplished via the ArduPilot FTDI cable shown in Figure 9. The polarity of the cable is visible through the ArduPilot "BLK" (black) and "GRN" (green) color labels. The TX/RX signals are 3.3volts, allowing greater flexibility, and the power supply is 5volts through the red wire.

Fig 13 FTDI Cable

6.3 GPS MODULE


Originally, the autopilot system was designed using the 20 Channel EM-406A SiRF III Receiver with Antenna to provide accurate GPS readings at a rate of four per second, in Figure 10. The unit weighed 16g including cable, offered extremely high sensitivity of 159dBm and 10m Positional Accuracy (5m with WAAS). The module required only 1s Hot Start, 38s Warm Start, 42s Cold Start, and 70mA at 4.5-6.5V. This was the smallest complete module available (30mm x 30mm x 10.5mm), outputting NMEA 0183 and SiRF binary protocol.

Figure 15: EM-406A Module


25

However, through excessive testing and troubleshooting, the group concluded that the EM-406A module lacked reliability and failed to operate under controlled conditions. Therefore, the design was upgraded to utilize the GS407 U-Blox5 GPS operating at 2Hz, shown below in Figure 11. The module features a u-Blox 5H chipset with a Sarantel omni-directional Geo-helix S-type active antenna, at a real 2Hz refresh rate that can be used up to 4Hz over fifty channels. The unit supports UBX, NMEA and USB&NMEA with high immunity to RF interference while offering firmware upgradable capability.

Figure 16: U-Blox5 Module

6.4 GPS ADAPTER AND CABLE


In order to use the U-Blox5 with the ArduPilot Shield board, a uBlox adapter and cable were required. Figure 12 shows the uBlox GS406/GS407 adapter. The adapter converts to EM406A or easy to use pin headers (,+,Tx,RX), and is configurable for servo connectors (-,+,S), thereby easily adaptable to the system overall. The required power supply for the adapter is 3.3V or 5V-12V. The on-board 3.3V power regulator ensure proper power supply from the ArduPilot Shield board, with a rechargeable backup battery, a small GPS profile similar to that of the Shield board. The EM406 Connector makes this unit ArduPilot-Ready with regular pin holes for easy integration

Figure 17: uBlox Adapter


26

The EM-406/uBlox Adapter Cable in Figure 13 is a 15cm communication cable that mates with the EM406, EM401 and uBlox Adapter. The length is ideal for a UAV project where the GPS module may be a distance away from the controller board. The cable has two 6-pin JST connectors with 1mm pitch and is wired pin 1 to pin 1.

Figure 18: Adapter Cable

6.5 XYZ HORIZON SENSORS


Stabilization was achieved via the AutoPilot XYZ Horizon sensors, which act as both a gyroscope and an accelerometer, shown in Figure 14. The XY sensors are located on the right, while the left of the image is the Z component sensor. These thermopile, infrared sensors are less accurate than most commercial UAV autopilot systems including Inertial Measurement Units (IMUs) or Inertial Navigation Systems (INS); however, the compatibility issues are simplified. The sensors are used to determine the orientation of the aircraft with respect to temperature difference analysis of the ground and are compatible with ArduPilot and Range Video OSD. The OpAMP gain is set to 1000x (1Mohms/1kohms).

Fig 19 XY and Z sensor

27

6.6 DESIGN PROCESS CONFIGURATION


The controller board was pre-programmed for manual and automatic flight modes through interfacing the pilot board with the aircrafts servo system. Manual mode allowed for complete user control of the flight, while automatic allowed the aircraft to fly independent of user control through stabilization and guidance maneuvers.

Fig 20 configuration

Preliminary design of the desired autopilot system, in which two main divisions house several functions: Flight Control and Flight Plan. The Flight Control division supports the battery monitor, pitot tube, altitude, and gyros. This component operated based on navigation directions from the Flight Plan division, consisting of the GPS, digital compass for failsafe, beacon for image recognition, and radar for object detection during flight to avoid crashing. The data logging function in memory keeps an accurate record of flight path. Error transmissions and status conditions would be achievable through the hammer board to base station.

28

Figure 21: Relationship Diagram

29

CHAPTER 7 PROGRAMMING

7.1 CONFIGURATION PROGRAM OF MICRO CONTROLLER


#define SHIELD_VERSION 1 version is 1, -1 = no shield #define AIRSPEED_SENSOR 0 1= yes, 0 = no. // (boolean) Do you have an airspeed sensor attached? // Old (red) shield versions is 0, the new (blue) shield

#define GPS_PROTOCOL 4

// 0 = NMEA // 1 = SIRF, // 2 = uBlox // 3 = ArduIMU // 4 = MediaTek, // 5 = Simulated GPS mode (Debug), // -1 = no GPS

//Ground Control Station: #define GCS_PROTOCOL 0 // 0 = Standard ArduPilot // 1 = special test, // 2 = Ardupilot Binary(not implemented), // 3 = Xplane // -1 = no GCS (no telemtry output)

***************************************/ //Thermopile sensors: #define ENABLE_Z_SENSOR 1 field calibration with each flight) // 0 = no Z sensor, 1 = use Z sensor (no Z requires

30

#define XY_SENSOR_LOCATION 0

// XY Thermopiles Sensor placement // Mounted right side up: behind // Mounted upside down: 2 = cable in front, 3 = 0 = cable in front, 1 = cable

cable behind #define PITCH_TRIM 0 #define ROLL_TRIM 0 placement #define AOA 0 IMU to find this value. #define ALT_EST_GAIN .01 // the gain of the altitude estimation function, lower // deg * 100 : the angle your plane flies at level - use the // deg * 100 : allows you to offset bad IR sensor placement // deg * 100 : allows you to offset bad IR sensor

number = slower error correction and smoother output

/***************************************/ //Battery: #define BATTERY_EVENT 0 voltage (only if you have it wired up!) #define INPUT_VOLTAGE 5200.0 // (Millivolts) voltage your power regulator is feeding your ArduPilot to have an accurate pressure and battery level readings. (you need a multimeter to measure and set this of course) // (boolean) 0 = don't read battery, 1 = read battery

/***************************************/ // RADIO #define THROTTLE_PIN 11 better choice for most people) #define THROTTLE_OUT 1 #define THROTTLE_FAILSAFE 0 Default is no 0, Yes is 1
31

// pin 13, or pin 11 only (13 was old default, 11 is a

// For debugging - 0 = no throttle, 1 = normal throttle // Do you want to react to a throttle failsafe condition?

#define THROTTLE_FS_VALUE 975 // (microseconds) What value to trigger failsafe #define REVERSE_THROTTLE 0 // 0 = Normal mode. 1 = Reverse mode - Try and

reverse throttle direction on your radio first, most ESC use low values for low throttle. #define FAILSAFE_ACTION 2 come home #define AUTO_TRIM 1 from Manual #define SET_RADIO_LIMITS 0 // 0 = no, 1 = set the limits of the Channels with the // 0 = no, 1 = set the trim of the radio when switching // 1 = come home in AUTO, LOITER, 2 = dont

radio at launch each time; see manual for more #define RADIO_TYPE 0 pulses #define CH1_MIN 1000 #define CH1_MAX 2000 #define CH2_MIN 1000 #define CH2_MAX 2000 #define CH3_MIN 1000 // (Microseconds) Range of Ailerons/ Rudder // (Microseconds) // (Microseconds) Range of Elevator // (Microseconds) // (Microseconds) Range of Throttle - Important - please // 0 = sequential PWM pulses, 1 = simultaneous PWM

use debug mode to find your PWM values and set them here. #define CH3_MAX 2000 #define CH4_MIN 1000 #define CH4_MAX 2000 #define ADVERSE_ROLL 0.2 #define CH4_RUDDER 1 else - like an egg drop. // (Microseconds) // (Microseconds) Range of Rudder // (Microseconds) // adverse roll correction based on Aileron input // 1 = Use CH4 for rudder, 0 = use CH4 for something

#define PAYLOAD_CLOSED 45 #define PAYLOAD_OPEN -45

// -45 to 45 degrees max // -45 to 45 degrees max

/***************************************/ // AIRFRAME SETTINGS #define MIXING_MODE 0 //Servo mixing mode 0 = Normal, 1 = Elevons (or v tail)

32

// NOTE - IF USING ELEVONS, 1-2 AND 1-3 SHOULD BE 1 #define REVERSE_ROLL 1 #define REVERSE_PITCH 1 #define REVERSE_RUDDER 1 // To reverse roll, PUT -1 to reverse it // To reverse pitch, PUT -1 to reverse it // To reverse rudder for 4 channel control setups

// JUST FOR ELEVONS: #define REVERSE_ELEVONS 1 // Use 1 for regular, -1 if you need to reverse roll direction

#define REVERSE_CH1_ELEVON -1 // To reverse channel 1 elevon servo, PUT -1 to reverse it #define REVERSE_CH2_ELEVON 1 it // To reverse channel 2 elevon servo, PUT -1 to reverse

/***************************************/ // Airplane speed control #define AIRSPEED_CRUISE 13 // meters/s : Speed to try and maintain - You must set

this value even without an airspeed sensor! #define AIRSPEED_RATIO 0.1254 // If your airspeed is under-reporting, increase this value to something like .2

// NOTE - The range for throttle values is 0 to 125 // NOTE - For proper tuning the THROTTLE_CRUISE value should be the correct value to produce AIRSPEED_CRUISE in straight and level flight with your airframe #define THROTTLE_MIN 0 decending. #define THROTTLE_CRUISE 35 #define THROTTLE_MAX 60 overpowered) // (0-100 %) Default throttle value - Used for central value. // (0-100 %) Throttle (lower this if your plane is // (0-100 %) Raise it if your plane falls too quickly when

// For use in Fly By Wire B mode in meters per second #define AIRSPEED_FBW_MIN 6 // meters/s : Minimum airspeed for Fly By Wire
33

mode B, throttle stick at bottom #define AIRSPEED_FBW_MAX 30 mode B, throttle stick at top // meters/s : Maximum airspeed for Fly By Wire

/***************************************/ //NAVIGATION: PARAMETERS //Note: Some Gains are now variables #define HEAD_MAX 4000 right) degrees*100 // deg * 100 : The maximum commanded pitch up angle // deg * 100 : The maximum commanded bank angle (left and

#define PITCH_MAX 1500 degrees*100 #define PITCH_MIN -2000 degrees*100 #define LOITER_RADIUS 40

// deg * 100 : The maximum commanded pitch down angle

// meters : radius in meters of a Loiter

/***************************************/ // Auto launch and land // If you are using ArduIMU the minimum recommended TAKE_OFF_PITCH is 30 degrees

due to linear acceleration effects on the IMU // If your airframe cannot climb out at 30 degrees do not use this feature if using ArduIMU #define USE_AUTO_LAUNCH 0 // If set to 1 then in AUTO mode roll will be held to

zero and pitch to TAKE_OFF_PITCH until TAKE_OFF_ALT is reached #define TAKE_OFF_ALT 75 #define TAKE_OFF_PITCH 15 // meters. Altitude below which take-off controls apply // degrees : Pitch value to hold during take-off

// //

This section is for setting up auto landings You must have your airframe tuned well and plan your flight carefully to successfully

execute auto landing


34

#define USE_AUTO_LAND 0 target. Set altitude to 0 for last WP #define LAND_PITCH 15 #define AIRSPEED_SLOW 5 #define THROTTLE_SLOW 20

// If set to 1 Last waypoint will be the landing

// degrees : Pitch value to hold during landing // meters/s // 0-100 : This should be the throttle value that

produces AIRSPEED_SLOW in straight and level flight

#define SLOW_RADIUS 60

// meters : When this becomes the current waypoint we

will decrease airspeed_cruise to AIRSPEED_SLOW. Replace 999 with the beginning of your landing pattern #define THROTTLE_CUT_RADIUS 40 // meters : When this becomes the current waypoint we will cut the throttle; set it so it is well beyond the touchdown zone so that it is not reached, else you will enter RTL mode or loop waypoint

35

7.2 CONTROLLING SERVO MOTOR

void demo_servos() { delay(30); set_servo_mux(true); OCR1A = 1600 * 2; OCR1B = 1600 * 2; delay(400); OCR1A = 1400 * 2; OCR1B = 1400 * 2; delay(200); OCR1A = 1500 * 2; OCR1B = 1500 * 2; set_servo_mux(false); delay(30); }

void set_servo_mux(boolean mode) { while(TCNT1 < 20000){}; if (mode){ //take over the MUX pinMode(4, OUTPUT); digitalWrite(4, HIGH); }else{ //release the MUX to allow Manual Control digitalWrite(4, LOW); pinMode(4, INPUT); }
36

} // wants +- 45 void set_servos_4() { #if GPS_PROTOCOL == 3 if(imu_ok == false && control_mode > MANUAL){ the IMU - Big trouble servo_out[CH_ROLL] = 0; servo_out[CH_PITCH] = 0; servo_out[CH_THROTTLE] = 0; } #endif // We have lost

#if MIXING_MODE == 0 set_ch1_degrees(servo_out[CH_ROLL]); // 45 = right turn (unless reversed) set_ch2_degrees(servo_out[CH_PITCH]); #endif

/*Elevon mode*/ // #if MIXING_MODE == 1 set_ch1_degrees(REVERSE_ELEVONS * (servo_out[CH_PITCH] servo_out[CH_ROLL])); set_ch2_degrees(servo_out[CH_PITCH] + servo_out[CH_ROLL]); #endif

set_ch4_degrees(servo_out[CH_RUDDER]); update_throttle(); }

37

// requires +- 45 void set_ch1_degrees(float deg){

#if MIXING_MODE == 0 radio_out[CH_ROLL] = radio_trim[CH_ROLL] + ((float)REVERSE_ROLL * deg * 11.111f); #endif

#if MIXING_MODE == 1 radio_out[CH_ROLL] = elevon1_trim + ((float)REVERSE_CH1_ELEVON * deg * 11.111f); #endif radio_out[CH_ROLL] = constrain(radio_out[CH_ROLL], radio_min[CH_ROLL], radio_max[CH_ROLL]); 1000, 2000); //

radio_out[CH_ROLL] = constrain(radio_out[CH_ROLL],

OCR1A = radio_out[CH_ROLL] * 2; //OCR1A is the channel 1 pulse width in half microseconds }

void set_ch2_degrees(float deg){

#if MIXING_MODE == 0 radio_out[CH_PITCH] = radio_trim[CH_PITCH] + ((float)REVERSE_PITCH * deg * 11.111f); #endif

#if MIXING_MODE == 1 radio_out[CH_PITCH] = elevon2_trim + ((float)REVERSE_CH2_ELEVON * deg * 11.111f); #endif


38

radio_out[CH_PITCH] = constrain(radio_out[CH_PITCH], radio_min[CH_PITCH], radio_max[CH_PITCH]); 1000, 2000);

radio_out[CH_PITCH] = constrain(radio_out[CH_PITCH], OCR1B = radio_out[CH_PITCH] * 2; }

void set_ch4_degrees(float deg){

//Serial.print("tdeg:"); //Serial.print(deg,DEC); deg = constrain(deg, -45, 45); radio_out[CH_RUDDER] = radio_trim[CH_RUDDER] + ((float)REVERSE_RUDDER * deg * 11.111f); //Serial.print("\tradio_out: "); //Serial.print(radio_out[CH_RUDDER],DEC); radio_out[CH_RUDDER] = constrain(radio_out[CH_RUDDER], radio_min[CH_RUDDER], radio_max[CH_RUDDER]); //Serial.print("\tradio_out: "); //Serial.print(radio_out[CH_RUDDER],DEC); //Serial.print(" : ");

uint16_t timer_out timer_ovf_b timer_out >>= 1;

= radio_out[CH_RUDDER] % 512; = radio_out[CH_RUDDER] / 512;

if(timer_out != OCR2B) OCR2B = timer_out; }

void no_throttle()
39

{ //OCR2A = ch3_timer_min; }

// sets the throttle timer value based on throttle percent // ------------------------------------------------------void update_throttle() { #if THROTTLE_OUT == 1 // convert 0 to 100% into PWM servo_out[CH_THROTTLE] = constrain(servo_out[CH_THROTTLE], 0, 100); radio_out[CH_THROTTLE] = (servo_out[CH_THROTTLE] * (radio_max[CH_THROTTLE] - radio_min[CH_THROTTLE])) / 100; radio_out[CH_THROTTLE] += radio_min[CH_THROTTLE]; #else radio_out[CH_THROTTLE] = radio_min[CH_THROTTLE]; #endif

// Jason's fancy 2s hack uint16_t timer_out timer_ovf_a timer_out >>= 1; = radio_out[CH_THROTTLE] % 512; = radio_out[CH_THROTTLE] / 512;

if(OCR2A != timer_out) OCR2A = timer_out; }

// Throttle Timer Interrupt // -----------------------ISR(TIMER1_CAPT_vect) // Timer/Counter1 Capture Event


40

{ //This is a timer 1 interrupts, executed every 20us PORTB |= B00000001; //Putting the pin high! PORTC |= B00010000; //Putting the pin high! TCNT2 = 0; //restarting the counter of timer 2 timer_ovf = 0; }

ISR(TIMER2_OVF_vect) { timer_ovf++; }

ISR(TIMER2_COMPA_vect) // Timer/Counter2 Compare Match A { if(timer_ovf == timer_ovf_a){ PORTB &= B11111110; //Putting the pin low } }

ISR(TIMER2_COMPB_vect) // Timer/Counter2 Compare Match B Rudder Servo { if(timer_ovf == timer_ovf_b){ PORTC &= B11101111; //Putting the pin low! } }

void init_PWM() { // Servo setup


41

// -----------

// Timer 1 TCCR1A = ((1<<WGM11) | (1<<COM1B1) | (1<<COM1A1)); //Fast PWM: ICR1=TOP, OCR1x=BOTTOM,TOV1=TOP TCCR1B = (1<<WGM13) | (1<<WGM12) | (1<<CS11); // Clock scaler = 8, 2,000,000 counts per second OCR1A = 3000; 45; 4000 = 2000 = 90 OCR1B = 3000; ICR1 = 40000; // Elevator //50hz freq...Datasheet says (system_freq/prescaler)/target // Rudder - multiply your value * 2; for example 3000 = 1500 =

frequency. So (16000000hz/8)/50hz = 40000,

// enable pin change interrupt 2 - PCINT23..16 PCICR = _BV(PCIE2);

// enable pin change interrupt 0 - PCINT7..0 PCICR |= _BV(PCIE0);

// Throttle; // Setting up the Timer 2 - 8 bit timer TCCR2A //TCCR2B increment 1 every 4us TCCR2B = _BV(CS21) |_BV(CS20); //prescaler 32, at 16mhz (32/16) = 2, the = 0x0; //Normal Mode = _BV(CS22); //prescaler 64, at 16mhz (64/16) = 4, the counter will

counter will increment 1 every 2us //OCR2A //OCR2B = (CH3_MIN-1000) / 4; = 125; // center the rudder

servo_out[CH_THROTTLE] = 0; update_throttle();
42

set_ch4_degrees(0); TIMSK1 |= _BV(ICIE1); output throttle TIMSK2 = _BV(TOIE1) | _BV(OCIE2A) | _BV(OCIE2B); // // Timer/Counter1, Input Capture Interrupt Enable //PB0 -

Timer/Counter2 Compare Match A }

43

7.3 SENSOR PROGRAMMING

void read_XY_sensors() { analog0 analog1 roll_sensor pitch_sensor = analogRead(0); = analogRead(1); = getRoll() + ROLL_TRIM; = getPitch() + PITCH_TRIM;

#if ENABLE_Z_SENSOR == 0 if (analog0 > 511){ ir_max = max((abs(511 - analog0) * IR_MAX_FIX), ir_max); ir_max = constrain(ir_max, 40, 600); if(ir_max > ir_max_save){ eeprom_busy_wait(); eeprom_write_word((uint16_t *) ir_max); // ir_max ir_max_save = ir_max; } } #endif } EE_IR_MAX,

void read_z_sensor(void) { //Serial.print("ir_max: "); //Serial.println(ir_max,DEC);

//Checks if the roll is less than 10 degrees to read z sensor if(abs(roll_sensor) <= 1500){
44

analog2 = ((float)analogRead(2) * 0.10) + ((float)analog2 * .90); ir_max = abs(511 - analog2) * IR_MAX_FIX; ir_max = constrain(ir_max, 40, 600); } }

// in M/S * 100 void read_airspeed(void) { #if GCS_PROTOCOL != 3 airpressure_raw = ((float)analogRead(AIRSPEED_PIN) * .10) + (airpressure_raw * .90); airpressure airpressure airspeed #endif = (int)airpressure_raw - airpressure_offset; = max(airpressure, 0); = sqrt((float)airpressure / AIRSPEED_RATIO) * 100;

airspeed_error = airspeed_cruise - airspeed; }

void read_battery(void) { filter_batt_voltage = ((float)analogRead(BATTERY_PIN) * .05) + (filter_batt_voltage * .95); battery_voltage = BATTERY_VOLTAGE(filter_batt_voltage); if(battery_voltage < INPUT_VOLTAGE) low_battery_event(); }

45

// returns the sensor values as degrees of roll // 0 ----- 511 ---- 1023 // -90 0 90 IR Sensor degree output * 100

// sensors are limited to +- 60 (6000 when you multply by 100)

long getRoll(void) { #if XY_SENSOR_LOCATION ==1 return constrain((x_axis() + y_axis()) / 2, -6000, 6000); #endif

#if XY_SENSOR_LOCATION ==0 return constrain((-x_axis() - y_axis()) / 2, -6000, 6000); #endif

#if XY_SENSOR_LOCATION ==3 return constrain((-x_axis() - y_axis()) / 2, -6000, 6000); #endif

#if XY_SENSOR_LOCATION ==2 return constrain((x_axis() + y_axis()) / 2, -6000, 6000); #endif }

long getPitch(void) { #if XY_SENSOR_LOCATION ==1 return constrain((-x_axis() + y_axis()) / 2, -6000, 6000); #endif

#if XY_SENSOR_LOCATION ==0


46

return constrain((x_axis() - y_axis()) / 2, -6000, 6000); #endif

#if XY_SENSOR_LOCATION ==3 return constrain((-x_axis() + y_axis()) / 2, -6000, 6000); #endif

#if XY_SENSOR_LOCATION ==2 return constrain((x_axis() - y_axis()) / 2, -6000, 6000); #endif }

long x_axis(void)// roll { return ((analog1 - 511l) * 9000l) / ir_max; // // bouncy plane // // crash plane } 100 * 9000 / 250 = 36 = 36 looks like 36 611 - 511 100 * 9000 / 100 = 90 low = underestimate = 36 looks like 90 = flat plane or

100 * 9000 / 500 = 18 high = over estimate = 36 looks like 18 =

long y_axis(void)// pitch { return ((analog0 - 511l) * 9000l) / ir_max; }

47

You might also like