Wednesday 27 May 2015

How to Make a Drone / UAV – Lesson 4: Flight Controller

How to Make a Drone / UAV – Lesson 1: Terminology
How to Make a Drone / UAV – Lesson 2: The Frame
How to Make a Drone / UAV – Lesson 3: Propulsion
How to Make a Drone / UAV – Lesson 4: Flight Controller
How to Make a Drone / UAV – Lesson 5: Assembly
How to Make a Drone / UAV – Lesson 6: Get it all working together
How to Make a Drone / UAV – Lesson 7: FPV & Long-range

Now that you have chosen or designed a UAV frame, chosen the appropriate motors, propellers, ESCs and battery, you can start looking into choosing a flight controller. A flight controller for a multi-rotor UAV is an integrated circuit normally made up of a microprocessor, sensors and input / output pins. Out of the box, a flight controller does not magically know your specific UAV type or configuration, so you need to set certain parameters in a software program, and once complete, that configuration is then uploaded to board. Rather than simply comparing flight controllers which are currently available, the approach we have taken here lists which features serve which functions, as well as aspects to look for.

Main Processor

 

8051 vs AVR vs PIC vs ARM: These microcontroller families form the basis of most current flight controllers. Arduino is AVR based (ATmel) and the community seems to focus on MultiWii as being the preferred code. Microchip is the primary manufacturer of PIC chips. It is difficult to argue that one is better than the other, and it really comes down to what the software can do. ARM (STM32 for example) uses 16/32-bit architecture, whereas AVR and PIC tens to use 8 / 16-bit (described below). As single board computers become less and less expensive, expect to see a new generation of flight controllers which can run full operating systems such as Linux or Android.

CPU: Normally these are in multiples of 8 (8-bit, 16-bit, 32-bit, 64-bit) and is a reference to the size of the primary registers in a CPU. Microprocessors can only process a set (maximum) number of bits in memory at a time. The more bits a microcontroller can handle, the more accurate (and faster) the processing will be. For example processing a 16-bit variable on an 8-bit processor is a bit of a chose, whereas on a 32-bit processor it is very fast. Note that the code also needs to work with the right number of bits, and at the time of this article, very few programs use code optimized for 32 bits.

Microcontroller

Microcontroller

Operating frequency: The frequency at which the main processor operates. Frequency is measured in “Hertz” (cycles per second). This is also commonly referred to as the “clock rate”. The higher the operating frequency, the faster it can process data.

Program Memory / Flash: The flash memory is essentially where the main code is stored. If the program is complex it may take up quite a bit of space. Obviously the greater the memory, the more information it can store. Memory is also useful when storing in-flight data such as GPS coordinates, flight plans, automated camera movement etc. The code loaded to the flash memory remains on the chip even if it power is cut.

SRAM: SRAM stands for “Static Random-Access Memory”, and is the space on the chip which is used when making calculations. The data stored in RAM is lost when power is cut. The higher the RAM, the more information will be “readily available” for calculations at any given time.

EEPROM: Electrically Erasable Programmable Read-Only Memory (EEPROM) is normally used to store information which does not change in flight, such as settings, unlike data stored in SRAM which can relate to sensor data etc.

Additional I/O Pins: Most microcontrollers have a lot of digital and analog input and output pins, and on a flight controller, some are used by the sensors, others for communication and some may remain for general input and output.. These additional pins can be connected to RC servos, gimbal systems, buzzers and more.

A/D converter: Should the sensors used onboard output analog voltage (normally 0-3.3V or 0-5V), the analog to digital converter needs to translate these readings into digital data. Just like the CPU, the number of bits which can be processed by the A/D determines the maximum accuracy. Related to this is the frequency at which the microprocessor can read the data (number of times per second) to try to ensure no information is lost. It is nevertheless hard not to lose some data during this conversion, so the higher the A/D conversion, the more accurate the readings will be, but it is important that the processor can handle the rate at which the information is being sent.

Power

There are often two voltage ranges described in the spec sheet of a flight controller, the first being the voltage input range of the flight controller itself (most operate at 5V nominal), and the second being the voltage input range of the main microprocessor’s logic (ex 3.3V or 5V). Since the flight controller is a fairly integrated unit, you really only need to pay attention to the input range for the flight controller itself. Most multi-rotor aircraft flight controllers operate at 5V since that is the voltage provided by a BEC (see lesson 3 for more information). To reiterate, you should ideally not power the flight controller separately from the main battery. The one exception is if you want a battery backup in the event that the main battery draws enough power that the BEC cannot provide enough current / voltage, causing a brownout / reset. Rather than a battery backup however, capacitors are often used.
Power

Power

Sensors

In terms of hardware, a flight controller is essentially a normal programmable microcontroller, but has specific sensors onboard. At a bare minimum, a flight controller will include a three axis gyroscope, but as such will not be able to auto-level. Not all flight controllers will include all of the sensors below and may include a combination thereof. The sensors

Accelerometer Axes

Accelerometer Axes

Accelerometer

 

As the name implies, accelerometers measure linear acceleration in up to three axes (let’s call them X, Y and Z). The units are normally in “gravity” (g) which is 9.81 meters per second per second, or 32 feet per second per second. The output of an accelerometer can be integrated twice to give a position, though because of losses in the output, it is subject to “drift”. A very important characteristic of three axis accelerometers is that they detect gravity, and as such, can know which direction is “down”. This plays a major role in allowing multirotor aircraft to stay stable. The accelerometer should be mounted to the flight controller so that the linear axes line up with the main axes of the UAV.

Gyroscope Axes

Gyroscope Axes

Gyroscope

 

A gyroscope measures the rate of angular change in up to three angular axes (let’s call them alpha, beta and gamma).  The units are often degrees per second. Note that a gyroscope does not measure absolute angles directly, but you can iterate to get the angle which, just like an accelerometer, is subject to drift. The output of the actual gyroscope tends to be analog or I2C, but in most cases you do not need to worry about it since this is handled by the flight controller‘s code. The gyroscope should be mounted so that its rotational axes line up with the axes of the UAV.

IMU 6 Axes

IMU 6 Axes

Inertia Measurement Unit (IMU)

 

An IMU is essentially a small board which contains both an accelerometer and gyroscope (normally these are multi-axis). Most contain a three axis accelerometer and a three-axis gyroscpe, and others may contain additional sensors such as a three axis magnetometer, providing a total of 9 axes of measurement.

Compass

Compass

Compass / Magnetometer

 

An electronic magnetic compass is able to measure the earth’s magnetic field and used it to determine the drone‘s compass direction (with respect to magnetic north). This sensor is almost always present if the system has GPS input and is available in one to three axes.

Atmospheric Pressure

Atmospheric Pressure

Pressure / Barometer

 

Since atmospheric pressure changes the farther away you are from sea level, a pressure sensor can be used to give you a pretty accurate reading for the UAV’s height. Most flight controllers take input from both the pressure sensor and GPS altitude to calculate a more accurate height above sea level. Note that it is preferable to have the barometer covered with a piece of foam to diminish the effects of wind over the chip.

GPS Satellites

GPS Satellites

GPS

 

Global Positioning Systems (GPS) use the signals sent by a number of satellites in orbit around the earth in order to determine their specific geographic location. A flight controller can either have onboard GPS or one which is connected to it via a cable. The GPS antenna should not be confused with the GPS chip itself, and can look like a small black box or a normal “duck” antenna. In order to get an accurate GPS lock, the GPS chip should receive data from multiple satellites, and the more the better.

Distance

Distance

Distance

 

Distance sensors are being used more and more on drones since GPS coordinates and pressure sensors alone cannot tell you how far away from the ground you are (think hill, mountain or building) or if you will hit an object. A downward-facing distance sensor might be based on ultrasonic, laser or lidar technology (infrared has issues in sunlight). Very few flight controllers include distance sensors as part of the standard package.

 

Flight Modes

Below is a list of the most popular flight modes, though not all will be available on all flight controllers. A “flight mode” is the way the flight controller uses sensors and RC input in order to fly and stabilize the aircraft. If you have a transmitter with five or more channels you may be able to configure the software to allow you to change the flight mode via the 5th channel (aux switch) while in flight. Each mode is defined below.

Mode Gyroscope Accelerometer Barometer Compass GPS Notes
ACRO / Gyro Only -X- Normally a default mode and is more “acrobatic” flight (drone cannot auto-level)
ANGLE (Stable/Level/Acc) -X- -X- Stable mode; will try to keep the model level to the ground (but not at a fixed position).
HORIZON -X- Combines the stable effect with slow RC commands and acrobatics with fast RC commands.
BARO (Altitude Hold) -X- -X- -X- Barometer is used in order to keep a certain (fixed) height when no other commands are received.
MAG (Heading Hold) -X- -X-   -X- Heading (compass direction) lock mode, it will try to keep its Yaw orientation.
HEADFREE (CareFree) -X- -X-   -X- Holds the orientation (yaw) of the drone and will always move in the same 2D direction for the same ROLL/PITCH stick movement.
GPS / Return to Home -X- -X-   -X-   -X- Automatically uses compass and GPS to return home to the starting GPS point.
GPS / Waypoint -X- -X-   -X-   -X- Automatically follows pre-configured GPS way-points autonomously.
GPS / Position Hold -X- -X-   -X-   -X- Hold current position using GPS and baro (if available).
Failsafe -X- Aircraft reverts to acro / gyro only when no other modes are selected.

 

Software

PID Control Loop & Tuning

 

Proportional Integral Derivate (PID) control allows you to change the drone‘s flight characteristics, including how it reacts to user input, how well and how quickly it stabilizes and more. The PID settings and how the software uses the various sensor inputs are incredibly important, but without seeing and understanding the code which dictates this is not too useful when comparing flight controllers. Manufacturer which produce “ready to fly” kits are able to fine tune the PID settings and equations for their specific platform, which is why most RTF muti-rotors fly quite well out of the box. Builders of custom drones however need to use flight controllers which are designed to be suitable for almost any type of multi-rotor aircraft, and as such it is up to the end-user to adjust the values until they are satisfied with the flight characteristics.

PID Graph

PID Graph

GUI

 

A GUI (Graphical User Interface) is what is used to visually edit the code (via a computer) which will be uploaded to the flight controller. The software provided with flight controllers continues to get better and better; the first flight controllers on the market used largely text-based interfaces which required that you understand almost all of the code and change specific sections to suit your project. More recently flight controller GUIs use interactive graphical interfaces to help you configure the necessary parameters.

Quadrino GUI

Quadrino GUI

Additional Features

 

The software used on certain flight controllers may have additional features which are not available on others. Your selection of a specific flight controller may ultimately depend on which additional features / fuctionality are offered. These features can include:

  • Autonomous waypoint navigation, which allows you to set GPS waypoints which the drone will follow autonomously
  • “Oribiting” i.e. moving around a fixed GPS coordinate with the front of the drone always pointed towards the coordinate (useful for filming)
  • “Follow me”: certain drones have a “follow me” feature which can be GPS based (for example tracking the GPS coordinates of a smart phone)
  • 3D imaging: Most 3D imaging is done after a flight using images captured during the flight and GPS data
  • “Open source”: the software associated with certain flight controllers cannot be modified / customized. Open-source products generally allow advanced users to modify the code to suit their specific needs.
3D Terrain

3D Terrain

 

Communication

Hitec RC Transmitter

Hitec RC Transmitter

Spektrum RC Transmitter

Spektrum RC Transmitter

 

Radio Control (RC)

 

Radio Control (RC) communication normally involves a hand-held (hobby) RC transmitter and RC receiver. For UAVs, you need a minimum four channels, and more are suggested, even if they are not used. Normally these channels are associated with:

  • Pitch (which translates to forward / backward motion)
  • Elevation (closer to or farther away from the ground)
  • Yaw (rotating clockwise or counter-clockwise)
  • Roll (to strafe left and right)

Additional channels can be used for any of the following

  • Arming / disarming the motors
  • Gimbal controls (pan up/down, rotate clockwise / counter-clockwise, zoom)
  • Change flight modes (acrobatic mode, stable mode etc)
  • Activate / deploy a payload, parachute, buzzer or other device
  • Any number of other uses

Most drone pilots prefer handheld control, meaning RC systems are still the number one choice for controlling a UAV. On its own, the receiver simply relays the values input into the controller, and as such, cannot control a UAV. The receiver must be connected to the flight controller, which needs to be programmed to receive RC signals. There are very few flight controllers on the market which do not directly accept RC input from a receiver, and most even provide power to the receiver from one of the pins.

Additional considerations when choosing a remote control include:

  • Not all RC transmitters can provide the full RC signal range of 500ms to 2500ms; some artificially limit this since most RC applications are for RC cars, airplanes and helicopters
  • The range / max wireless range (feet or meters) of an RC system is almost never provided from the manufacturers because it involves many factors such as obstructions, temperature, humidity, battery power and more.
  • Some RC systems have a receiver which also has a built-in transmitter for transmitting sensor data (GPS coordinates for example) which are shown on the RC transmitter’s LCD display.
Bluetooth Icon

Bluetooth

Bluetooth

 

Bluetooth, and more recent BLE (Bluetooth Low Energy) products were originally intended to be used to transfer data between devices without the complexity of pairing or matching frequencies. Certain flight controllers on the market can send and receive data wirelessly via Bluetooth connection, making it easier to troubleshoot issues in the field.

WiFi Icon

WiFi

WiFi

 

WiFi control is normally achieved using a WiFI router, computer (including latop, desktop, tablet) or smartphone. WiFi is able to handle both data transmission as well as image transmission, but is much more difficult to set up / implement. As with all WiFi devices, the range is limited by that of the WiFi transmitter.

Radio Frequency

Radio Frequency

Radio Frequency (RF)

 

Radio Frequency (RF) control in this context refers to sending data from a computer or microcontroller wirelessly to the aircraft using an RF transmitter / receiver (or two-way transceiver). Using a normal RF unit connected to a computer allows for long range two-way communication with a high “density” of data (normally in serial format).

Smartphone Nexus

Smartphone

SmartPhone

 

Although this is not a type of communication, the question of how to control a drone using a smart phone has come up enough to warrant a separate section. Modern smart phones are essentially powerful computers which coincidentally can also make phone calls. Almost all smart phones include integrated Bluetooth as well as WiFi either of which are used to control the drone and/or receive data and/or video.

Infrared

Infrared

Infrared (IR)

 

Infrared communication (like what you find in a television remote control) is rarely used to control drones as there is so much IR interference present even in a normal rooms (let alone outdoors) that it is not very reliable. Although it can be done, it is not suggested as a primary option.

 

Additional Considerations

Manufacturers of flight controllers generally try to provide the most features possible – either included as standard equipment or purchasable separately as options / add-ons. Below are just some of the many additional features which you might want to take a look at when comparing flight controllers.

Damping: Even small vibrations in the frame, normally cause by unbalanced propellers and/or motors, can be picked up by the onboard accelerometer, which will in turn send the appropriate signals to the main processor, which will then take corrective action. These minor corrections are not wanted nor needed for stable flight and it’s best to have the flight controller vibrate as little as possible. For this reason, vibration dampeners / absorbers are often used between the flight controller and the frame.

Case: A protective case around the flight controller can help in a number of ways. Aside from being more aesthetically pleasing than a bare PCB, a case often provides some level of protection from the elements, as well as added protection in the event of a crash.

Mounting: There are various different ways in which a flight controller can be mounted to a frame, and not all flight controllers have the same mounting options.

  • Four holes spaced 30.5mm or 45mm apart in a square
  • Flat bottom for use with a sticker
  • Four holes in a rectangle (no set standard)

Community: Since you are creating a custom drone, being part of an online community may help considerably, especially if you encounter issues or want advice. Obtaining advice from a community, or seeing user feedback regarding the quality and ease of use of specific flight controllers also helps.

Accessories: Aside from just the flight controller itself, additional products (accessories or options) may be required in order to make full use of the product. Such accessories may include, but are not limited to: GPS module and/or GPS antenna; cables; mounting accessories; screen (LCD / OLED);


Example

So given all of these different comparative features, what information might you be able to obtain about a flight controller, and what might a flight controller include? We have chosen the Quadrino Nano Flight Controller as a modern example.

Main Processor

The ATMel ATMega2560 used onboard is one of the more powerful Arduino-compatible ATMel chips available. Although it has a total of 100 pins, including 16 analog to digital channels and five SPI ports, due to its small size and intended use as a flight controller, only some of these are broken out on the board.

  • AVR vs PIC:  AVR
  • CPU: 8-bit
  • Operating Frequency: 16Mhz
  • Program Memory / Flash: 256Kb
  • SRAM: 8Kb
  • EEPROM: 4Kb
  • Additional I/O Pins: 3x I2C; 1x UART; 2×10 pin GPIO; Servo with 5x outputs; OLED port
  • A/D Converter: 10-bit
ATMega 2560

ATMega 2560

Sensors

 

The Quadrino Nano incorporates the MPU9150 IMU chip which includes 3-axis gyroscope, 3-axis accelerometer and 3-axis magnetometer. This helps make the board quite small without sacrificing sensor quality. The MS5611 barometer provides pressure data and is covered by a piece of foam. The integrated Venus 838FLPx GPS with external GPS antenna (included)

Quadrino Nano Sensors

Quadrino Nano Sensors

Software

 

The Quadrino Nano was made specifically to use the latest MultiWii (Arduino-based) software. Rather than having to modify the Arduino code directly, a separate, more graphical software was created.

Quadruino Software

Quadruino Software

Communication

  • Direct input from a standard RC receiver.
  • Dedicated Spektrum satellite receiver port
  • Serial (SBus and/or Bluetooth or 3DR radio links)
Quadrino Nano Sensors

Quadrino Communication

Additional Considerations

  • Case: A protective semi-transparent case is included as standard equipment
  • Mounting: There are two main ways to mount the Quadrino Nano to a drone: screws and nuts or foam sticker
  • Compact design: The controller itself (GPS antenna not connected) measures 53mm x 53mm.
Lynxmotion Quadrino Nano

Lynxmotion Quadrino Nano

 



from electronic for robot http://ift.tt/1GymhLT

0 comments:

Post a Comment