Sunteți pe pagina 1din 122

1.

Abstract:

There are so many things that are happening around us that we cant know
immediately, after an hour or late we will come to know what is going on, not only
in the aspect of crime and also in some strange things that happen around us. This
project is about designing a system and method for facilitating measurement of
environmental conditions such as might be used in emergencies or other situational
awareness applications which contains weather monitoring, image sensing of the
unknown objects, voice and video transmission, sending GPS positions
automatically to data base, all this features come together as a unit. This unit will
help us to sense the environment and help us to get the continuous feedback for
monitoring the environment.

Voice Transmission:
The circuit is basically a radio frequency (RF) oscillator that operates around
100MHz.
The audio signal that are given as a input through microphone is fed into the audio
amplifier stage.
That is builded in around first stage transistor.
The output of the first transistor, ie., collector is fed into the basic transistor where it
modulates the resonant frequency of the tank circuit. (L1 col1 & trimpot), by
varying the junction capacitance by truimph of the transistor.
* Junction Capacitance is a function of the potential difference applied to the base of
the transistor T2. The tank is connected in a Hartley oscillator circuit. The final stage
build around T3 amplifies the output RF signal.
In this, there are seven stages to complete the construction of the voice Tx.

1)The electret microphone:


An electret is a permanently chrged dielectric. It is made byheating a ceramic
material placing in a magnetic field and allowing it to cool while still in a magnetic
field. It is the electrostatic equivalentof the permanent magnet.
In the electric microphonea slice of this material is used as part of the dielectric of a
capacitor in which the diaphrame of the microphone forms one plate. Sound pressure
moves through one of its plates.The movement of the plate changes the capacitor.
The electric capacitoris connected to FET amplifier.These microphones are small
and have execllent sensitivity, wide range frewuency response and low cost.

First amplification stage:


This is a standard self-biasing common emitter amplifier. The 22n capacitor isolates
the microphone from the base voltage of the transistor and only allows alternating
current signals to pass.
Oscillator stage:
Every oscillator needs an oscillator to generate the RF carrier waves. The tank
circuit, the transistor and the feedback capacitor are the oscillator circuits here. An
input signal is not needed to sustain the oscillation. The feedback signal makes the
base-emitter current of the transistor to vary at the resonant frequency.
This causes the emitter-collector current to vary at the same frequency. This signal
is fed to the aerial and radiated as radio waves.
The name 'tank' circuit comes from the ability of the LC circuit to store energy for
oscillations. in a pure LC circuit (with no resistance) energy cannot be lost. Note that
the tank circuit does not oscillate just by having a DC potential put across it. Positive
feedback must be provided.

Trimpot:
The slots inside the trimpot are shaped like the head of arrow. Tha maximum
capacitance value is when the arrow is in pointed to the 12o'clock position. A 180
degrees turn brings the trimpot value to its minimum rated value. With
experimentation we will be able to build up a table of total capacitance value to Fm
frequency and also we can change the frequency by altering the space between the
coil of L1.
The 10Pf ceramic capacitor in parallel with the trimpot will enable us to tune the Tx
in the range of 98 to 185MHz of commercial Fm band. If we use a higher value (for
example 27Pf) we want to move the frequency downwards the other end of the Fm
band. This end generally has more commercial station in it.

Final Amplification Stage:


This RF stage adds amplification to RF signal. It needs an RF transistor to do this
efficiently. Now, we use "Zetex ZTx320". L2(an RFC,radio frequency choke) and
10p capacitor in parallel with it are designedto reduce "harmonics" from the circuit.
Output power from this stage will be maximum when it is tuned to oscillate at the
same frequency as the previous stage.
Operating Voltage:
Output power is also increased by using a higher operating voltage. 9V is better than
6V. The maximum operating voltage for this transmitter is determined by ZTx320
ie., 15V.
We can increase the volatge also upto 15V but we have to change some resistor
values.

Drone:
Drones, also known as unmanned aerial vehicles (UAV), are pilotless and noncrewed aircraft that are capable of flight either by remote control or through the use

of on-board computers. Other names for these types of aircraft are remotely piloted
vehicle (RPV), remotely piloted aircraft (RPA), and remotely operated aircraft
(ROA).
Drones are commonly used by the military, but are also being implemented in search
and rescue operations and being utilized in other civil applications, such as policing
and firefighting. The technology is also allowing for hobbyists and other enthusiasts
to become avid drone operators, albeit on a relatively smaller scale.
A drone is capable of controlled, sustained level flight and is powered by a jet,
reciprocating, or electric engine. UAVs differ from cruise missiles in that drones are
recovered after a mission is complete while a cruise missile impacts its target.
Military UAVs may carry and fire munitions, while a cruise missile is a munitions'.
History of Drone:
The concept of unmanned aerial flight is not a new one. The idea first came to light
on August
22, 1849, when Austria attacked the Italian city of Venice with unmanned balloons
that were loaded with explosives. Some balloons were launched from the Austrian
ship Vulcan. While some balloons reached their intended targets, most were caught
in change winds and were blown back over Austrian lines.
The system was under development for months and an account of the countrys plan
appeared in an article in a Vienna newspaper at the time: Venice is to be bombarded
by balloons, as the lagunes prevent the approaching of artillery. Five balloons, each
twenty-three feet in diameter, are in construction at Treviso. In a favorable wind the
balloons will be launched and directed as near to Venice as possible, and on their
being brought to vertical positions over the town, they will be fired by electro
magnetism by means of a long isolated copper wire with a large galvanic battery

placed on a building. The bomb falls perpendicularly, and explodes on reaching the
ground.
While these early drones do not generally meet todays definition of a UAV, the
concept was strong enough that once winged aircraft had been invented, the concept
was still alive and kicking and would soon be implemented once again.
WORLD WAR I:
The first pilotless aircraft were developed during and shortly after World War I. The
first was the Aerial Target, developed in 1916. It was intended to take down
Zeppelins, but never flew. Shortly later, the Hewitt-Sperry Automatic Airplane (the
flying bomb) made its maiden flight, demonstrating the concept of unmanned
aircraft. This UAV was intended for use as an aerial

torpedo, an early version of modern cruise missiles. Control of these aircraft was
achieved using gyroscopes.
In November 1917, the Automatic Airplane was demonstrated for the US Army.
Upon the success of this demonstration, the Army commissioned a project to
build an aerial torpedo, which became known as the Kettering Bug and flew in
1918. While the technology was a success, it wasnt in time to fight during
wartime, which ended before the UAV could be developed and deployed.
Several successors were developed during the period after WWI and prior to
WWII. These included the Larynx, tested by the Royal Navy between 1927 and
1929; the radio-controlled Fairey Queen developed by the British in 1931; and
the British follow-up UAV DH.82B Queen Bee in 1935. Also following on the
earlier work by the Army, the US Navy continued to advance UAV technology,
experimenting with radio-controlled aircraft. In 1936, the term drone was first
coined, as the head of the Navys research group used it to describe radiocontrolled aerial targets.
During the technology rush of WWII, drones were used both as training tools for
antiaircraft gunners and for aerial attack missions. Nazi Germany also had
produced and used various UAVs during the course of WWII. After the war, jet
engines were applied to drones, with the first being the Teledyne Ryan Firebee I
of 1951. By 1955, the Model 1001, developed by Beechcraft, was developed for
the US Navy these UAVs were nothing more than remote-controlled airplanes
until the Vietnam Era.

MODERN ERA:
The birth of US UAVs began in 1959 when the US Air Force, concerned about
losing pilots over hostile territory, began planning for unmanned flights.
Following a Soviet Union shoot down of the secret U-2 aircraft in 1960, the

highly classified UAV program was launched under the code name Red Wagon.
Modern-era UAVs got their first use during the Aug 2 and Aug 4, 1964 clash in
the Tonkin Gulf between the US and North Vietnamese navies. During the
Vietnam War.
After Chinese photographs surfaced of downed US unmanned aircraft during and
after the Vietnam War, the official US Air Force response was no comment.
However, by 1973, the US military officially confirmed that they had been
utilizing UAV technology is Vietnam, stating that during the war, more than 3,435
UAV missions were flown, of which about 554 were lost in combat.
During the 1973 Yom Kippur War, Israel developed the first UAV with real-time
surveillance, after Soviet Union surface-to-air missiles used by Egypt and Syria
dealt heavy damage to Israels fighter jets. The images and radar decoying
provided by these UAVs helped Israel to neutralize Syrias air defenses at the start
of the 1982 Lebanon War, resulting in no pilots lost. By 1987, Israel had
developed proof-of-concept capabilities in tailless, stealth-based, threedimensional thrust vectoring flight control, jet steering UAVs for the first time.
Interest in UAV technology grew during the 1980s and 1990s being used during
the Persian Gulf War in 1991 and became cheaper and more capable fighting
machines. While most drones of the earlier years were primarily surveillance
aircrafts, some carried munitions. The General Atomics MQ-1, which utilized an
AGM-114 Hellfire air-to-ground missile, was known as an unmanned combat
aerial vehicle (UCAV).
POST 9/11:
While most UAVs were utilized by the military, the technology was
commissioned by the

CIA after the September 11, 2001 terrorist attacks.

Intelligence gathering operations began in 2004, with CIA-operated UAVs

primarily flown over Afghanistan, Pakistan, Yemen, and Somalia. The CIAs first
UAV program was called the Eagle Program.
As of 2008, The USAF has employed 5,331 UAVs, which is twice the number of
manned planes. Of these, the Predators have been the most commendable. Unlike
other UAVs, the Predator was armed with Hellfire missiles. The Predators were
used during the hunt for Osama Bin Laden and have demonstrated the capability
of pointing lasers at targets for pinpoint accuracy. The overall success of the
Predator missions is apparent because from June 2005 to June 2006 alone,
Predators carried out 2,073 successful missions in 242 separate raids.
While Predator is remotely operated via satellites from more than 7,500 miles
away, the Global Hawk operates virtually autonomously. Once the user pushes a
button, alerting the UAV to take off, the only interaction between ground and the
UAV is directional instructions via GPS. Global Hawks have the ability to take
off from San Francisco, fly across the US, and map out the entire state of Maine
before having to return.
In February 2013, it was reported that UAVs were used by at least 50 countries,
several of which have made their own, including Iran, Israel and China.
Recently, UAVs are becoming increasingly popular in the commercial and private
market. Amazon.com, the largest online retailer, said in December 2013 that it
was developing drone technology to one day deliver mail autonomously.
Drones are also being developed for hobbyists and other enthusiasts. In reality,
these types of aircraft have been common since the 1930s, when Reginald Denny
mass-produced the first radio-controlled aircraft for the hobby market. While RC
airplanes remained popular through the decades, recent technology is now making
them smaller, more powerful and more useful some adding cameras and GPS
trackers, as well as making them more affordable for everyday enthusiasts.

Building of drone:
There are different types of auto pilot systems which are available . They are
NAZA-M Lite
NAZA-M V1
NAZA-M V2
We are using NAZA-M v2 in our project. For building of a Drone:
nazam v2
building of quad copter
Components:
1.
2.
3.
4.
5.
6.
7.
8.

flight board(light version, v2)


pmu
gps
led
carbon frame (x axis)
brushless propulsion motors kv(920kv motors)
esc connectors (motor control)(electronics speed controller)
carbon fiber circuit board.

Why NAZA-Mv2?
NAZA is a light weight multi-axis control platform, specially designed for multirotor model hobbyists. Different from Woo Kong-M for heavy payloads and aero
photography, NAZA not only inherits the outstanding flight stability of DJI
products, but also provides excellent maneuverability, which gives hobbyists a
wonderful flight experience.
It is a small all-in-one module and supports firmware upgrades with extendible
data ports. The NAZAM GPS greatly enhances the functionality of NAZA-M.
With the new firmware, new attitude stabilization algorithm and optimized
control, the NAZA-M V2 provides better flight performance, even without the
GPS module. It has a brand new, smoother take-off algorithm and supports double

spring TX; every time you let go of the throttle stick it will hover. The NAZA
PMU V2 has enhanced BEC functionality and provides extendable CAN BUS
ports, which can support iOSD, Zen muse H3-2D gimbals (pitch control). Support
is also included for optional Bluetooth LED module to allow parameter
adjustment via a mobile APP (future firmware upgrade required for this
functionality).

Features:

All-in-one Design
Nine Types of Multi-rotors Supported
New Assistant Software for Smartphone
Independent PMU with amazing function extension
Enhanced Failsafe Mode
Two Levels of Low Voltage Protections
Multi-rotor One-power Output Fail Protection
Advanced & Improved Attitude Stabilization Algorithm
Multiple Flight Control Modes/Intelligent Switching
New Assistant Software & Firmware Online Update
GPS Module Available/Accurate Position Hold
Intelligent Orientation Control
Motor Arm and Motor Dis-arm
PPM, S-BUS & Ordinary Receiver Supported
Independent LED Module
Built-in Gimbal Stabilization Function
Remote Gain Adjustment

Whats difference of NAZA-M Lite/ NAZA-M V1/ NAZA-M V2

Product

Target

Hardware

Software

Function
Extension

Custome

Component

r
N AZ A- M
Lite

AP/RC Based on
entry level NAZA V1
platform; no
extension
ability

N AZ A- M

AP/RC

V1

N AZ A- M
V
C2o+mGbPoS

AP/RC

Major

NAZA lite 1.GPS (Optional)


Independen 2.No extended
t assistant
software
and
firmware;

Can be

Share the

connected
the NAZA to
V2
PMU, and will
have the
NAZA-M V2
expansion
function;

same
NAZAM V
assistant
software
and
firmware;

MC
GPSoptional

notsupport
Have
PMU,
Zenmuse H3 Independent
NAZAV22D/NAZA
BEC and LED
OSD/NAZA BT

in the future

module/IOSD)
1.GPS (Optional)

MC

through NAZAV2- GPSoptional


BEC/LED
PMU: such as
Zenmuse H32D/NAZA
BT
OSD/NAZA
module/IOSD/Grou
d
n Station

Optimized

Amazing function MC GPS

hardware
structure;
Independent
PMU module
with amazing
function
extension

extensionsuch
Zenmuse H3- as NAZAPMU
2D/NAZA
LED
V2
BT
OSD/NAZA
module/IOSD/Grou
d
n Station

ability;
Independent
LED module;

Assembly and Connection:

Main controller X1
PMUX1(power management unit)
GPS X1
GPS Bracket X1
LED X1, Servo Cable X8
Micro USB CableX1
3M Adhesive Tape

Main Controller:
Circuit diagram internally:

V1 Port Description:
Please remember the function of each port, which may help you to use the Naza-M
efficiently.

GPS unit:

The arrow mark indicated above is the pointer to navigate.

Step2 Assembly & Connection:


9 TYPES MULTIROTOR CONFIGURATIONS SUPPORTED:
The NAZA-M V2 is a powerful flight controller for enthusiast, commercial and
industrial flyers. Its easy to install, simple to configure and above all, extremely
stable. Nine types of traditional motor mixes are supported, making it ideal for every
setup.

The NAZA-M V2 supports 9 types of traditional motor mixer:

We are using quad copter x in our project

Hardware:

PMU V2 - New case design with CANBUS port. Enhanced BEC functionality,
better heat dissipation. Extra CANBUS ports, enhances the expandability of the
system and will support Gopro Zen muse, iOSD and Bluetooth module for assistant
software use on smart phones in the future, etc..
NAZA V1 can also be upgraded using PMU V2 and support Gopro Zen muse, iOSD
and Bluetooth module.
Firmware and functions:
New attitude stabilization algorithm, provides better flight performance/
maneuverability.

New flight control performance, provides better flight experience; (flight control is
smoother, takeoff is easier).
Support for Octorotor Onemotor stopped still can land safely (Hexarotor, Octo
rotor) Automatic course deviation compensation, reduced the effects of magnetic
disturbance interference around the compass detection & warning added IMU
advanced calibration, error identification and warning, reduced the impact of sensor
error to the flight performance.
Features:
All-in-one Design:
DJI adheres to continuous innovating and improving, with the new firmware, new
attitude stabilization algorithm and optimized hardware structure, the Naza-M V2
provides better flight performance. The innovative All-in-one design simplifies
installation and saves space and weight. It contains inner damping, controllers, 3axis gyroscope, 3-axis accelerometer and barometer in its light and small Main
Controller. It can measure flying altitude, attitude and therefore can be used for
autopilot/automatic control.
Independent PMU with amazing function extension:
The NAZA PMU V2 has enhanced BEC functionality and provides extendable CAN
BUS ports, which can support iOSD, Zen muse H3-2D gimbals (pitch control).
Support is also included for optional Bluetooth LED module to allow parameter
adjustment via a mobile APP (future firmware upgrade required for this
functionality).
PMU:
Advanced & Improved Attitude Stabilization Algorithm.
The latest fourth generation attitude stabilization algorithm not only inherits the
outstanding flight stability of DJI products, but also provides excellent
maneuverability even without the GPS module. It is more flexible and stable, and
gives the hobbyists a wonderful flight experience. New features have been included
such GPS course automatic compensation, GPS & Compass sensor calibration, new
take-off mode and so on.

Carbon frame:
The Mini D is a Clean/Dirty plate design separated by M3 dampers that allows
you to take jello - free videos with your HD camera. I have flown it numerous times
now but have never had any "jello" issues. So, what makes this frame different?

3 different thickness of carbon fiber plates were used:


Arms - 3mm thickness and individual, so very easy to change and no need to
buy an entire new plate
Dirty plate & NEW - Belt design consists of 1.5mm CF, Clean-1.5mm
CF ,Top plate - 1mm CF
As you know, most of the other dirty part designs are almost identical. So we
decided to make our own Belt design. This has proven to provide an amazingly
strong frame while saving both a lot of weight, and allowing for a second dirty plate.

Mini D also includes its own Power Distribution Board! There are both "+" and
"-" poles which make it easy to attach your choice of up to 12A ESCs soldered
directly.
Adjustable CG (Center-of-Gravity) via changeable dampener positions for the clean
section and also adjustable FC (Flight Controller) positioning.

Different Variables for FPV/REC camera:


CCD Camera can be used naked with provided camera plate w/ Mobius on top plate.
CCD camera in metal casing mounted (3 Different position holes for Case)
Removable GP2/3 plate can be easily attached to front.
Also, if you get m3 size thumb nuts for second arm hole placement, it can be
foldable as well.
Kit includes:
4xCF plates (Dirty, new* belt for afro ESCs, clean and top plates)
4xCF landings
4xRivnuts , used as landings and foldable mechanism. (NEW)
4xM3 vibration dampers (NEW Extra Soft)
6xAnodized black standoffs
1xGopro,mobius HD camera plate
1x Naked CCD camera plate
2xCopper plates for ESC power dist.
2x3mm belt standoffs

Screws, nuts and cable tie for landings


Why Brushless DC Motors?
Brushless DC electric motor (BLDC motors, BL motors) also known as
electronically commutated motors (ECMs, EC motors) are synchronous motors that
are powered by a DC electric source via an integrated inverter/switching power
supply, which produces an AC electric signal to drive the motor. In this context, AC,
alternating current, does not imply a sinusoidal waveform, but rather a bi-directional
current with no restriction on waveform. Additional sensors and electronics control
the inverter output amplitude and waveform (and therefore percent of DC bus
usage/efficiency) and frequency (i.e. rotor speed).
ESC Connectors:

Brushless motors offer several advantages over brushed DC motors


more torque per weight,
more torque per watt (increased efficiency), increased reliability,
reduced noise,
longer lifetime (no brush and commutator erosion), elimination of ionizing
sparks from the commutator, and overall reduction of elect (EMI).

ESC Connectors:
An electronic speed control or ESC is an electronic circuit with the purpose to vary
an electric motors speed, its direction and possibly also to act as a dynamic brake.

ESCs are often used on electrically powered radio controlled models, with the variety
most often used for brushless motors essentially providing an electronically
generated three- phase electric power low voltage source of energy for the motor.

Step3 Double Check:


In this step, turn on the transmitter, connect the battery to the PMU, and then watch
the LED, if you can see the LED blinks (

), the system is

working.
Assistant Software Installation and Configuration:
Step1 Software and Driver Installation Installing and running on Windows

1. Please download the driver and the Assistant installation software in EXE format
from www.dji.com.
2. Switch on the transmitter and then power on your autopilot system.
3. Connect your autopilot system and PC via a Micro-USB cable.
4. Open the driver installation software and follow the instructions to complete
installation.
5. Run the Assistant installation software and follow the instructions to complete
installation. The installer in EXE format is supported on Win XP, Win7, Win8 (32 or
64 bit).
Installing and running on Mac OS X:
1. Download the Assistant installer in DMG format from the download page of
NAZA-M V2 on the DJI website.
2. Run the installation software and follow the prompts to finish installation.

3.

When

launching for the first time if use Launch pad to run the NAZA-M V2 Assistant
Software, Launch pad wont allow access because the software has not been reviewed
by Mac App Store.

4. Locate the NAZA-M V2 icon in the Finder and open the file by Control or right
clicking the icon and selecting Open from the menu.

5. After the first successful launch, double-clicking the NAZA-M V2 icon in the
Finder or using Launch pad will open the application.

Installer in DMG format is supported on Mac OS X 10.6or above.

The NAZA-MV2Assistant on Mac OS X and Windows are exactly the same. The
Assistant appear in other places of this manual is based on Windows version.

Step2 Configuration by Assistant on a PC:


1. Power on the PC. Make sure your computer is connected to the Internet for the first
time you use.
2. Switch on the transmitter first, and then power on the autopilot system. Connect
the autopilot system to the PC with a Micro-USB cable. DO NOT break the
connection until setup is finished.
3. Run the Assistant Software.
4. Observe the indicators on the left bottom of the software. (They are the connection
indicator and communication indicator in order.) If the communication indicator is
blinking, that the software is ready, please go to next step.

5. Select the Info option. Check the software firmware version. If the upgrade is
available, you may update the assistant software.
6. Select the Upgrade option. Check the Main Controller, GPS and IMU firmware
version.
7. Select the Basic option. Please follow step-by-step for your first-timeconfiguration. Basic configuration is necessary, including Mixer Type, Mounting,
RC, and Gain settings.
8. You can click the Advanced option for more parameter settings. Advanced
setting is optional. There are settings of Motor, Failsafe, Intelligent Orientation
Control (IOC), Gimbals, Low-Voltage Alert, and Flight Limits. Read the instruction
in the assistant software to obtain more details.
9. Select the Viewer option to check all parameters.
10. Then break the Micro-USB cable, power off the aircraft. Finished.

(1) You may be required to fill register information for your first-time-usage.
(2) If the communication indicator is blue on, please double check the connections.
(3) Basic configuration is necessary before you go to the Basic Flying Test.
(4) Users are required to install a Windows system, since the software can only run
on Windows
system.

(1) If the firmware upgrade is available, please upgrade it by referring to the


Firmware Upgrade in the Appendix.
(2) This step is required to use together with the assistant software to obtain more
details.

Recommended Parameters
Recommended Settings for using F330/F450/F550

Configuration Information
Motor

ESC

Attitude Gain

Propell

Battery

Basic Gain
Weight

Pitch

Roll

Yaw

Vertical

Pitch

Roll

F330

DJI-

er
DJI-

DJI-8

3S-

790 g

140

140

100

110

140

140

F450

DJI-

DJI-

DJI-8

3S-

890 g

150

150

100

105

150

150

F550 DJI2212 DJI30A

DJI-8
Inch 4S3300 1530 g 170

170

150

140

170

170

Basic Flying

Control Mode Knowledge


Please read the Control Mode Knowledge clearly before usage, to know how to control
the aircraft.
Different control modes will give you different flight performances. Please make sure
you
understand the features and differences of the three control modes.
GPS ATTI.

ATTI. Mode

Mode

Mode

Manual

With GPS
Module

Rudder Angular

Maximum rudder angular velocity is 150/s

Velocity
YES
Command
Linearity
Multi attitude
Command
Stick
Meaning

control; Stick center


position for
0 attitude, its
endpoint is 35.

Max-angular velocity is 150/s. No


attitude angle limitation and vertical
velocity locking.
Maintain the altitude best above 1 meter from
Altitude
Lock

Stick
Released

ground.
Lock position if

Only attitude

GPS

stabilizing.

signal is adequate
When GPS signal

GPS Lost

NO

has been lost for


3s, system enters

Only performing

NOT Recommend

---

attitude stabilizing
without position
lock.

ATTI. Mode
automatically.

Safety

Attitude & speed mixture control

Depends on

ensures stability

experience.

Enhanced FailSafe(Position

Auto Level Fail-Safe


(Attitude stabilizing)

Depends on
experience. lock
when hovering)
With GPS/Compass module and the failsafe requirements are
satisfied, in each Control Mode (including GPS Mode, ATTI.
Mode, Manual Mode and

IOC Mode), the aircraft will enter the failsafe Mode. AP work
Sports flying.
--Application
s

start & Stop Motor Knowledge

(1) Both Immediately Mode and Intelligent Mode are available in the Assistant
Software: Advanced->Motor->Stop Type.
(2) Stop Motor method is defaulted to Immediately Mode. Please get to know well
about this section before flying.
1. Start Motor: Pushing throttle stick before takeoff will not start the motors. You
have to execute any one of following four Combination Stick Commands (CSC) to
start the motors.
2. Stop Motor: We provide two options to stop motors in the assistant software:
Immediately and Intelligent.
(1) Immediately Mode: If you select this mode, in any control mode, once motors
start and throttle stick is over 10%, motors will not stop immediately only when
throttle stick is back under 10% the motors will stop. In this case, if you push the
throttle stick over 10% within 5seconds after motors stop, motors will re-start, CSC
is not needed. If you dont push throttle stick after motors start in three seconds,
motors will stop automatically.
(2) Intelligent Mode: By using this mode, different control mode has different way
of stopping motors. In Manual Mode, only executing CSC can stop motors. In ATTI.
Mode or GPS ATTI. Mode, any one of following four cases will stop motors:
a) You dont push throttle stick after motors start within three seconds;
b) Executing CSC;
c) Throttle stick under 10%, and after landing for more than 3 seconds.

d) If the angle of multi-rotor is over 70, and throttle stick under 10%.

Notes of Intelligent Mode:

(1) In ATTI. / GPS ATTI. Mode, it has landing judgment, which will stop motors.
(2) Start motors in ATTI. / GPS ATTI. Mode, you have to execute CSC and then push
throttle stick over 10% in 3 seconds, otherwise motors will stop after 3 seconds.
(3) During normal flight, only pull throttle stick under 10% will not stop motors in
any control mode.
(4) For safety reason, when the slope angle of multi-rotor is over 70 during the flight
in ATTI. / GPS ATTI. Mode (may be caused by collision, motor and ESC error or
propeller broken down), and throttle stick is under 10%, motors will stop
automatically.
Notes of Intelligent Mode & Immediately Mode:

(1) If you choose the Immediately Mode, you should not pull throttle stick under 10%
during flight, because it will stop motors. If you do it accidentally, you should push
the throttle stick over 10% in 5s to re-start motors.
(2) DO NOT execute the CSC during normal flight without any reason, or it will stop
motors at once.

(1) If you choose the Intelligent mode, and the throttle stick is under 10%, this will
trigger the landing Procedure, in any control mode. In this judgment, pitch, roll and
yaw controls are denied except the throttle, but multi-rotor will still auto level.
(2) In any control mode, DO NOT pull throttle stick under 10% during normal flight
without any reason.

(1) Any of these two cut off types will only work properly if TX calibration is correct
done. (2) In failed-safe, CSC is denied by the main controller, motors will hold their
state.

Step1 Compass Calibration:


Without GPS module, please skip this step. If you use with GPS module, follow
step-by-step for calibration.

(1) DO NOT calibrate your compass where there is magnetic interference, such as
magnetite, car park, and steel reinforcement under the ground.
(2) DO NOT carry ferromagnetic materials with you during calibration, such as keys
or cell phones.
(3) Compass module CANNOT work in the polar circle.
(4) Compass Calibration is very important, otherwise the system will work abnormal.
Calibration Procedures:
1. Switch on the transmitter, and then power on autopilot system!

2. Quickly switch the control mode switch from GPS Mode to Manual Mode and
back to GPS Mode (or from GPS Mode to ATTI. Mode and back to GPS Mode) for
more than 5 times, The LED indicator will turn on constantly yellow so that the
aircraft is ready for the calibration.
3. (Fig.1) Hold your Multi-rotor horizontal and rotate it around the gravitational
force line (about 360o ) until the LED changes to constant green, and then go to the
next step.
4. (Fig.2)Hold your Multi-rotor vertically and rotate it (its nose is downward)
around the gravitational force line (about 360o ) until the LED turns off, meaning
the calibration is finished.
5. If the calibration was successful, calibration mode will exit automatically. If the
LED keeps flashing quickly Red, the calibration has failed. Switch the control
mode switch one time to cancel the calibration, and then re-start from step 2

1. When the GPS is abnormal, the Main controller will tell you by the LED
blinking Red and Yellow alternately ( ), disable the GPS Module, and automatically
enter the aircraft into the ATTI. Mode.
2. You dont need to rotate your multi-rotor on a precise horizontal or vertical
surface, but keep at least 45 difference between horizontal and vertical calibration.
3. If you keep having calibration failure, it might suggest that there is very strong
magnetic interference around the GPS /Compass module, please avoid flying in this
area.
4. When to do re-calibration

(1) The flight field is changed.


(2) When the multi-rotor mechanical setup has changed:
a) If the GPS/Compass module is re-positioned.
b) If electronic devices are added/removed/ re-positioned (Main Controller, servos,
batteries, etc.).
c) When the mechanical structure of the multi-rotor is changed.
(3) If the flight direction appears to be shifting (meaning the multi-rotor doesnt
fly straight). (4) The LED indicator often indicates abnormality blinking when
the multi-rotor spins. (It is normal for this to happen only occasionally)
Step2 Assembly Checking List:
Please check each item, to make sure for safety.

Any of the following mistakes will lead to a dangerous accident, double check all
these items:
(1) Rotation direction of motor is opposite
(2) Infirm connection between the motor and the ESC
(3) Wrong or infirm installation of Main controller
(4) Wrong or infirm connection between the main controller and ESC.
(5) Propeller installation mistake
(6) Magnetization of the compass

Make sure the following items are correct.


(1) Make sure you have assembled your multi-rotor correctly.
(2) Make sure you have done the configuration procedure correctly. (3) Make sure
all connections are in good condition.
(4) Make sure batteries are fully charged for your transmitter, autopilot system and
all devices.
Step3 Before Flight
Carry out the following procedures (is based on Intelligent Mode of Motor Stop) to
make sure all configurations are correct. Refer to the Appendix->LED Description
for more LED details.
1. Always switch on the transmitter first, then power on multi-rotor!
2. Keep the aircraft stationary until the system start and self-check has finished ( ).
After that, the LED may blink Yellow 4 times quickly ( ). Start motor is disable
during LED blinking Yellow 4 times quickly ( ), as the system is warming up.
3. After the 4 times Yellow LED disappears, toggle the control mode switch on
your transmitter to make sure it is working properly. For example, LED blinks ( ),
which means the system is in ATTI. Mode and the GPS signal is worst Check it
with LED indicator to specify the current working mode for MC. See following
table for details about LED indicator;
(1) There are Manual Mode and ATTI. Mode without a GPS/Compass module, no
GPS signal status LED indicator.

(2) After connecting to the GPS/Compass module, GPS ATTI. Mode is available,
and GPS signal status LED indicator is available.

Control Mode LED Indicator


GPS Signal Status LED
Indicator
Manual Mode: NO LED
Signal is best (GPS satellites > 6):
NOLED
ATTI. Mode: (indicates that is stick(s) not at
Signal is well (GPS satellites =
6):
center)
GPSMode: (indicatesthat is stick(s) not at center)

Signal is bad(GPS satellites = 5):


Signal is worst (GPS

satellites< 5)

4. Keep the aircraft stationary, and then push both sticks to the left bottom or right
bottom (shown as the following chart, defined as Combination Stick Commands
(CSC)), to start the motors.
5. Release the yaw, roll and pitch sticks and keep them at the midpoint, and the
throttle stick under the midpoint. Then check whether all propellers are rotating
correctly.
6. Stop motors, power off the Multi-rotor.
7. Make sure all settings and configurations are correct and then you can take off
you aircraft. After power on, if abnormal LED Indicator occurs, please refer to the
Abnormal LED instruction in the FAQ and aids troubleshooting.
Step4 Flying Test:

1. Choose an open space without obstruction, tall buildings and crowds as flying
filed. Place the aircraft 3 meters away from you and others, to avoid accidental
injury.
2. If in GPS ATTI. Mode, place the aircraft in an open space without buildings or
trees. Take off the aircraft after 6 or more GPS satellites are found (Red LED blinks
once or no blinking). If in Manual Mode or ATTI. Mode, you can skip this step.
3. Start-up
(1) Switch on the transmitter first, then power on multi-rotor! Keep the aircraft
stationary until the system start and self-check has finished.
(2) Please wait for the system to warm up gradually with the LED blinks Yellow 4
times quickly
( ). You should not start the motors until the blinking disappears.
(3) Keep the aircraft stationary, and execute the CSC to start the motors.
(4) Release the yaw, roll and pitch sticks and keep them at the midpoint, at the same
time raise the throttle stick from the bottom. The motors will stop if you do not
push the throttle stick from the bottom within 3 sec and you will need to re-start the
motors.
(5) Keep raising the throttle stick until all the rotors are working, push the throttle
stick to the midpoint and then take-off your multi-rotor gently, pay attention not to
push the stick excessively.
(6) Pay attention to the aircraft movement at any time when flying, and use the
sticks to adjust the aircrafts position. Keep the yaw, roll, pitch and throttle sticks at
the midpoint to hover the aircraft at the desired height.

4. Lower the aircraft slowly. Pull the throttle stick to the bottom and then execute
the CSC to stop the motors after landing.
5. Please always power off the Multi-rotor first, and then switch off the transmitter
after landing. FLYING NOTES (VERY IMPORTANT)

(1) If the warm up waiting is longer than 2 minutes (the 4 times Yellow blink
continues), please power off for 10 minutes, cold start, and then connect the
assistant software, enter the "Tools" - > IMU calibration, carry out the Advanced
calibration.
(2) If you enable the Immediately Mode of Motor Stop; you should not pull throttle
stick under 10% during flight, because it will stop motors. If you do it accidentally,
you should push the throttle stick over 10% in 5s to re-start motors.
(3) DO NOT execute the CSC during normal flight without any reason, or it will
stop motors at once.
(4) Pay attention to the GPS satellite status LED indicator. Bad GPS signal may
lead the aircraft to drift when hovering.
(5) DO NOT fly near to ferromagnetic substances, to avoid strong magnetic
interference with the GPS.
(6) Please avoid using GPS ATTI. Mode in the areas, where GPS signal is most
likely bad.
(7) If the LED flashes quickly Red then this indicates battery voltage is low, land
ASAP.

(8) If the transmitter indicates low-battery alarm, please land ASAP. In this
condition the transmitter may cause the aircraft to go out of control or even crash.
(9) In GPS ATTI. Mode, make sure that the home point is recorded when the GPS
signal is well; otherwise the home point recording may be not so precise.

(1) In ATTI Mode, throttle stick center position is for 0m/s along the vertical
direction. You should keep the position of throttle stick higher than 10% from cutthrottle during the flight! In any control mode, DO NOT pull throttle stick under
10% during normal flight without any reason.
(2) It is recommended to land the aircraft slowly, to prevent the aircraft from
damage when landing.
(3) If Low-Voltage Alarm is set, the aircraft will act according to the configuration
of the Assistant Software once Low-Voltage Alarm is triggered. Make sure you
remember what you have set before.
4) If Fail-Safe function is set, the aircraft will act according to the configuration of
the Assistant Software once Fail-Safe is triggered. Make sure you remember what
you have set before. Advanced Function A1 Failsafe an introduction of Go-Home
and landing.

Arduino Uno micro controller:

The Arduino Uno is a microcontroller board based on the ATmega328. It has 14


digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs,
a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and
a reset button. It contains everything needed to support the microcontroller; simply
connect it to a computer with a USB cable or power it with an AC-to-DC adapter or
battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-toserial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to ersioR2).

Power:
The Arduino Uno can be powered via the USB connection or with an external
power supply. The power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart)
or battery. The adapter can be connected by plugging a 2.1mm center-positive plug
into the board's power jack. Leads from a battery can be inserted in the Gnd and
Vin pin headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less
than 7V, however, the 5V pin may supply less than five volts and the board may be
unstable. If using more than 12V, the voltage regulator may overheat and damage
the board. The recommended range is 7 to 12 volts.
The power pins are as follows:
VIN. The input voltage to the Arduino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated power
source).
You can supply voltage through this pin, or, if supplying voltage via the power jack,
access it through this pin.
5V. this pin outputs a regulated 5V from the regulator on the board. The board can
be supplied with power either from the DC power jack (7 - 12V), the USB
connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V
or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.

3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw
is 50 mA.
GND. Ground pins.
IOREF. This pin on the Arduino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin
voltage and select the appropriate power source or enable voltage translators on the
outputs for working with the 5V or 3.3V.
Input and Output:
Each of the 14 digital pins on the Uno can be used as an input or output, using pin
Mode(), digital Write(), and digital Read() functions. They operate at 5 volts. Each
pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 k Ohms. In addition, some pins have specialized
functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial
data.

These

pins

are

connected

to

the

corresponding

pins

of

the ATmega8U2 USB-to-TTL Serial chip.


External Interrupts: 2 and 3. These pins can be configured to trigger an
interrupt on a low value, a rising or falling edge, or a change in value.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analog Write
() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication using the SPI library.

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits
of resolution (i.e. 1024 different values). By default they measure from ground to 5
volts, though is it possible to change the upper end of their range using the AREF pin
and the analog Reference () function. Additionally, some pins have specialized
functionality:
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using
the Wire library.
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analog Reference ().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.
See also the mapping between Arduino pins and ATmega328 ports. The mapping for
the Atmega8, 168, and 328 is identical.
Communication:
The Arduino Uno has a number of facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega328 provides UART TTL
(5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX).
An ATmega16U2 on the board channels this serial communication over USB and
appears as a virtual com port to software on the computer. The '16U2 firmware uses
the standard USB COM drivers, and no external driver is needed. However, on
Windows, an .inf file is required. The Arduino software includes a serial monitor

which allows simple textual data to be sent to and from the Arduino board. The RX
and TX LEDs on the board will flash when data is being transmitted via the USBto-serial chip and USB connection to the computer (but not for serial
communication on pins 0 and 1).
A Software Serial library allows for serial communication on any of the Uno's
digital pins.
The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino
software includes a Wire library to simplify use of the I2C bus.
Programming:
The Arduino Uno can be programmed with the Arduino software (download). Select
"Arduino Uno from the Tools > Board menu (according to the microcontroller on
your board). For details, see the reference and tutorials.
The ATmega328 on the Arduino Uno comes preburned with a boot loader that
allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol.
You can also bypass the boot loader and program the microcontroller through the
ICSP (In-Circuit Serial Programming) header using Arduino ISP or similar.
The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is
available. The ATmega16U2/8U2 is loaded with a DFU boot loader, which can be
activated by:

On Rev1 boards: connecting the solder jumper on the back of the board (near
the map of Italy) and then resetting the 8U2.

On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB
line to ground, making it easier to put into DFU mode.
You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac
OS X and Linux) to load a new firmware. Or you can use the ISP header with an
external programmer (overwriting the DFU boot loader).
Automatic (Software) Reset
Rather than requiring a physical press of the reset button before an upload, the
Arduino Uno is designed in a way that allows it to be reset by software running on a
connected computer. One of the hardware flow control lines (DTR) of
theATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100
nanofarad capacitor. When this line is asserted (taken low), the reset line drops long
enough to reset the chip. The Arduino software uses this capability to allow you to
upload code by simply pressing the upload button in the Arduino environment. This
means that the boot loader can have a shorter timeout, as the lowering of DTR can
be well-coordinated with the start of the upload.
This setup has other implications. When the Uno is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from
software (via USB). For the following half-second or so, the boot loader is running
on the Uno. While it is programmed to ignore malformed data (i.e. anything besides
an upload of new code), it will intercept the first few bytes of data sent to the board
after a connection is opened. If a sketch running on the board receives one-time
configuration or other data when it first starts, make sure that the software with
which it communicates waits a second after opening the connection and before
sending this data.

The Uno contains a trace that can be cut to disable the auto-reset. The pads on either
side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN".
You may also be able to disable the auto-reset by connecting a 110 ohm resistor
from 5V to the reset line.
USB Over current Protection:
The Arduino Uno has a resettable polyfuse that protects your computer's USB ports
from shorts and overcurrent. Although most computers provide their own internal
protection, the fuse provides an extra layer of protection. If more than 500 mA is
applied to the USB port, the fuse will automatically break the connection until the
short or overload is removed.
Physical Characteristics:
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively,
with the USB connector and power jack extending beyond the former dimension.
Four screw holes allow the board to be attached to a surface or case. Note that the
distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple of the
100 mil spacing of the other pins.
Summary:
Microcontroller
Operating Voltage
InputVoltage
(recommended)
Input Voltage (limits)
Digital I/O Pins
Analog Input Pins
DC Current per I/O Pin
DC Current for 3.3V Pin
Flash Memory

ATmega328
5V
7-12V
6-20V
14 (of which 6 provide PWM output)
6
40 mA
50 mA
32 KB (ATmega328) of which 0.5 KB used by
boot loader

SRAM
EEPROM
Clock Speed
Length
Width
Weight

2 KB (ATmega328)
1 KB (ATmega328)
16 MHz
68.6 mm
53.4 mm
25 g

Datasheet:
Special Microcontroller Features:
-Power-on Reset and Programmable Brown-out Detection.
Internal Calibrated Oscillator External and Internal Interrupt Sources.
Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down,
Standby, and Extended Standby.
I/O and Packages:
23 Programmable I/O Lines 28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and
32-pad QFN/MLF Operating Voltage: 1.8 - 5.5V
Temperature Range:
-40C to 85C
Speed Grade:
0 - 4MHz@1.8 - 5.5V,

0 - 10MHz@2.7 - 5.5.V,
0 - 20MHz @ 4.5 - 5.5V
Power Consumption at 1MHz, 1.8V, 25C
Active Mode: 0.2mA
Power-down Mode: 0.1A
Power-save Mode: 0.75A (Including 32 kHz RTC)
Pin diagram:

Different types of Arduino Uno:


1) Arduino mini:

The Arduino Mini is a small microcontroller board originally based on


the ATmega168, but now supplied with the 328. intended for use on breadboards
and when space is at a premium. It has 14 digital input/output pins (of which 6 can

be used as PWM outputs), 8 analog inputs, and a 16 MHz crystal oscillator. It can
be programmed with the USB Serial adapter or other USB or RS232 to TTL serial
adapter.
Summary:
Microcontroller
Operating Voltage
Input Voltage
Digital I/O Pins
Analog Input Pins
DC Current per I/O Pin
Flash Memory
SRAM
EEPROM
Clock Speed
Length
Width
2)Arduino Nano:

ATmega328
5V
7-9 V
14 (of which 6 provide PWM output)
8 (of which 4 are broken out onto pins)
40 mA
32 KB (of which 2 KB used by boot loader)
2 KB
1 KB
16 MHz
30 mm
18 mm

The Arduino Nano is a small, complete, and breadboard-friendly board based on


the ATmega328 (Arduino Nano 3.x) orATmega168 (Arduino Nano 2.x). It has
more or less the same functionality of the Arduino Duemilanove, but in a different
package. It lacks only a DC power jack, and works with a Mini-B USB cable
instead of a standard one. The Nano was designed and is being produced by
Gravitech.
Specifications:
Microcontroller
Operating
Voltage
(logic level)
Input
Voltage
(recommended)
Input Voltage (limits)
Digital I/O Pins
Analog Input Pins
DC Current per I/O
Pin
Flash Memory
SRAM
EEPROM
Clock Speed
Dimensions
Length
Width
Weight

Atmel ATmega168 or ATmega328


5V
7-12 V
6-20 V
14 (of which 6 provide PWM output)
8
40 mA
16 KB (ATmega168) or 32 KB (ATmega328) of which
2 KB used by boot loader
1 KB (ATmega168) or 2 KB (ATmega328)
512 bytes (ATmega168) or 1 KB (ATmega328)
16 MHz
0.73" x 1.70"
45 mm
18 mm
5g

3) Arduino Lilly pad:

The Lily Pad Arduino Simple is a microcontroller board designed for wearables
and e-textiles. It can be sewn to fabric and similarly mounted power supplies,
sensors and actuators with conductive thread. Unlike the Lily Pad Arduino Main
Board, the Lily Pad Simple has only 9 pins for input/output. Additionally, it has a
JST connector and a built in charging circuit for Lithium Polymer batteries. The
board is based on the ATmega328.
Summary:
Microcontroller
Operating Voltage
Input Voltage
Digital I/O Pins
Analog Input Pins
DC Current per I/O Pin
Flash Memory
SRAM
EEPROM
Clock Speed

ATmega328
2.7-5.5 V
2.7-5.5 V
9 (of which 5 provide PWM output)
4
40 mA
32 KB (of which 2 KB used by boot loader)
2 KB
1 KB
8 MHz

4) Arduino mega 2560:

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. It


has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16
analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a computer with a USB

cable or power it with a AC-to-DC adapter or battery to get started. The Mega is
compatible with most shields designed for the Arduino Duemilanove or Diecimila.
The Mega 2560 is an update to the Arduino Mega, which it replaces.
Summary:
ATmega2560
Microcontroller
Operating Voltage

5V

Input Voltage (recommended)

7-12V

Input Voltage (limits)

6-20V

Digital I/O Pins

54 (of which 15 provide PWM output)

Analog Input Pins

16

DC Current per I/O Pin

40 mA

DC Current for 3.3V Pin

50 mA

Flash Memory

256 KB of which 8 KB used by boot loader

SRAM

8 KB

EEPROM

4 KB

Clock Speed

16 MHz

5) Arduino mega ADK:

The

Arduino

MEGA

ADK

is

microcontroller

board

based

on

the ATmega2560 (datasheet). It has a USB host interface to connect with Android
based phones, based on the MAX3421e IC. It has 54 digital input/output pins (of
which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware
serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP
header, and a reset button.
The MEGA ADK is based on the Mega 2560.
Similar to the Mega 2560 and Uno, it features an ATmega8U2 programmed as a
USB-to-serial converter.

Summary:
Microcontroller
Operating Voltage
Input Voltage (recommended)
Input Voltage (limits)
Digital I/O Pins
Analog Input Pins
DC Current per I/O Pin
DC Current for 3.3V Pin
Flash Memory
SRAM
EEPROM
Clock Speed
USB Host Chip

ATmega2560
5V
7-12V
6-20V
54 (of which 15 provide PWM output)
16
40 mA
50 mA
256 KB of which 8 KB used by boot loader
8 KB
4 KB
16 MHz
MAX3421E

Pin Descriptions for AT mega 328:


Vcc
Digital supply voltage
GND
Ground.
Port B (PB7:0)
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port B output buffers have symmetrical drive characteristics with
both high sink and source capability. As inputs, Port B pins that are externally
pulled low will source current if the pull-up resistors are activated. The Port B pins
are tristated when a reset condition becomes active, even if the clock is not running.

Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator amplifier and input to the internal clock operating circuit.
Depending on the clock selection fuse settings, PB7 can be used as output from the
inverting Oscillator amplifier. If the Internal Calibrated RC Oscillator is used as
chip clock source, PB7...6 is used as TOSC2...1 input for the Asynchronous
Timer/Counter2 if the AS2 bit in ASSR is set.
Port C (PC5:0):
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The PC5...0 output buffers have symmetrical drive characteristics with
both high sink and source capability. As inputs, Port C pins that are externally
pulled low will source current if the pull-up resistors are activated. The Port C pins
are tristated when a reset condition becomes active, even if the clock is not running.
PC6/RESET:
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C. If the
RSTDISBL Fuse is un programmed, PC6 is used as a Reset input. A low level on
this pin for longer than the minimum pulse length will generate a Reset, even if the
clock is not running.
Port D (PD7:0):
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port D output buffers have symmetrical drive characteristics with
both high sink and source capability. As inputs, Port D pins that are externally

pulled low will source current if the pull-up resistors are activated. The Port D pins
are tristated when a reset condition becomes active, even if the clock is not running.
AVCC:
AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It
should be externally connected to VCC, even if the ADC is not used. If the ADC is
used, it should be connected to VCC through a low-pass filter. Note that PC6...4
use digital supply voltage, VCC.
AREF
AREF is the analog reference pin for the A/D Converter.
ADC7:6
In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D
converter. These pins are powered from the analog supply and serve as 10-bit ADC
channels.
The alternate pin configuration is as follows:
PORT B:
AIN1/OC2B/PCINT23 Port D, Bit 7
AIN1, Analog Comparator Negative Input. Configure the port pin as input with the
internal pull-up switched off to avoid the digital port function from interfering with
the function of the Analog Comparator. PCINT23: Pin Change Interrupt source 23.
The PD7 pin can serve as an external interrupt source.

AIN0/OC0A/PCINT22 Port D, Bit 6


AIN0, Analog Comparator Positive Input. Configure the port pin as input with the
internal pull-up switched off to avoid the digital port function from interfering with
the function of the Analog Comparator. OC0A, Output Compare Match output: The
PD6 pin can serve as an external output for the Timer/Counter0 Compare Match A.
The PD6 pin has to be configured as an output (DDD6 set (one)) to serve this
function. The OC0A pin is also the output pin for the PWM mode timer function.
PCINT22: Pin Change Interrupt source 22. The PD6 pin can serve as an external
interrupt source.
T1/OC0B/PCINT21 Port D, Bit 5
T1, Timer/Counter1 counter source.
OC0B, Output Compare Match output: The PD5 pin can serve as an external output
for the Timer/Counter0 Compare Match B. The PD5 pin has to be configured as an
output (DDD5 set (one)) to serve this function. The OC0B pin is also the output pin
for the PWM mode timer function.
PCINT21: Pin Change Interrupt source 21. The PD5 pin can serve as an external
interrupt source.
XCK/T0/PCINT20 Port D, Bit 4
XCK, USART external clock.

T0, Timer/Counter0 counter source. PCINT20: Pin Change Interrupt source 20.
The PD4 pin can serve as an external interrupt source.
INT1/OC2B/PCINT19 Port D, Bit 3
INT1, External Interrupt source 1: The PD3 pin can serve as an external
interrupt source.
OC2B, Output Compare Match output: The PD3 pin can serve as an external output
for the Timer/Counter0 Compare Match B. The PD3 pin has to be configured as an
output (DDD3 set (one)) to serve this function. The OC2B pin is also the output pin
for the PWM mode timer function.
PCINT19: Pin Change Interrupt source 19. The PD3 pin can serve as an external
interrupt source
INT0/PCINT18 Port D, Bit 2
INT0, External Interrupt source 0: The PD2 pin can serve as an external interrupt
source.
PCINT18: Pin Change Interrupt source 18. The PD2 pin can serve as an external
interrupt source.
TXD/PCINT17 Port D, Bit 1
TXD, Transmit Data (Data output pin for the USART). When the USART
Transmitter is enabled, this pin is configured as an output regardless of the value of
DDD1.
PCINT17: Pin Change Interrupt source 17. The PD1 pin can serve as an external
interrupt source.

RXD/PCINT16 Port D, Bit 0


RXD, Receive Data (Data input pin for the USART). When the USART Receiver is
enabled this pin is configured as an input regardless of the value of DDD0.
When the USART forces this pin to be an input, the pull-up can still be controlled
by the PORTD0 bit.
PCINT16: Pin Change Interrupt source 16. The PD0 pin can serve as an external
interrupt source.
PORT C:
RESET/PCINT14 Port C, Bit 6
RESET, Reset pin: When the RSTDISBL Fuse is programmed, this pin functions
as a normal I/O pin, and the part will have to rely on Power-on Reset and Brownout Reset as its reset sources.
When the RSTDISBL Fuse is un programmed, the reset circuitry is connected to
the pin, and the pin cannot be used as an I/O pin. If PC6 is used as a reset pin,
DDC6, PORTC6 and PINC6 will all read 0.
PCINT14: Pin Change Interrupt source 14. The PC6 pin can serve as an external
interrupt source.
SCL/ADC5/PCINT13 Port C, Bit 5 SCL, 2-wire Serial Interface Clock:
When the TWEN bit in TWCR is set (one) to enable the 2-wire Serial Interface, pin
PC5 is disconnected from the port and becomes the Serial Clock I/O pin for the 2wire Serial Interface.
In this mode, there is a spike filter on the pin to suppress spikes shorter than 50 ns
on the input signal, and the pin is driven by an open drain driver with slew-rate

limitation. PC5 can also be used as ADC input Channel 5. Note that ADC input
channel 5 uses digital power.
PCINT13: Pin Change Interrupt source 13. The PC5 pin can serve as an external
interrupt source.
SDA/ADC4/PCINT12 Port C, Bit 4 SDA, 2-wire Serial Interface Data:
When the TWEN bit in TWCR is set (one) to enable the 2-wire Serial Interface, pin
PC4 is disconnected from the port and becomes the Serial Data I/O pin for the 2wire Serial Interface. In this mode, there is a spike filter on the pin to suppress
spikes shorter than 50 ns on the input signal, and the pin is driven by an open drain
driver with slew-rate limitation. PC4 can also be used as ADC input Channel 4.
Note that ADC input channel 4 uses digital power.
PCINT12: Pin Change Interrupt source 12. The PC4 pin can serve as an external
interrupt source.
ADC3/PCINT11 Port C, Bit 3 PC3 can also be used as ADC input Channel 3.
Note that ADC input channel 3 uses analog power.
PCINT11: Pin Change Interrupt source 11. The PC3 pin can serve as an external
interrupt source.
ADC2/PCINT10 Port C, Bit 2 PC2 can also be used as ADC input Channel 2.
Note that ADC input channel 2 uses analog power. PCINT10: Pin Change Interrupt
source 10. The PC2 pin can serve as an external interrupt source.
ADC1/PCINT9 Port C, Bit 1 PC1 can also be used as ADC input Channel 1.
Note that ADC input channel 1 uses analog power. PCINT9: Pin Change Interrupt
source 9. The PC1 pin can serve as an external interrupt source.

ADC0/PCINT8 Port C, Bit 0 PC0 can also be used as ADC input Channel 0.
Note that ADC input channel 0 uses analog power. PCINT8: Pin Change Interrupt
source 8. The PC0 pin can serve as an external interrupt source
PORT D:
AIN1/OC2B/PCINT23 Port D, Bit 7 AIN1, Analog Comparator Negative Input.
Configure the port pin as input with the internal pull-up switched off to avoid the
digital port function from interfering with the function of the Analog Comparator.
PCINT23: Pin Change Interrupt source 23. The PD7 pin can serve as an external
interrupt source.
AIN0/OC0A/PCINT22 Port D, Bit 6 AIN0, Analog Comparator Positive Input.
Configure the port pin as input with the internal pull-up switched off to avoid the
digital port function from interfering with the function of the Analog Comparator.
OC0A, Output Compare Match output:
The PD6 pin can serve as an external output for the Timer/Counter0 Compare
Match A. The PD6 pin has to be configured as an output (DDD6 set (one)) to serve
this function. The OC0A pin is also the output pin for the PWM mode timer
function.
PCINT22: Pin Change Interrupt source 22. The PD6 pin can serve as an external
interrupt source.
T1/OC0B/PCINT21 Port D, Bit 5 T1, Timer/Counter1 counter source. OC0B,
Output Compare Match output: The PD5 pin can serve as an external output for the
Timer/Counter0 Compare Match B.
The PD5 pin has to be configured as an output (DDD5 set (one)) to serve this
function. The OC0B pin is also the output pin for the PWM mode timer function.

PCINT21: Pin Change Interrupt source 21. The PD5 pin can serve as an external
interrupt source.
XCK/T0/PCINT20 Port D, Bit 4 XCK, USART external clock. T0,
Timer/Counter0 counter source.
PCINT20: Pin Change Interrupt source 20. The PD4 pin can serve as an external
interrupt source.
INT1/OC2B/PCINT19 Port D, Bit 3 INT1, External Interrupt source 1: The
PD3 pin can serve as an external interrupt source. OC2B, Output Compare Match
output:
The PD3 pin can serve as an external output for the Timer/Counter0 Compare
Match B. The PD3 pin has to be configured as an output (DDD3 set (one)) to serve
this function. The OC2B pin is also the output pin for the PWM mode timer
function.
PCINT19: Pin Change Interrupt source 19. The PD3 pin can serve as an external
interrupt source.
INT0/PCINT18 Port D, Bit 2 INT0, External Interrupt source 0: The PD2 pin
can serve as an external interrupt source.
PCINT18: Pin Change Interrupt source 18. The PD2 pin can serve as an external
interrupt source.
TXD/PCINT17 Port D, Bit 1 TXD, Transmit Data (Data output pin for the
USART). When the USART Transmitter is enabled, this pin is configured as an
output regardless of the value of DDD1.
PCINT17: Pin Change Interrupt source 17. The PD1 pin can serve as an external
interrupt source.

RXD/PCINT16 Port D, Bit 0 RXD, Receive Data (Data input pin for the
USART). When the USART Receiver is enabled this pin is configured as an input
regardless of the value of DDD0. When the USART forces this pin to be an input,
the pull-up can still be controlled by the PORTD0 bit.
PCINT16: Pin Change Interrupt source 16. The PD0 pin can serve as an external
interrupt source.
Overview:
The ATmega48A/PA/88A/PA/168A/PA/328/P is a low-power CMOS 8-bit
microcontroller based on the AVR enhanced RISC architecture. By executing
powerful instructions in a single clock cycle.
The ATmega48A/PA/88A/PA/168A/PA/328/P achieves throughputs approaching 1
MIPS per MHz allowing the system designed to optimize power consumption
versus processing speed.
The ATmega48A/PA/88A/PA/168A/PA/328/P provides the following features:
4K/8Kbytes

of

In-System

Programmable

Flash

with

Read-While-Write

capabilities, 256/512/512/1Kbytes EEPROM, 512/1K/1K/2Kbytes SRAM, 23


general purpose I/O lines, 32 general purpose working registers, three flexible
Timer/Counters with compare modes, internal and external interrupts, a serial
programmable USART, a byte-oriented 2-wire Serial Interface, an SPI serial port, a
6-channel 10-bit ADC (8 channels in TQFP and QFN/MLF packages), a
programmable Watchdog Timer with internal Oscillator, and five software
selectable power saving modes. The Idle mode stops the CPU while allowing the
SRAM, Timer/Counters, USART, 2-wire Serial Interface, SPI port, and interrupt
system to continue functioning. The Power-down mode saves the register contents
but freezes the Oscillator, disabling all other chip functions until the next interrupt

or hardware reset. In Power-save mode, the asynchronous timer continues to run,


allowing the user to maintain a timer base while the rest of the device is sleeping.
The ADC Noise Reduction mode stops the CPU and all I/O modules except
asynchronous timer and ADC, to minimize switching noise during ADC
conversions. In Standby mode, the crystal/resonator Oscillator is running while the
rest of the device is sleeping. This allows very fast start-up combined with low
power consumption. Atmel offers the QTouch library for embedding capacitive
touch buttons, sliders and wheels functionality into AVR microcontrollers.
The patented charge-transfer signal acquisition offers robust sensing and includes
fully debounced reporting of touch keys and includes Adjacent Key Suppression
(AKS) technology for unambiguous detection of key events. The easy-to-use
QTouch Suite tool chain allows you to explore, develop and debug your own touch
applications. The device is manufactured using Atmels high density non-volatile
memory technology. The On-chip ISP Flash allows the program memory to be
reprogrammed In-System through an SPI serial interface, by a conventional nonvolatile memory programmer, or by an On-chip Boot program running on the AVR
core. The Boot program can use any interface to download the application program
in the Application Flash memory. Software in the Boot Flash section will continue
to run while the Application Flash section is updated, providing true Read WhileWrite operation.
By combining an 8-bit RISC CPU with In-System Self-Programmable Flash on a
monolithic chip, the Atmel ATmega48A/PA/88A/PA/168A/PA/328/P is a powerful
microcontroller that provides a highly flexible and cost effective solution to many
embedded control applications.

The ATmega48A/PA/88A/PA/168A/PA/328/P AVR is supported with a full suite of


program and system development tools including: C Compilers, Macro Assembles,
and Program Debugger/Simulators.
Comparison between Processors:
The ATmega48A/PA/88A/PA/168A/PA/328/P differ only in memory sizes, boot
loader support, and interrupt vector sizes.
Device Flash EEPROM RAM memory sizes ATmega48A -4KBytes 256Bytes
512Bytes
ATmega48PA- 4KBytes 256Bytes 512Bytes
ATmega88A 8KBytes 512Bytes 1KBytes
ATmega88PA 8KBytes 512Bytes 1KBytes
ATmega168A 16KBytes 512Bytes 1Kbytes
ATmega168PA 16KBytes 512Bytes 1Kbytes
ATmega328 32KBytes 1KBytes 2Kbytes
ATmega328P 32KBytes 1KBytes 2KBytes
ATmega48A/PA/88A/PA/168A/PA/328/P support a real Read-While-Write SelfProgramming mechanism. There is a separate Boot Loader Section, and the SPM
instruction can only execute from there. In AT mega 48A/48PA there is no ReadWhile-Write support and no separate Boot Loader Section. The SPM instruction can
execute from the entire Flash.

AVR CPU Core:


Overview:
The AVR core architecture in general. The main function of the CPU core is to
ensure correct program execution. The CPU must therefore be able to access
memories, perform calculations, control peripherals, and handle interrupts.
In order to maximize performance and parallelism, the AVR uses a Harvard
architecture with separate memories and buses for program and data. Instructions
in the program memory are executed with a single level pipelining. While one
instruction is being executed, the next instruction is pre-fetched from the program
memory.
This concept enables instructions to be executed in every clock cycle. The program
memory is In-System Reprogrammable Flash memory.
The fast-access Register File contains 32 x 8-bit general purpose working registers
with a single clock cycle access time. This allows single-cycle Arithmetic Logic
Unit (ALU) operation. In a typical ALU operation, two operands are output from
the Register File, the operation is executed, and the result is stored back in the
Register File in one clock cycle. Six of the 32 registers can be used as three 16-bit
indirect address register pointers for Data Space addressing enabling efficient
address calculations.
One of the address pointers can also be used as an address pointer for look up
tables in Flash program memory. These added function registers are the 16-bit X-,
Y-, and Z register, described later in this section. The ALU supports arithmetic and
logic operations between registers or between a constant and a register. Single
register operations can also be executed in the ALU. After an arithmetic operation,
the Status Register is updated to reflect information about the result of the

operation. Program flow is provided by conditional and unconditional jump and


call instructions, able to directly address the whole address space. Most AVR
instructions have a single 16-bit word format. Every program memory address
contains a 16- or 32-bit instruction. Program Flash memory space is divided in two
sections, the Boot Program section and the Application Program section. Both
sections have dedicated Lock bits for write and read/write protection. The SPM
instruction that writes into the Application Flash memory section must reside in the
Boot Program section. During interrupts and subroutine calls, the return address
Program Counter (PC) is stored on the Stack. The Stack is effectively allocated in
the general data SRAM, and consequently the Stack size is only limited by the total
SRAM size and the usage of the SRAM. All user programs must initialize the SP in
the Reset routine (before subroutines or interrupts are executed). The Stack Pointer
(SP) is read/write accessible in the I/O space. The data SRAM can easily be
accessed through the five different addressing modes supported in the AVR
architecture. The memory spaces in the AVR architecture are all linear and regular
memory maps. A flexible interrupt module has its control registers in the I/O space
with an additional Global Interrupt Enable bit in the Status Register. All interrupts
have a separate Interrupt Vector in the Interrupt Vector table. The interrupts have
priority in accordance with their Interrupt Vector position. The lower the Interrupt
Vector address, the higher the priority. The I/O memory space contains 64
addresses for CPU peripheral functions as Control Registers, SPI, and other I/O
functions.
ALU Arithmetic Logic Unit:
The high-performance AVR ALU operates in direct connection with all the 32
general purpose working registers. Within a single clock cycle, arithmetic
operations between general purpose registers or between a register and an

immediate are executed. The ALU operations are divided into three main categories
arithmetic, logical, and bit-functions. Some implementations of the architecture
also provide a powerful multiplier supporting both signed/unsigned multiplication
and fractional format. See the Instruction Set section for a detailed description.
Status Register:
The Status Register contains information about the result of the most recently
executed arithmetic instruction. This information can be used for altering program
flow in order to perform conditional operations. Note that the Status Register is
updated after all ALU operations, as specified in the Instruction Set Reference.
This will in many cases remove the need for using the dedicated compare
instructions, resulting in faster and more compact code. The Status Register is not
automatically stored when entering an interrupt routine and restored when returning
from an interrupt. This must be handled by software.
SREG
AVR Status Register
The AVR Status Register SREG is defined as:
Bit 7 I: Global Interrupt Enable the Global Interrupt Enable bit must be set for
the interrupts to be enabled. The individual interrupt enable control is then
performed in separate control registers. If the Global Interrupt Enable Register is
cleared, none of the interrupts are enabled independent of the individual interrupt
enable settings. The I-bit is cleared by hardware after an interrupt has occurred, and
is set by the RETI instruction to enable subsequent interrupts. The I-bit can also be
set and cleared by the application with the SEI and CLI instructions, as described in
the instruction set reference.

Bit 6 T: Bit Copy Storage the Bit Copy instructions BLD (Bit Load) and BST
(Bit Store) use the T-bit as source or destination for the operated bit. A bit from a
register in the Register File can be copied into T by the BST instruction, and a bit in
T can be copied into a bit in a register in the Register File by the BLD instruction.
Bit 5 H: Half Carry Flag the Half Carry Flag H indicates a Half Carry in some
arithmetic operations. Half Carry is useful in BCD arithmetic. See the Instruction
Set Description for detailed information.
Bit 4 S: Sign Bit, S = N V The S-bit is always an exclusive or between the
Negative Flag N and the Twos Complement Overflow Flag V. See the Instruction
Set Description for detailed information.
Bit 3 V: Twos Complement Overflow Flag the Twos Complement Overflow
Flag V supports twos complement arithmetic. See the Instruction Set
Description for detailed information.
Bit 2 N: Negative Flag the Negative Flag N indicates a negative result in an
arithmetic or logic operation. See the Instruction Set Description for detailed
information.
Bit 1 Z: Zero Flag the Zero Flag Z indicates a zero result in an arithmetic or
logic operation. See the Instruction Set Description for detailed information.
Bit 0 C: Carry Flag the Carry Flag C indicates a carry in an arithmetic or logic
operation.

General Purpose Register File:

The Register File is optimized for the AVR Enhanced RISC instruction set. In order
to achieve the required performance and flexibility, the following input/output
schemes are supported by the Register File:
One 8-bit output operand and one 8-bit result input.
Two 8-bit output operands and one 8-bit result input.
Two 8-bit output operands and one 16-bit result input.
One 16-bit output operand and one 16-bit result input.
AVR Memories:
Overview:
This

section

describes

the

different

memories

in

the

ATmega48A/PA/88A/PA/168A/PA/328/P. The AVR architecture has two main


memory spaces, the Data Memory and the Program Memory space. In addition, the
ATmega48A/PA/88A/PA/168A/PA/328/P features an EEPROM Memory for data
storage. All three memory spaces are linear and regular.
In-System Reprogrammable Flash Program Memory .
The ATmega48A/PA/88A/PA/168A/PA/328/P contains 4/8/16/32Kbytes On-chip
In-System Reprogrammable Flash memory for program storage. Since all AVR
instructions are 16 or 32 bits wide, the Flash is organized as 2/4/8/16K x 16. For
software security, the Flash Program memory space is divided into two sections,
Boot Loader Section and Application Program Section in ATmega88PA and
ATmega168PA.

SRAM Data Memory:

The ATmega48A/PA/88A/PA/168A/PA/328/P is a complex microcontroller with


more peripheral units than can be supported within the 64 locations reserved in the
Opcode for the IN and OUT instructions. For the Extended I/O space from 0x60 0xFF in SRAM, only the ST/STS/STD and LD/LDS/LDD instructions can be used.
The lower 768/1280/1280/2303 data memory locations address both the Register
File, the I/O memory, Extended I/O memory, and the internal data SRAM. The first
32 locations address the Register File, the next 64 location the standard I/O
memory, then 160 locations of Extended I/O memory, and the next
512/1024/1024/2048 locations address the internal data SRAM.
The five different addressing modes for the data memory cover: Direct, Indirect
with Displacement, Indirect, Indirect with Pre-decrement, and Indirect with Postincrement. In the Register File, registers R26 to R31 feature the indirect addressing
pointer registers.
The direct addressing reaches the entire data space. The Indirect with Displacement
mode reaches 63 address locations from the base address given by the Y- or Z
register. When using register indirect addressing modes with automatic predecrement and post-increment, the address registers X, Y, and Z are decremented or
incremented.
The 32 general purpose working registers, 64 I/O Registers, 160 Extended I/O
Registers, and the 512/1024/1024/2048 bytes of internal data SRAM in the
ATmega48A/PA/88A/PA/168A/PA/328/P are all accessible through all these
addressing modes.

EEPROM Data Memory:

The ATmega48A/PA/88A/PA/168A/PA/328/P contains 256/512/512/1Kbytes of


data EEPROM memory. It is organized as a separate data space, in which single
bytes can be read and written. The EEPROM has an endurance of at least 100,000
write/erase cycles. The access between the EEPROM and the CPU is described in
the following, specifying the EEPROM Address Registers, the EEPROM Data
Register, and the EEPROM Control Register.
EEPROM Read/Write Access
The EEPROM Access Registers are accessible in the I/O space
A self-timing function, however, lets the user software detect when the next byte
can be written. If the user code contains instructions that write the EEPROM, some
precautions must be taken. In heavily filtered power supplies, VCC is likely to rise
or fall slowly on power up/down. This causes the device for some period of time to
run at a voltage lower than specified as minimum for the clock frequency used.
When the EEPROM is read, the CPU is halted for four clock cycles before the next
instruction is executed. When the EEPROM is written, the CPU is halted for two
clock cycles before the next instruction is executed.
Preventing EEPROM Corruption:
During periods of low VCC, the EEPROM data can be corrupted because the
supply voltage is too low for the CPU and the EEPROM to operate properly. These
issues are the same as for board level systems using EEPROM, and the same
design solutions should be applied. An EEPROM data corruption can be caused by
two situations when the voltage is too low. First, a regular write sequence to the
EEPROM requires a minimum voltage to operate correctly. Secondly, the CPU
itself can execute instructions incorrectly, if the supply voltage is too low.

EEPROM data corruption can easily be avoided by following this design


recommendation: Keep the AVR RESET active (low) during periods of insufficient
power supply voltage. This can be done by enabling the internal Brown-out
Detector (BOD). If the detection level of the internal BOD does not match the
needed detection level, an external low VCC reset Protection circuit can be used.
If a reset occurs while a write operation is in progress, the write operation will be
completed provided that the power supply voltage is sufficient.
I/O Memory:
All ATmega48A/PA/88A/PA/168A/PA/328/P I/Os and peripherals are placed in the
I/O space. All I/O locations may be accessed by the LD/LDS/LDD and
ST/STS/STD instructions, transferring data between the 32 general purpose
working registers and the I/O space.
I/O Registers within the address range 0x00 - 0x1F are directly bit accessible using
the SBI and CBI instructions. In these registers, the value of single bits can be
checked by using the SBIS and SBIC instructions. Refer to the instruction set
section for more details. When using the I/O specific commands IN and OUT, the
I/O addresses 0x00 - 0x3F must be used.
When addressing I/O Registers as data space using LD and ST instructions, 0x20
must be added to these addresses. The ATmega48A/PA/88A/PA/168A/PA/328/P is
a complex microcontroller with more peripheral units than can be supported within
the 64 location reserved in Opcode for the IN and OUT instructions. For the
Extended I/O space from 0x60 - 0xFF in SRAM, only the ST/STS/STD and
LD/LDS/LDD instructions can be used.
For compatibility with future devices, reserved bits should be written to zero if
accessed. Reserved I/O memory addresses should never be written. Some of the

Status Flags are cleared by writing a logical one to them. Note that, unlike most
other AVRs, the CBI and SBI instructions will only operate on the specified bit, and
can therefore be used on registers containing such Status Flags.
General Purpose I/O Registers:
The ATmega48A/PA/88A/PA/168A/PA/328/P contains three General Purpose I/O
Registers. These registers can be used for storing any information, and they are
particularly useful for storing global variables and Status Flags. General Purpose
I/O Registers within the address range 0x00 - 0x1F are directly bit-accessible using
the SBI, CBI, SBIS, and SBIC instructions.

This Program is written in Arduino to calculate Temperature, Humidity and Light


values.
Code:
#include <LiquidCrystal.h> //header file to display LCD values
#include <Wstring.h> //used to create an empty string value
#include <string.h>
const int INPUT1 =10; //used in Arduino for recording the input
const int INPUT2 =11;
const int groundpin1 = 18; //initiating the values of ground pin and power pin
const int powerpin2 = 19; //values are stored in Arduino digital pins
const int groundpin = 12; //lcd is driven by these values
const int powerpin = 13;

const int groundpin2 = 11;


const int powerpin3= 10;

LiquidCrystal lcd(8, 9, 5, 4, 3, 2); //temporary values are given to remove the


default values
const int inPin = 0; //temperature pin
int ldr =1; //analog pin to which LDR is connected
int ldr_value = 1;
int putPin = 2; //humidity pin
float t; //to calculate the decimal values float is used
float humi = 0; //assigning some values to get truehum value
float prehum = 0;
float humconst = 0;
float truehum = 0; //actual humidity value to be calculated
float pretruehum = 0;
long pretruehumconst = 0;
long valb = 0;

void setup()
{
Serial.begin(9600); //baud rate - specifies how far the data is sent over a serial line

lcd.begin(16, 2);
pinMode(groundpin, OUTPUT); //defining the output for ground pin
pinMode(powerpin, OUTPUT); //defining the output for power pin
pinMode(groundpin1, OUTPUT);
pinMode(powerpin2, OUTPUT);
pinMode(groundpin2, OUTPUT);
pinMode(powerpin3, OUTPUT);
pinMode(INPUT1, OUTPUT);

//defining the output values for the input1

pinMode(INPUT2, OUTPUT); //defining the output values for the input2

digitalWrite(groundpin, LOW); //specifies the output for powerpin and ground pin
digitalWrite(powerpin, HIGH); //powerpin is always high
digitalWrite(groundpin2, LOW); //groundpin is always low
digitalWrite(powerpin3, HIGH);
digitalWrite(groundpin1, LOW);
digitalWrite(powerpin2, HIGH);

lcd.clear(); //refreshes the LCD


lcd.setCursor(0,0); //sets the cursor to 0
lcd.print("ENVIRONMENT MONITORING"); //prints ENVIRONMENT
MONITORING

lcd.setCursor(0,1); //sets the cursor to the next line


lcd.print(" SYSTEM "); //prints SYSTEM in the next line
delay(2000); //delays 2ms
}

void loop()
{
int val;
int value = analogRead(inPin); //reads the analog values
lcd.setCursor(0, 1);
float millivolts = (value / 1024.0) * 5000; //converting raw values of humidty to
millivolts

float celsius = millivolts /10; //calculating temperature


t=celsius; //temperature is calculated in Celsius
valb = analogRead(putPin); // humidity calculation
prehum = (valb/5);
humconst = (0.16/0.0062);
humi = prehum - humconst;
pretruehum = 1.0546-pretruehumconst;
truehum = humi/pretruehum ; //final humidity value

delay(1000); //delays 1ms


lcd.clear(); //refreshes the lcd
lcd.setCursor(0,0);
lcd.print("Temperature is"); //prints Temperature is
lcd.setCursor(0,1);
lcd.print(celsius); //prints temperature value in Celsius

delay(2000); //delays 2ms


lcd.clear(); //clears the lcd
lcd.print ("Humidity: "); //prints Humidity:
lcd.print (humi);
delay(2000); //delays 2ms
lcd.clear(); //clears the LCD
lcd.print ("LIGHT:"); //prints LIGHT:
ldr_value = analogRead(ldr); //reads the LDR values
lcd.print (ldr_value);
ldr_value=ldr_value/10; //calculating the light values
delay(2000); //delays 2ms
Serial.println("weather monitoring usg ZigBee"); //prints weather monitoring using
ZigBee

Serial.print("TEMP:"); //prints TEMP:


Serial.println(celsius); //calculating Temperature
delay(100); //delays 1s
Serial.print("HUMIDITY:"); //prints HUMIDITY:
delay(100); //prints 1s
Serial.print("LIGHT:"); //prints LIGHT:
Serial.println(ldr_value); //prints the LDR values to serial monitor
delay(200); //delays 2s
}

Description:
In this project we are using 3 sensors,
1. Temperature Sensor
2. LDR sensor
3. Humidity Sensor
First, we are converting Analog readings to digital readings, to monitor the values
in PC. These values will be read through A0-A4. Transmitter TX and Receiver RX
are used to transmit and receive the data. The converted data is sent through
ZigBee through air as a medium. ZigBee has only 2 pins, transmitter and receiver.
The second ZigBee which is in the receiver part is connected to the PC.

We have three standard library files in the program. liquid crystal, a header file
which includes crystal display for controlling LCD values. LCD has parallel
interface. In order to communicate with LCD, we use this header file.
w.string is used to display combination values. Variable names can be added and
can be displayed it together.
Constant integer, we are equating some values, these pins are used in Arduino for
recording input. These values are stored in Arduino digital pins. We drive LCD
through these values.
There are 4 output pins, which are encoded and converted into one single value and
sends it to transmitter.
The loop is used to repeat the code for every 2sec. Analog read is used to assign
values to the analog input. We are converting pins to Arduino in analog form.
Temperature sensor is an analog value is feed to Arduino. Float has raw values
initially, by using some calculation we are converting it into digital values to be
displayed on LCD. Temperature is converted into Celsius.
In a delay of 1sec, temperature, humidity and light values will be used. Values from
sensors are stored in temperature, humidity and light and it will be displayed in
LCD.
The code is then dumped into the micro controller to read the environment sensor
values displayed on LCD.
#include<liquid crystal.h>
LiquidCrystal - "Hello World!"
The LiquidCrystal library allows you to control LCD displays that are compatible
with the Hitachi HD44780 driver. There are many of them out there, and you can

usually tell them by the 16-pin interface.


This example sketch prints "Hello World!" to the LCD and shows the time in
seconds since the Arduino was reset
The LCDs have a parallel interface, meaning that the microcontroller has to
manipulate several interface pins at once to control the display. The interface
consists of the following pins:
A register select (RS) pin that controls where in the LCD's memory you're writing
data to. You can select either the data register, which holds what goes on the screen,
or an instruction register, which is where the LCD's controller looks for instructions
on what to do next.
A Read/Write (R/W) pin that selects reading mode or writing mode.
An Enable pin that enables writing to the registers.
8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're
writing to a register when you write, or the values you're reading when you read.
There's also a display contrast pin (Vo), power supply pins (+5V and Gnd) and
LED Backlight (Bklt+ and BKlt-) pins that you can use to power the LCD, control
the display contrast, and turn on and off the LED backlight, respectively.
The process of controlling the display involves putting the data that form the image
of what you want to display into the data registers, then putting instructions in the
instruction register. The LiquidCrystal Library simplifies this for you so you don't
need to know the low-level instructions.
The Hitachi-compatible LCDs can be controlled in two modes: 4-bit or 8-bit. The
4-bit mode requires seven I/O pins from the Arduino, while the 8-bit mode requires
11 pins. For displaying text on the screen, you can do most everything in 4-bit

mode, so example shows how to control a 2x16 LCD in 4-bit mode.


This above file will includes the liqiud crystal display.(i.e)lcd header & booting
files to the program.
.. this header file will allow you to control the lcd (i.e )liquid crystal display
...this lcd has parallel interface.it should manioplate severalinterface pins at once to
control lcd .the interface consist of following pins.
1) resigster select : this rs will hold the data that the information wants to flow from
lcd.
2)read/write: for reading and writing information.
3)enable pin: that enables writing to the registers
4)8-data pins (d0.d1) the staes of these pins (high & low)are the bits we write or
read the values
5)display constant pin(v0) : constant displaying
6)power supply pins )(+5v &gnd)
7)led backlight : this pins are used to control brightness of backlight, lcd contras,
on &off of lcd
Hardware Required:
Arduino Board
LCD Screen (compatible with Hitachi HD44780 driver)
pin headers to solder to the LCD display pins
10k Potentiometer

breadboard
hook-up wire
Circuit
Before wiring the LCD screen to your Arduino we suggest to solder a pin header
strip to the 14 (or 16) pin count connector of the LCD screen, as you can see in the
image above.
To wire your LCD screen to your Arduino, connect the following pins:
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
Additionally, wire a 10K pot to +5V and GND, with it's wiper (output) to LCD
screens VO pin (pin3).
Nearly all character type displays have a 14 pin interface. Often 2 extra pins are
added for power to the backlight. Pins 1 and 2 must be connected to power. A 10K
potentiometer is used for contrast adjustment, with the center pin connected to pin
3. The two outer pins of the potentiometer connect to +5 volts and ground.
Slow Connection:
Only 6 signal are required, RS, Enable, D4, D5, D6 and D7. The R/W pin must be
connected to ground. Pins D0, D1, D2 and D3 are left unconnected.

Fast Connection:
LiquidCrystalFast can use the R/W pin for faster access. Either way can update the
display faster than a human eye can detect, but if your project needs to do other
work, less time updating the display may be worth using a seventh pin.
Large 4x40 Connection
LiquidCrystalFast can also access large 4x40 displays, which have two enable pins.
Display using slow 6 signal connection
Basic Usage
LiquidCrystal lcd(RS, Enable, D4, D5, D6, D7)
Create the LiquidCrystal object and specify the 6 pins where the LCD is connected.
You can connect more than one display (each to its own pins) and create a separate
LiquidCrystal objects for each.
lcd.begin(width, height);
Initialize the display and set the size.
lcd.print(anything);
Print a number or text. This works the same as Serial.print(), but prints to the LCD.
lcd.setCursor(x, y);
Move the cursor to position (x, y). These are zero-based coordinates.
LiquidCrystalFast lcd(RS, RW, Enable, D4, D5, D6, D7)
Create the LiquidCrystalFast object, using 7 pins.
LiquidCrystalFast lcd(RS, RW, Enable1, Enable2, D4, D5, D6, D7)

Create the LiquidCrystalFast object for large 40x4 display, using 8 pins.
#include<wstring.h>
this header is used when we need to display combinations of values into one string
to display(via)serial communication on an lcd , ver an ethernet connection or any
where the strings are useful.
Example:
*adding a constant integer to string ;
stringthree = stringone+123;
*adding a long interger to string ;
stringthree = stringone +123456789;
*like this we can add constant characters like a,b,c an dlong characters as 'abc';
*and also we can add two strings
stringthree = stringtwo+stringone;
#include<string.h>
String Handling: <string.h>
The String class, part of the core as of version 0019, allows you to use and
manipulate strings of text in more complex ways than character arrays do. You can
concatenate Strings, append to them, search for and replace substrings, and more. It
takes more memory than a simple character array, but it is also more useful.
For reference, character arrays are referred to as strings with a small s, and
instances of the String class are referred to as Strings with a capital S. Note that
constant strings, specified in "double quotes" are treated as char arrays, not

instances of the String class.


Strings are defined as an array of characters or a pointer to a portion of memory
containing ASCII characters. A string in C is a sequence of zero or more characters
followed by a NULL \0">)character:
It is important to preserve the NULL terminating character as it is how C defines
and manages variable length strings. All the C standard library functions require
this for successful operation.
Strings as Character Arrays:
Before C++ and classes, strings were stored in simple arrays of characters. Thus,
char name[12] = "Bob Dylan";
would be a simple way to create a string with an initial value. In memory, this array
looks like:
-------------------------------------------------| B | o | b | | D | y | l | a | n | \0 | | |
-------------------------------------------------The only thing special about this array is that an extra character, the nul character
tells us where the string's value ends.
Note: In this case, the array is actually bigger than the string held in it.
Accessing/Changing Strings
Because a string is really just an array, we must access or change it by dealing with
each element (like other arrays).
This means it becomes tedious to perform common string operations, i.e.,

To change the value of a string,


we must change several characters individually.
To find the length of the string,
we must search for the nul character.

Program installed in microcontroller


#include <AP_Common.h>

#include <AP_Math.h>

#include <AP_Param.h>

#include <AP_Progmem.h>

#include <AP_ADC.h>

#include <AP_InertialSensor.h>

#include <AP_HAL.h>

#include <AP_HAL_AVR.h>

#include <global_position.h>

#include <altitude_stabi.h >

int gps;

int altitude;

int rth;

const AP_HAL::HAL& hal = AP_HAL_AVR_APM2;

// Hardware abstraction layer

void setup()
{

void loop()
{
uint16_t channels[8];

// array for raw channel values

// Read RC channels and store in channels array


hal.rcin->read(channels, 8);

// Copy from channels array to something human readable - array


entry 0 = input 1, etc.
uint16_t rcthr, rcyaw, rcpit, rcroll;

// Variables to store rc input

rcthr = channels[2];

rcyaw = channels[3];

rcpit = channels[1];

rcroll = channels[0];

hal.console->printf_P(
PSTR("individual read THR %d YAW %d PIT %d ROLL %d\r\n"),
rcthr, rcyaw, rcpit, rcroll);

hal.scheduler->delay(50);

//Wait 50ms

AP_HAL_MAIN();

// special macro that replace's one of Arduino's to

setup the code (e.g. ensure loop() is called in a loop).

long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
result = map(VALUE, FROM_MIN, FROM_MAX, TO_MIN, TO_MAX);
long rcthr, rcyaw, rcpit, rcroll;

// Variables to store rc input

rcthr = channels[2];

rcyaw = map(channels[3], 1068, 1915, -150, 150);

rcpit = map(channels[1], 1077, 1915, -45, 45);

rcroll = map(channels[0], 1090, 1913, -45, 45);

hal.rcout->set_freq(0xF, 490);

hal.rcout->enable_mask(0xFF);

#define MOTOR_FL 2

// Front left

#define MOTOR_FR 0

// Front right

#define MOTOR_BL 1

// back left

#define MOTOR_BR 3

// back right

hal.rcout->write(MOTOR_FR, rcthr);

// Disable barometer to stop it corrupting bus//


hal.gpio->pinMode(40, GPIO_OUTPUT);
hal.gpio->write(40, 1);

// Initialise MPU6050 sensor//


ins.init(AP_InertialSensor::COLD_START,
AP_InertialSensor::RATE_100HZ,
NULL);

// Initialise MPU6050's internal sensor fusion (aka


DigitalMotionProcessing)//
hal.scheduler->suspend_timer_procs();

ins.dmp_init();

ins.push_gyro_offsets_to_dmp();

// stop bus collisions//

hal.scheduler->resume_timer_procs();

ins.update();

ins.gps.rth(gps_raw_data);
digital read(gps_raw_data);

/// to lock home position//...


/// this will note the exact position from where the quad is started

i.e like altitude longitude co-ordinates//...


digital store(gps_raw_data);
rth=("gps_raw_data");

while (ins.num_samples_available() == 0);

ins.update();

ins.quaternion.to_euler(&roll, &pitch, &yaw);

roll = ToDeg(roll) ;

pitch = ToDeg(pitch) ;

yaw = ToDeg(yaw);

hal.console->printf_P(
PSTR("P:%4.1f R:%4.1f Y:%4.1f\n"),
pitch,
roll,
yaw);
PID pids[6];

#define PID_PITCH_RATE 0

#define PID_ROLL_RATE 1

#define PID_PITCH_STAB 2

#define PID_ROLL_STAB 3

#define PID_YAW_RATE 4

#define PID_YAW_STAB 5

pids[PID_PITCH_RATE].kP(0.7);

//pids[PID_PITCH_RATE].kI(1);

pids[PID_PITCH_RATE].imax(50);

pids[PID_ROLL_RATE].kP(0.7);

// pids[PID_ROLL_RATE].kI(1);

pids[PID_ROLL_RATE].imax(50);

pids[PID_YAW_RATE].kP(2.5);

// pids[PID_YAW_RATE].kI(1);

pids[PID_YAW_RATE].imax(50);

pids[PID_PITCH_STAB].kP(4.5);

pids[PID_ROLL_STAB].kP(4.5);

pids[PID_YAW_STAB].kP(10);

Vector3f gyro = ins.get_gyro();

float gyroPitch = ToDeg(gyro.y), gyroRoll = ToDeg(gyro.x), gyroYaw = ToDeg(gyro.z);

if(rcthr > 1170) { // *** MINIMUM THROTTLE TO DO CORRECTIONS MAKE THIS 20pts
ABOVE YOUR MIN THR STICK ***/

long pitch_output = pids[PID_PITCH_RATE].get_pid(gyroPitch - rcpit, 1);

long roll_output = pids[PID_ROLL_RATE].get_pid(gyroRoll - rcroll, 1);

long yaw_output = pids[PID_YAW_RATE].get_pid(gyroYaw - rcyaw, 1);

hal.rcout->write(MOTOR_FL, rcthr - roll_output - pitch_output);


hal.rcout->write(MOTOR_BL, rcthr - roll_output + pitch_output);
hal.rcout->write(MOTOR_FR, rcthr + roll_output - pitch_output);
hal.rcout->write(MOTOR_BR, rcthr + roll_output + pitch_output);

} else { // MOTORS OFF

hal.rcout->write(MOTOR_FL, 1000);
hal.rcout->write(MOTOR_BL, 1000);
hal.rcout->write(MOTOR_FR, 1000);
hal.rcout->write(MOTOR_BR, 1000);

for(int i=0; i<6; i++) // reset PID integrals whilst on the ground
pids[i].reset_I();

hal.rcout->write(MOTOR_FL, rcthr - roll_output - pitch_output - yaw_output);


hal.rcout->write(MOTOR_BL, rcthr - roll_output + pitch_output + yaw_output);
hal.rcout->write(MOTOR_FR, rcthr + roll_output - pitch_output + yaw_output);
hal.rcout->write(MOTOR_BR, rcthr + roll_output + pitch_output - yaw_output);

// our new stab pids

float pitch_stab_output = constrain(pids[PID_PITCH_STAB].get_pid((float)rcpit - pitch, 1),


-250, 250);

float roll_stab_output = constrain(pids[PID_ROLL_STAB].get_pid((float)rcroll - roll, 1), -250,


250);

float yaw_stab_output = constrain(pids[PID_YAW_STAB].get_pid((float)rcyaw - yaw, 1), -360,


360);

// rate pids from earlier

long pitch_output =

(long) constrain(pids[PID_PITCH_RATE].get_pid(pitch_stab_output -

gyroPitch, 1), - 500, 500);


long roll_output =

(long) constrain(pids[PID_ROLL_RATE].get_pid(roll_stab_output -

gyroRoll, 1), -500, 500);


long yaw_output =

(long) constrain(pids[PID_YAW_RATE].get_pid(yaw_stab_output -

gyroYaw, 1), -500, 500);

#define wrap_180(x) (x < -180 ? x+360 : (x > 180 ? x - 360: x))

float yaw_target = 0;
float yaw_stab_output = constrain(pids[PID_YAW_STAB].get_pid(wrap_180(yaw_target - yaw),
1), -360, 360);

if(abs(rcyaw) > 5) { // if pilot commanding yaw


yaw_stab_output = rcyaw; // feed to rate controller (overwriting stab controller output)
yaw_target = yaw;

// update yaw target

else{
gps=high;

//when gps is high by 3 stage toggle switch //

long pitch_output = pids[PID_PITCH_RATE].get_pid(gyroPitch - rcpit, 1);


long roll_output = pids[PID_ROLL_RATE].get_pid(gyroRoll - rcroll, 1);
long yaw_output = pids[PID_YAW_RATE].get_pid(gyroYaw - rcyaw, 1);

hal.rcout->write(MOTOR_FL, gps - roll_output - pitch_output);


hal.rcout->write(MOTOR_BL, gps - roll_output + pitch_output);
hal.rcout->write(MOTOR_FR, gps + roll_output - pitch_output);

//define the drone to

stay in certain altitude and also holds the gps position when the
hal.rcout->write(MOTOR_BR,

gps

roll_output

pitch_output);

gps lock is on//


}

else
{
altitude=high; //when altitude is high by 3 stage toggle switch //

long pitch_output = pids[PID_PITCH_RATE].get_pid(gyroPitch - rcpit, 1);


long roll_output = pids[PID_ROLL_RATE].get_pid(gyroRoll - rcroll, 1);
long yaw_output = pids[PID_YAW_RATE].get_pid(gyroYaw - rcyaw, 1);

hal.rcout->write(MOTOR_FL, altitude - roll_output - pitch_output);


hal.rcout->write(MOTOR_BL, altitude- roll_output + pitch_output);
hal.rcout->write(MOTOR_FR, altitude + roll_output - pitch_output);
drone to stay in certain altitude when the altitude lock is on //
hal.rcout->write(MOTOR_BR, altitude+ roll_output + pitch_output);

// define the

else
{
rth=high;

long pitch_output = pids[PID_PITCH_RATE].get_pid(gyroPitch - rcpit, 1);


long roll_output = pids[PID_ROLL_RATE].get_pid(gyroRoll - rcroll, 1);
long yaw_output = pids[PID_YAW_RATE].get_pid(gyroYaw - rcyaw, 1);

hal.rcout->write(MOTOR_FL, altitude - roll_output - pitch_output);


hal.rcout->write(MOTOR_BL, altitude- roll_output + pitch_output);
hal.rcout->write(MOTOR_FR, altitude + roll_output - pitch_output);
hal.rcout->write(MOTOR_BR, altitude+ roll_output + pitch_output);

if(rth) = (gps_raw_data)
hal.rcout->write(MOTOR_FL, 0);
hal.rcout->write(MOTOR_BL, 0);
hal.rcout->write(MOTOR_FR, 0);
hal.rcout->write(MOTOR_BR, 0);
clear (rth);
}

/////////// this will make the eingen to stop///

Description:
Nomenclature
x = state vector (n x 1 vector)
= input vector (m x 1 vector)
f(x) = nonlinear function of the system states (n x 1 vector)
G(x) = nonlinear function of the system states (m x n matrix)
= bank (roll) angle (rad)
= pitch angle (rad)
= azimuth (yaw) angle (rad)
Kp = proportional gain
Kd = derivative gain
Ki = integral gain
Quadcopter setup:
A. AscTec Hummingbird
The quadrocopter is an AscTec Hummingbird. Table 1 lists many of the technical details of the
quadrocopter1 . The frame is made out of balsa wood and carbon fiber2 , making it strong and
lightweight. For sensors, the copter has a pressure sensor, an acceleration sensor, and three
gyroscopes (one for each axis). It also has a three-axis compass and a GPS unit. All the sensors
besides the GPS compose the Inertial Measurement Unit (IMU). The AutoPilot circuit board has
two microcontrollersa low level processor (LLP) and a high level processor (HLP). The LLP

compiles the IMU data, sends commands to the motor controllers, and also has the basic attitude
controller that comes with the quadrocopter. The HLP controls the GPS, but is mostly free as a
space for the user-defined programs.

The quadrocopter is controlled solely by motor speeds. As shown in Fig. 1, the front and rear
propellers spin clockwise and the left and right motors spin counterclockwise. In this way, all
three axes can be controlled through changing the rotation speeds. Roll is controlled by
manipulating the speeds of the right and left motors; pitch is similarly controlled by the front and
rear motors. Yaw is controlled by a combination of all four motors by speeding up the motors
spinning in one direction and slowing the ones spinning the other way. This turns the
quadrocopter by causing a change in angular momentum, but it does not affect the pitch and roll
axes. For safety, the quadrocopter was ordered with propeller protection, which connects to the
arms of the quadrocopter and consists of lightweight corner pieces connected by carbon tubes.

B. Mode Testing
The quadrocopter comes with three different modes of operation: manual, height control, and
GPS. Height control and GPS are intended for outdoor use, so the industrial safety department
cleared the quadrocopter to fly in an outdoor location, on the softball field at MSFC. The grass
there was short and soft, making it a good location. While outdoors, all modes were tested, as
well as maneuvering capability, full speed, and range.
1. Manual Control The majority of time was spent in this mode, in which the pilot controls all
aspects of the quadrocopter through the controller and it flies much like a normal RC aircraft. For
safety reasons, a pilot must learn to fly in manually before using any of the other modes.
2. Height Control AscTec recommends that this mode is only used outside. In this mode, the
throttle commands an ascend/descend rate instead of thrust, and when the stick is centered, the
quadrocopter will stay at a constant height.
3. GPS Mode This mode can only be used outside, as the GPS unit needs a clear view of the sky
to work. Height control is enabled, the system uses the GPS to hold position, and roll/pitch/yaw
maneuvers are speed controlled to 2 m/s. The user can send waypoint commands from the
computer to the quadrocopter. By sending a list of points to visit (waypoints), a path is created for
the quadrocopter to follow.

3. Vehicle Aerodynamics
A detailed development of the aerodynamics of quadrotor helicopters is now presented. First, the
vehicles full nonlinear dynamics are presented. Then, the vehicles input forces and moments are
computed for non-zero freestream velocities based on techniques from helicopter analysis. These
inputs are used in the development of vehicle controllers in Section 5. 3.1. Inertial Dynamics The
derivation of the nonlinear dynamics is performed in North-East-Down (NED) inertial and body
fixed coordinates. Let {eN, eE, eD} denote unit vectors along the respective inertial axes, and
{xB, yB, zB} denote unit vectors along the respective body axes, as shown in Figure 3. Euler
angles to rotate from NED axes to body fixed axes are the 3-2-1 sequence {, , }, referred to
as yaw, pitch, and roll, respectively. The current velocity direction unit vector is ev, in inertial
coordinates. The direction of the projection of ev onto the xB yB plane defines the direction of
elon in the body-fixed longitudinal, lateral, vertical frame, {elon, elat, ever}, as shown in Figure
8. Due to blade flapping, the rotor plane does not necessarily align with the xB, yB plane, so for
the j th rotor let {xRj , yRj , zRj } denote unit vectors aligned with the plane of the rotor and
oriented with respect to the {elon, elat, ever} frame. Let x be defined as the position vector from

the inertial origin to the vehicle c.g., and let B be defined as the angular velocity of the aircraft
in the body frame.

The rotors, numbered 1 4, are mounted outboard on the xB, yB, xB and yB axes,
respectively, with position vectors rj with respect to the c.g. The thrust T j produced by the j th
rotor acts perpendicularly to the rotor plane along the zRj axis, as defined in Figure 4. The
vehicle body drag force is Db v 2 , vehicle mass is m, acceleration due to gravity is g, and the
inertia matrix is IB R 33 . A free body diagram is depicted in Figure 3, with a depiction of the
rotor forces and moments in Figure 4. The total force, F, can be summed as,
F = Dbev + mgeD + X 4 j=1 T jRRj ,IzRj (1)

where RRj ,I is the rotation matrix from the plane of rotor j to inertial coordinates. Similarly, the
total moment, M, is, M = X 4 j=1 Mj + Mb f, j + rj (T jRRj ,BzRj ) (2) where RRj ,B is the
rotation matrix from the plane of rotor j to body coordinates. Note that the drag force was
neglected in computing the moment. This force was found to cause a negligible disturbance on
the total moment over the flight regime of interest, relative to blade flapping torques. The full
nonlinear dynamics can be described as, F = mx (3) M = IB B + B IBB (4) where the
total angular momentum of the rotors is assumed to be near zero, as the momentum from the
counter-rotating pairs cancels when yaw is held steady.
3.2. Aerodynamic Forces and Moments
Although quadrotor helicopter dynamics are often modeled as independent of free-stream
velocity for attitude and altitude control, this assumption is only reasonable at low velocities.
Even at moderate velocities, the impact of the aerodynamic effects resulting from variation in air
speed is significant. Two main effects are presented here that have each been experimentally
observed on the STARMAC platform. The first effect is the variation in total thrust from a rotor
with free-stream velocity and angle of attack, and the second is the effect known as blade
flapping, resulting from the differing flow velocities experienced by advancing and retreating
blades of a rotor in translational flight. Aerodynamic drag, a reaction force proportional to speed

squared, will not be discussed because it is both vehicle design-dependent and already well
known. At moderate speeds, both experimental results and the literature [19] show that the effect
of drag on rotorcraft is less significant than the following more dominant effects. 3.2.1. Total
Thrust Thrust is produced by each rotor through the torque applied the rotor by a motor. The
thrust can be analyzed by equating the power produced by the motors to the ideal power required
to generate thrust by changing the momentum of a column of air. At hover, the ideal power, Ph, is
Ph = T vh (5) where the induced velocity at hover, vh, is the change in air speed induced by the
rotor blades with respect to the free-stream velocity, v.

vi = v 2 h p (v cos ) 2 + (vi v sin ) 2 (6)


T = P vi v sin torque equation
In the extreme regions of angle of attack close to vertical flight, rotorcraft have three operational
modes depending on the vehicles climb velocity vc, two of which are solutions to Eq. (6) (where

cos = 0), and one of which is a 6 recirculation effect that invalidates the assumptions for
conservation of momentum [19]. Note that these three modes encompass vertical ascent or
descent, and are therefore often encountered. The three modes are defined as follows:
1. Normal working state: 0 vc vh
2. Vortex ring state (VRS): 2 vc vh < 0 3.
3) Windmill brake state: vc vh < 2
Sensors
The sensor suite is comprised of two categories of sensorsthose used to estimate the vehicle
state and those used to perceive the surrounding environment. Measurements from the vehicle
state sensors are used for attitude, position, and path tracking control algorithms, as will be
described in Section 5. The sensors for the surrounding environment will be used for automated
search and rescue, obstacle detection, and simultaneous localization and mapping. The vehicle is
equipped with three sensors for vehicle state estimation, all of which are fused using an Extended
Kalman Filter (EKF). Measurements are fused from a Microstrain 3DM-GX1 inertial
measurement unit (IMU), a downward facing Senscomp Mini-AE ultrasonic rangefinder, and
integrated carrier phase (ICP) measurements from a Novatel Superstar II GPS receiver. For the
GPS, a custom code was developed in house, providing 10 Hz position and velocity estimates
with an accuracy of 0.02-0.05 m relative to a stationary base station. The code is executed in the
background in real-time on existing on-board computers. For indoor flights, an overhead USB
camera was used in conjunction with hue blob tracking software to provide position sensing in
place of GPS for the flights presented in this paper. The camera system gives 0.01-0.02 m
accuracy at 15 Hz, and combined with ultrasonic measurements of the range to the floor, provides
a drop-in replacement for GPS input to the EKF. The camera system has been subsequently
replaced with a VICON position-tracking system. To perceive the surrounding environment, the
vehicle frame can be reconfigured to carry additional sensors for specific applications. Numerous
additional sensors have been tested on the STARMAC platform, including the Videre Systems
stereo vision camera [40], various USB cameras, the Hokuyo URG-04LX laser range finder [41],
and the Tracker DTS digital avalanche rescue beacon and receiver [42]. These sensors were

selected to enable potential autonomous multi-agent missions, such as cooperative search and
rescue [1].
5. Control System
A hierarchical approach to vehicle control was adopted for STARMAC II. This section gives the
results of this controls development process in order from the inner attitude and altitude loops to
the position and trajectory tracking loops. A feedforward compensator adjusts for the
aerodynamic effects discussed in Section 3. 5.1. Attitude and Altitude Control At small angles
(roughly 30 ), the equations of motion are approximately decoupled about each attitude axis, so
control input moments about each axis, u, u, and u, can be implemented independently. The
inputs for each axis are added to the total thrust control input uz to generate thrust commands u1
through u4, for motors 1 through 4, u1 = u/L + u/(4t) + uz/4 u2 = u/L u/(4t) + uz/4 u3
= u/L + u/(4t) + uz/4 u4 = u/L u/(4t) + uz/4 (18) where L is the distance between rotor
centers and the zB axis. The time delay in thrust is well approximated as a first order delay with
time constant , as experimentally verified [34], and found to be 0.1 s for STARMAC II. The
resulting transfer function for the roll axis is (s) U(s) = 1/I s 2 (s + 1) (19) where I is the
component of IB for the roll axis. The transfer functions for the pitch and yaw axes are
analogous. Note that the induced power and blade flapping effects are not included in the linear
model; they are compensated using feed forward compensation described in Section 5.2. Any
inaccuracies in this model or complications such as vortex ring state are treated as disturbance
forces and moments that must be rejected by the control system. Although a standard
proportional-integral-derivative (PID) controller has been shown to perform adequately [37],
control design using root locus techniques revealed that an additional zero, giving angular
acceleration feedback, allowed the gains to be significantly increased, yielding higher bandwidth.
Further, acceleration compensation gives direct feedback on the actual thrust achieved, regardless
of vortex ring state or ascent/descent dynamics of Section 3- 3.2. The resulting control law, C(s)
= kdd s 2 + kd s + kp + ki s (20) was tuned to provide substantially faster and more accurate
performance than previously possible for maneuvering vehicles (see Figures 12 and 13). The
time-domain control input for the roll axis is then u = kdd( re f ) + kd( re f ) +
kp(re f ) + ki Z t 0 (re f )dt (21) with the time-domain angular control inputs u and u
generated similarly. Anti-windup is used for the integral term. Angular accelerations must be

computed by finite differencing the rate gyroscope data, a step that can amplify noise. However,
in implementation, the values computed from differencing of angular velocity measurements at
76 Hz had sufficiently low noise for use in the controller. In practice, the controller is able to
track rapidly varying reference commands, as shown in Figure 13, with root mean square (RMS)
error of 0.65 in each axis. Aggressive flights have been flown frequently, with typically up to
15 of bank angle. The controller has been flown up to its programmed limit of 30 without
significant degradation in performance. A similar approach using linear acceleration was taken
for altitude control and found to greatly improve performance. Feedback linearization is used to
compensate for the offset of gravity and the deflection of thrust due to tilt, uz = 1 cos cos
(kdd,alt(zre f z) + kd,alt(zre f z) + kp,alt(zre f z)) + Tnom (22) where z is the altitude
and zre f is the reference command. The linearized plant model is identical in form to Eq. (19).

S-ar putea să vă placă și