Building Autonomous UAV

This post will guide you in making an autonomous UAV for surveillance and monitoring purpose. 
The first section will cover the topic “Selecting the right components” which is the first step, followed by a brief guide to Software Stack of a Drone.  

It is very crucial to define the exact purpose of the drone, as it will determine the sensor requirement and thus the computational and power capability requirement. It is important to note, that these factors can’t be over or under estimated as it will determine the payload weight of the drone, and thus motor and frame specifications. 

After determining the Sensor requirement according to the purpose of the UAV, you can approximate the computational requirement. 

Now, you need to determine the frame specification, if it must be quad, hexa or octa copter. 
[ Advantage of Quad – Easy to build, low cost, less maintenance and space component cost as number of components is less. 
 Advantage of Hexa – Can carry more payload, Safe flight – as even if one rotor stops working in mid-flight it still remains operational, and if two fails, if can still be brought to land, thus more reliable. ]
Note : It’s not only about the thrust motors can provide, but also about the force that the frame and it’s each arm can bear. The allowance for the propeller size is also a major factor. 
Efficiency can be achieved but selecting the right frame – motor specification – propeller size – battery.  

After approximating the payload, thus the frame, look for the motor and verify the specification of the motor : thrust – thrust to power ratio, at given propeller size and battery voltage. 

P.S: In case of a big size drone, motor thrust at 65% throtle must be equal to the total weight of the drone including the payload itself. 
In case you also need to achieve fast manoeuvre, the same must be satisfied at 50% throttle. 
 
Once, you have found your motor, recalculate everything, and once the assumptions made are satisfied, move to the next step, else repeat this iterative process of design.  

Select the ESC, based on the maximum current rating of the motors (at maximum load). 

Based on the required flight time, power consumption and motor efficiency, determine the Capacity, maximum discharge rate and voltage of the Battery. 

Now, you have determined the following components : 
1. Frame
2. Motors
3. Propellors
4. ESC
5. Battery
6. Sensors
7. Computational Unit (Companion Board)
____________________

Now, Select
8. Flight Controller (based on stability requirement and budget).
9. Telemetry Device (based on bandwidth, data-rate, range of communication).
10. Power Converter Modules (based on Power Requirement of each components).
11. Remote (based on number of Channel Requirement for Operation).

Assembling a Multicopter

Summary

This blog is a guide to assemble a multicopter with an onboard low level microcontroller, starting from the very quad-root level. Hop onboard, let’s get started!

In this blog

APM

Alt TextThe APM Flight Controller

Ardupilot Mega (APM) is an IMU autopilot that is based on the Arduino Mega platform. It is capable for autonomous stabilisation, way-point based navigation and two way telemetry with Xbee wireless modules, supporting 8 RC channels with 4 serial ports. ArduPilot Mega consists of the main processor board and the IMU shield which fits above or below it.

Motors and ESCs

Alt TextBLDC Motor and ESC

The copter uses 850kV Brushless DC Motors, each with a dedicated Electronic Speed Controller of current rating 40A. The ESCs provide electronically generated three-phase electric power low voltage source of energy for the motor. The PPM signal for the control comes from the APM. ESCs can be BEC or OPTO.

The Power Source

Alt TextLiPo Battery

A Lithium Polymer battery of rating 11.1V, 3s, 5000mAh, 20C is used for powering the motors. The battery provides an average flight time of 4-6 minutes.

RC Transmitter and Reciever

Alt TextReciever and Transmitter

The quadcopter is controlled by a 6 channel 2.4 GHz RC transmitter and a 6 channel PPM receiver in manual mode. The bandwidth of the transmitter is 500Hz.

GPS

Alt TextUblox Neo-M8N GPS module

The Ublox Neo-M8N GPS module includes a HMC5883L digital compass.It outputs precise position updates at 10Hz. The Ublox NEO-M8N is configured to run at a baud rate of 38400.

Assembly

The illustration below highlights the typical installation of a quadcopter. It contains optional equipment including a Camera, Gimbal and a Battery Monitor and it utilizes an ESC wired “Y” power connection rather than the power distribution board common to many MultiCopters.

Assembly

Motor Order Diagram

Alt TextMotor Order for Quad X

The figure shows motor order for Quad X (the numbers indicates the connected autopilot output pin) and the propeller direction (clockwise (CW) motors are shown in green and take pusher propellers,counterclockwise motors (CCW) are shown in blue and take puller propellers. Diagrams for other frames can be found on the official Arducopter Website

Attaching Propellers

Alt TextRecognizing clockwise and counterclockwise propellers

The diagrams shows two types of propellers: clockwise (called pushers) and counterclockwise (called pullers). It is most reliable to recognize the correct propeller type by its shape. Note that the propellers have the edge with the shallow consistent curve at the leading edge in direction of rotation and the more radical scalloped (and usually thinner edge) as the trailing edge.

Mission Planner

Mission Planner is free, open source software available for Windows. The latest version can be downloaded from here.

Loading Firmware

Once you’ve installed the Mission Planner onto your computer, connect the autopilot board to your computer using the micro USB cable. Windows should automatically detect and install the correct driver software.

Open the Mission Planner and select the COM port drop-down on the upper-right corner of the screen (near the Connect button). Select AUTO or the specific port for your board (PX4 FMU or Arduino Mega 2560). Set the Baud rate to 115200 as shown. Don’t hit Connect just yet.

On the Mission Planner’s Initial Setup->Install Firmware screen select the appropriate icon that matches your frame (i.e. Quad, Hexa). Answer Yes when it asks you “Are you sure?”.

If all goes well you will see some status appear on the bottom right including the words, “erase…”, “program…”, “verify..” and “Upload Done”. The firmware has been succesfully uploaded to the board.

Install firmware

Mission Planner: Install Firmware Screen

Alt Text

Select the desired port and data rate and then press the Connect button to connect to the autopilot. After connecting Mission Planner will download parameters from the autopilot and the button will change to Disconnect as shown.

Compass Calibration

  • Under Initial Setup->Mandatory Hardware select Compass.
  • Select your flight controler configuration to automatically enter the most important configuration information for your board.
  • Confirm that the Enable compasses and Obtain declination automatically boxes are checked.
  • Click the Live Calibration button.
  • A window should pop-up showing you the state of the live calibration.

Install firmware

Mission Planner: Live Compass Calibration

  • The aim is to rotate the vehicle so that the coloured trail hits each of the white dots. One way to do this is to hold the vehicle in the air and rotate it slowly so that each side (front, back, left, right, top and bottom) points down towards the earth for a few seconds in turn.
  • The calibration will automatically complete when it has data for all the positions. At this point, another window will pop up telling you that it is saving the newly calculated offsets. These are displayed on the main screen below each associated compass.

A video demonstration of the live compass calibration can be found here.

Radio Control Calibration

RC transmitters are used to control vehicle movement and orientation. Copter minimally controls throttle, pitch, roll and yaw. Each of these control signals are mapped to transmitter stick/switch(s) and in turn to autopilot channels from the connected receiver.

Copter default channel mappings are:

  • Channel 1: Roll
  • Channel 2: Pitch
  • Channel 3: Throttle
  • Channel 4: Yaw
  • Channel 5: Flight modes
  • Channel 6: (Optional) Inflight tuning or camera mount (mapped to transmitter tuning knob)

For safety reasons you should disconnect the battery and/or remove propellers before preforming radio calibration. Also, centre trims in manual RC mode before preforming RC calibration. If trims are not centred you may need to do the RC calibration again after you have used the vehicle.

  • Open Mission Planner’s INITIAL SETUP->Mandatory Hardware->Radio Calibration screen.
  • Click on the green Calibrate Radio button in the lower right of the window.
  • Mission Planner will display a prompt to check radio control equipment is on, battery is not connected, and propellers are not attached. Select OK.
  • Move the control sticks and toggle switches on your transmitter to their limits of travel and observe the results on the radio calibration bars. Red lines will appear across the calibration bars to indicate maximum and minimum values.
  • Select Click when Done when all required channels are set at the minimum and maximum positions.

RC Calibration

Input range marked with red lines

Accelerometer Calibration

  • Under Initial Setup->Mandatory Hardware, select Accel Calibration from the left-side menu.
  • Click Calibrate Accel to start the calibration.
  • Mission Planner will prompt you to place the vehicle each calibration position. Press any key to indicate that the autopilot is in position and then proceed to the next orientation.

The calibration positions are: level, on right side, left side, nose down, nose up and on its back.

Accelero Calibration

Accelerometer Calibration Positions

  • When you’ve completed the calibration process, Mission Planner will display “Calibration Successful!”

A video demonstration can be found here.

ESC Calibration

Electronic speed controllers are responsible for spinning the motors at the speed requested by the autopilot. Most ESCs need to be calibrated so that they know the minimum and maximum pwm values that the flight controller will send.

Before calibrating ESCs, please ensure that your copter has NO PROPS on it and that the APM is NOT CONNECTED to your computer via USB and the Lipo battery is disconnected.

  • Plug one of your ESC three-wire cables into the throttle channel of the RC receiver. (This is usually channel 3.)
  • Turn on the transmitter and set throttle stick to maximum (full up).
  • Connect the LiPo battery. You will hear a musical tone, then two beeps.
  • After the two beeps, lower the throttle stick to full down.
  • You will then hear a number of beeps (one for each battery cell you’re using) and finally a single long beep indicating the end points have been set and the ESC is calibrated.
  • Disconnect battery. Repeat these steps for all ESCs.
  • If it appears that the ESC’s did not calibrate then the throttle channel on the transmitter might need to be reversed.
  • If you are still having trouble after trying these methods (for example, ESCs still beep continuously) try lowering your throttle trim 50%.
  • You can also try powering your APM board via the USB first to boot it up before plugging in the LiPo.

Once you have calibrated your ESCs, you can test them by plugging in your LiPo. Remember: no propellers!

  • Ensure your transmitter’s flight mode switch is set to “Stabilize Mode”.
  • Arm your copter
  • Give a small amount of throttle. All motors should spin at about same speed and they should start at the same time. If the motors do not all start at the same time and spin at the same speed, the ESC’s are still not properly calibrated.
  • Disarm your copter.

Flight Modes

There are a few things you need to know about the flight modes in ArduCopter before flying.

  • For flying manually without GPS, fly in STABILIZE mode.
  • For flying at a fixed height manually, use ALTITUDE HOLD mode.
  • For flying manually with GPS use Loiter mode(it flies stably and stays at a position if you leave the controls).

You can read more about flight modes here.

Arming the Motors

  • Before proceeding, ensure that the following params are set in Config/Tuning->Full Parameter List

      - THR_MIN  = 130
      - THR_MAX  = 1000
      - MOT_SPIN_ARMED = 0
    
  • Turn on your transmitter.
  • Plug in your LiPo battery. The red and blue lights should flash for a few seconds as the gyros are calibrated (do not move the copter).
  • The pre-arm checks will run automatically and if any problems are found an APM2.x will double blink the red arming light, on a Pixhawk the RGB led will blink yellow.
  • Arm the motors by holding the throttle down, and rudder right for 5 seconds. It takes approximately 5 seconds the first time the copter is armed as it re-initialises the gyros and barometer. Do not hold the rudder right for too long (>15 seconds) or you will begin the AutoTrim feature.
  • Once armed, the red arming light should go solid.
  • Raise the throttle to take-off.

Selecting the right Components and Justification

For UAV : 

1.1 Rough Approximation of the PayLoad for the required application 

Component

Weight (gm)

Max Weight (gm)

Battery

2000 (Single)

 

Frame

500 (Quad)

1200 (HEXA)

Motors 

1200 (4 motors)

1800 (6 motors)

ESC + Wires

500

 

FCU + GPS 

500

 

Onboard Computation

300 (Jetson)

2200 (NUC)

Connections

1000

 

Realsense

600

 

Additional Sensors

1500
(Cameras, Gimbal, LiDAR)

 

Telemetry

500

 

Power Module

500

 

TOTAL

9.100kg

12.300kg

 

Approximate Weight of Drone = 9.1kg (QUAD), 12.3kg(HEXA)

Weight = 10.100kg (Without NUC : HexaCopter).
Considering 20perct safety factor, Required Thrust = 12.12kg (without NUC: HexaCopter)

Thrust Requirement per Motor at 50 percent throttle = 1.6×6 = 9.6kg

Max Thrust Requirement per Motor at 100 percent throttle = 4.1×6 = 24.6kg

_____________________________________________________________________

1.2 Selecting the FRAME Type

The payload for the UAV is approximately 10kg. A Quadcopter with 20 inch propellers and high power motors will be able to lift it. But due to unavailability of quadcopter frame supporting 20inch propellers we shifted to HexaCopter frame. This gave another advantage of carrying much higher payloads for eg. 10kg for spraying pesticides.

As per calculation, the hexacopter would be able to lift 25kg(approx.), which gives us the freedom to use many other sensors in the near future.

1.3 Selecting the Motors

So, as per the required thrust
T-Motors: U7 490KV – 22.2V – 15” propeller – Flame 60A ESC comes out to be the most Efficient combination of requirement.

1.4 Selecting the ESC and Propellor Size

As per Motor’s efficiency curve, 15” or 16” seems to be the optimal size of propellor diameter required. We decided to go with 15” because of the frame size and safety factor
ESC : Max Current Drawn by the motor is 48.1 A, thus we need FLAME 60, which is an ESC that can handle upto 60A.

1.5 Selecting the Frame According to the PayLoad Capacity and Propellor Size

Now, that we know the payload capacity, motor specification, propellor size and ESC, we recalculated and figured out that we needed HexaCopter to satisfy the present payload requirement and buffer to add additional sensors in future.

1.6 Selecting the Batteries

According to the motor’s specifications, 22.2 V batteries are used. Additional Power Converter will be used to convert 22.2V to 12V and 5V on which other components will work. We chose 16000mAh batteries for longer flight time.

1.7 Selecting the Flight Controller and GPS

The Standard Pixhawk 4 flight controller and Pixhawk GPS is used . It communicates with the Telemetry, GPS, IMU and the Onboard Computational Unit. It is the link between the UAV and the processing unit. We chose Pixhawk 4 as it gives nearly the same performance as Pixhawk Cube but with highly reduced cost.

1.8 Approximating the Sensor Requirement and Computational Load

For Crop Health Monitoring: 2x NoIR Pi Cam with 680nm and 850nm Filter

For Obstacle Avoidance: 2D LiDAR

For Exploration Mapping: 2x Realsense D435i

For Tracking and Coordination: Gimbal + Camera

Such heavy data processing will require at least 4 core processor and 4gb RAM.

1.9 Selecting the Onboard Companion System

NVIDIA JETSON NANO

Jetson is the cheapest computational board with 4gb RAM 4 core processor and CUDA cores.

1.10 Selecting the Remote Transmitter and Receiver

FrSky X9D+ : RSSI alarms (warns you of reception problems before it becomes an accident), 

16 channels (more when combined with external module),16 custom curves with 3-17 points each, Long range system capable of up to 3 times the range of current systems, Super low latency for ultra-quick response (9ms).

1.11 Selecting the Telemetry Modules

1.11.1       3DR Radio : The 3DR Radio is the easiest way to setup a telemetry connection     between your flight controller and a ground station.

1.11.2 Rocket M5 : Long Range Data Transfer (upto 50km), from ground station to the UAV. 

1.12 Power Distribution System 

1.12.1 22.4V to 12V DC – DC Converter : For sensors and components present on the UAV.

1.12.2 12V to 5V DC-DC Converter : For onboard computation unit and other sensors on the UAV.

1.13 Spare Components Requirement and Justification

1.13.1 Battery : Extra batteries will be required for continuous testing purposes as recharging a battery consumes a lot of time.

1.13.2 Propellers : Some mishappening may happen while testing, therefore for uninterrupted testing purpose we need some spare propellers.

1.13.3 Embedded Modules : When using high voltage and current on UAV, some embedded modules may heat up and start malfunctioning. Hence extra modules are needed for continuous testing.



ROS
Joy-Node
Obstacle Detection and Identification
Environment Mapping
Obstacle Avoidance

** Content To be Uploaded

Leave a Comment

Your email address will not be published. Required fields are marked *

Building Autonomous UAV

Leave a Reply

Your email address will not be published. Required fields are marked *