To successfully construct a quadcopter that is able to fly autonomously and avoid obstacles, we have assembled a drone. Furthermore, SONAR technology has been added to this drone so as to fulfill our purpose of obstacle avoidance. GPPS technology has been loaded as well to make the flight autonomous.
A Drone utilizes a variety of components to make stable flight happen and to be able to fly and stabilize flight, all components used are tailored as per the requirements of this setup and various deciding factors are discussed in the next section. This section discusses each component used and its importance.
The frame acts as the chassis for the drone. It has joins the motors along with the propellers to the aircraft. When choosing a frame it must be noted that it should be made of a strong material which is light in weight as it has the responsibility to hold the entire weight of the aircraft in air. It must be large enough to house all the components and so that the propellers can spin without colliding with each other or the other components present.
2. Motors and Propellers
Brushless DC motors were decided to be the best use for this purpose due to their versatility and efficiency. These brushless motors work on 3 phase DC current. The motors we have used have a rating of 920kv which translates to roughly 920 rotations per unit voltage input in static condition.
Propellers come in a variety of sizes and materials. Based on the thrust required and battery used the propeller can be chosen. They are measured by (diameter) x (pitch). The diameter of a propeller can be defined as the diameter of the circle that the blade tips generate while rotating whereas pitch is how far a propeller can travel in one revolution.
3. Electronic Speed Controllers (ESCs)
An ESC is used to translate the PWM signals into the suitable 3 phase DC power output that Brushless motors operate on. They are based around the atmega 328p processor and a custom firmware is flashed onto them that calculates the pwm signal input and converts the DC battery power into a 3 phase DC output for the brushless motor coils.
For the required power draw, Lithium-Polymer batteries turned out to be the most energy dense storage media among other batteries without compromising on the high current draw. Gasoline outperforms electric batteries but the complexity that it’s corresponding parts add to the model was a great disadvantage.
5. Radio Tx/Rx
Manual control of the drone is desirable by the dual stick layout which control the primary 4 aspects of the aircraft. We have chosen a 2.4 GHz radio transmitter which features a unique AFHDS (Automatic Frequency Hopping Digital Service) that maintains a constant connection with the receiver over the many sub frequencies in the 2.4GHz region without the risk of interference from any other 2.4GHz noise from consumer tech like Bluetooth and Wi-fi, among others.
The Receiver unit supports a wide range of output protocols such as PWM, PPM, S-BUS and I-bus. Each has their own advantages and unique qualities.
6. PWM-PPM Encoder
A piece of circuitry based on the Atmega atmel 328p microcontroller that encodes a set of 8 PWM channels into a single PPM output.
7. Flight Controller
A flight controller is mandatory for a quadcopter since the basic flight control maneuvers that the transmitter relays do not logically translate to various motor speeds. The flight controller that we have used is based on the STM32 series of processors. A flight controller firmware is a library of code that translates the input between the outputs. Stabilization is achieved using the stream of information that’s calculated from the accelerometer and gyroscope’s positional and inertial data. The primary task of the flight controller is to translate the input signal to the individual motor pwm output that governs the speed of the motor.
8. Power Distribution Board (PDB)
Various electronic components act as the power supply for the successive component in the chain of command. However, some of the operational voltages vary for many components. A power distribution board is integrated with BEC (Battery Eliminator Circuit) that steps down the voltage to the desired range. A PDB is responsible for distributing the power from the battery to all the electronic components present. Some PDBs are also equipped with Battery Eliminator Circuit which are voltage regulators to power the payload present.
9. Landing Gear
A landing gear is used as an accessory to assist with the landing or takeoff phase to make the aircraft more convenient to access. However, we have used the landing gear to overcome the anomalous thrust output over changing altitude. Whilst on ground, the propellers generated thrust to lift off due to thrust augmentation by ground effect and with enough separation from the ground, thrust falls short of weight force and the model begins to descend. This gave rise to an oscillatory feedback loop that was overcome only with a great increase in power which was an inefficient way to operate the model.
So we’ve used the landing gear to create ground clearance enough where propellers don’t experience ground effect anymore. This cleaned up the thrust variations and led to a smoother flight.
10. Ultrasonic Sensors
These sensors are used for obstacle detection and avoidance. These sensors use sound waves to detect objects in their vicinity. A sound wave is sent and if there is an object in front of it then the sound wave gets reflected back to the sensor and it picks it up. Based on the time taken for the sensor to pick up the echo the distance is calculated between the object and sensor.
As ultrasonic sensors are incapable of calculating the distance between them and the object. We’ve decided to use a microcontroller for controlling the sensors and giving the precise corrective outptut to the flight controller. We have used an Arduino Nano which is based on the ATmega328p 8-bit microcontroller. The software has been written in the IDE which is specially designed to program the Arduino by its developers. The IDE software uses the C/C++ language and is very easy to implement.
Certain libraries specific to the sensors have also been added as they are builtin with special functions that make implementing the Ultrasonic Sensors easy. The NewPing library has been included as it has a variety of methods and functions for these sensors and has been introduced mainly to cater the needs of various ultrasonic sensors.
3.3 PID Control
It is vital to implement a dynamic system controller which is responsible to stabilize the quadcopter at the desired altitude. This is achieved by employing proportional,, integral and derivative (PID) controller.
Figure 1: Block Diagram for PID Control
PID Control is a closed loop control system that aids in getting the actual result of the quadcopter closer to the desired result by adjusting the inputs given to the quadcopter. This enhances the stability of the quadcopter. The main goal of the PID controller is to rectify the “error” which is the difference between a measured value (value given by gyroscope) and a desired set point (desired speed of rotation). This error can be minimized by altering the control inputs in every loop i.e., the speed of the motors.
It is performed in the following steps:
1. First, the error e(t) is calculated as Setpoint.
2. Then P, the proportional term can be calculated as Kp.e(t)
3. The integral term I is calculated as Ki.(time integral of e(t))
4. Then D, the derivative term is calculated as Kd.(time derivative of e(t))
5. These three terms are added up to produce the controller output, u(t) = P + I + D
The desired output can be seen only when the values of (Kp, Ki, Kd) are properly selected. This process of choosing these parameters is known as “PID Tuning”. There are other control systems available as well but PID tuning is relatively simpler.
3.4 Collision Avoidance Design
This chapter deals with the aspect of obstacle detection and collision avoidance. Since our quadcopter is in air, our main aim is to avoid any physical contact with the objects and succesfullly manouevre away from them. This can be done in a couple of steps:
1. Detecting the obstacle with suitable hardware.
2. Prohibiting the movement of the quadcopter towards the obstacle.
3. Moving away from the obstacle.
3.4.1 Choice of Sensor Hardware
When detecting potential obstacles in the environment a set of sensors are required that observe the enviroenment continuously. These sensors can be mainly categorized in to two types: External positioning sensors and internal proximity sensors
External Proximity Sensors
These sensors are not physically present on the quadcopter but are in its immediate environment. External detection can produce quite accurate results in a known environment but they require predefined and accurate hardware setup. Thus in this type autonomous flight is only possible in limited areas provided they are equipped with the right hardware.
1. Beacon Positioning System
This system determines the relative position of an object to a number of beacons and calculates the accurate position within a room based on the time taken to receive signals from all surrounding beacons. Suppose a room is equipped with a number of beacons, lets say five. Then the object sends a request signal to all the five beacons in the room which send their acknowledgement back. Based on the time taken to receive the acknowledgement signal the object is able to calculate its distance between itself and the surrounding beacons.
Figure 4: Calculating the position of an object with the aid of beaconsxiii
If the speed of the propagation medium is known along with the time taken to receive the signal, the distance between any beacon and the object can be calculated.
However this method of position detection requires a precise buildup of beacons and a very good understanding of the surrounding room. If all information is present the object may be successful in determing its exact position with a room and avoid collisions with potential obstacles. This is only practical in a fixed environment where the position of all obstacles and our object is known and will not be successful in a dynamically changing environment.
2. Position detection with Image Processing
To deal with a dynamically changing environment, the images received from multiple cameras can be processed to create a 3D model of our object and its surroundings. This will make sure that the objects navigates safely in its surroundings and can also combat against unpredictable obstacles. However such a system requires adequate lighting and robust mathematical computational abilities.
Internal Proximity Sensors
These sensors are physically present on the quadcopter. The data that the sensors return do not determine the actual postion of the copter but the relative distance between the quadcopter and the potential obstacle. The number of sensors present and their alignment influence the quality of obstacle detection.
1. Infrared Proximity Sensors
An IR sensor is capable of detecting objects in a very short duration of time as it works on the speed of light. The emitter diode emits a IR light pulse, which when strikes the object reflects it back and this is picked up by the receiver. However, IR sensors have a fixed range in which they can detect an object and hence a system consisting of only IR sensors cannot totally cover the area surrounding a quadcopter. To provide maximum coverage a variety of sensors should be used which can lead to interferences and measurement errors. Moreover since they work on the principle of reflection of light, they are not very accurate when it comes to objects with rough surfaces and tend to be sensitive to dark colors. Sunlight and artificial lighting can cause interference which further reduces its applicability.xiii
2. Laser Proximity Sensors
These sensors work on the same principle as of an IR sensor but emits a laser signal instead of a light wave. Based on the time taken to receive the reflected signal the distance is calculated. However to calculate shorter distances in metres a very fast and small chip is required to calculate the distance accurately. Not many options are available when it comes to this and they are available at a much higher price than all the other discussed sensors. Moreover, laser beams can cause significant eye damage and we cannot risk lives.
3. Ultrasonic Proximity Sensors
US sensors work on the principle of echolocation and calculate distances based on time of duration. They can detect various materials and are not sensitive to the surface of the objects or their color. Based on their processing they can further be classified into processing and non-processing sensors. Processing sensors have an inbuilt chip which starts taking measurements and calculates the distance based on the time interval and then gives out this proximity distance. Whereas non-processing sensors simply give out the time taken to receive the echo pulse and a microcontroller is supposed to calculate the distance between the object and the sensor. However, the time taken by US sensors to calculate distance is relatively higher as compared to optical sensors, their simplicity in design makes them cheaper and easier to implement.xiii
Table 2: Comparison of different sensor types
Sensor Type Range Speed Cost
IR Small Fast Moderate
Laser Large Fast Expensive
US (Processing) Medium Slow Moderate
US (Non-processing) Medium Slow Cheap
Table 1 gives a comparison between the available internal proximity sensor types
Based on the data in the above table and our analysis we have decided to use non-processing Ultrasonic sensors and have used HC-SR04 sensors.
Figure 5: HC-SR04 Ultrasonic Sensor
3.4.2 Acoustic Distance Measurement
The HC-SR04 sensors has four pins, two for power supply and the other two for sending out an Ultrasonic wave and receiving its echo. To send out an Ultrasonic Wave the Trig pin is set to HIGH for some duration and then its echo is heard by setting the Echo-pin to HIGH. Once the echo has been received the Echo-pin turns to LOW. To calculate the distance between the obstacle and the sensor, the time duration between the transmission of the signal and its echo to return is noted.
Figure 6: Working of Ultrasonic Sensor
Hence distance can be calculated by,
Distance = (Time * Speed of sound in air) / 2 Eq 5.1
Since the ultrasonic sensor is not capable of calculating the distance on its own, the above calculation is done by the Arduino Nano. As the quadcopter is in air, the microcontroller has to constantly check for obstacles. For this, it keeps sending out pulses after regular intervals of time and waits for the echo to return.
As the temperature and humidity in air rises the speed of sound fluctuates, to calculate the accurate distance between the object and the sensor, the speed of sound should be taken according to the surroundings that the quadcopter is placed in.
Figure 7: Sonic speed Vs Air temperature
The most common approach to trigger HC-SR04 on an Arduino are as follows
However there are some issues when it comes to the pulseIn function so we’ve decided to include NewPing library into our source code. This library is capable of supporting many ultrasonic sensors simultaneously and has several functions to calculate the distance in cm and inches. A short example of triggering the ultrasonic sensor using the NewPing libaray is given below:
3.5 Radio Communications
Radio communication most commonly known as RC is the transmission and detection of radio signals for the purpose of communication. Radio waves have wavelengths between 1cm – 100km and frequencies ranging from 3kHz – 300GHz. These waves travel through a channel (most probably atmosphere) through LOS (line-of-sight), reflection by ionosphere or communications satellite. Based on the distance between the transmitter and the receiver the it is decided as to whether the waves will be transmitted through reflection or LOS.
A radio wave is made up of mutually perpendicular magnetic and electric fields. When these fields are synchronous with each other, they reach their maxima and minima at the same time and are said to be in phase. As the distance from the transmitting source increases, the area over which the fields spread increases and therefore their energy per unit area decreases. This reduction of signal strength when it travels large distances is known as fading. To overcome fading, repeaters are installed so that they keep strengthening the signal and communication continues.
Figure 2: Electromagnetic Spectrum
The entire radio frequency spectrum is divided into separate bands from very low frequency to superhigh frequencies. To reduce interferences and ensure the quality of communication, specific bands have been allocated for specific applications. The table below summarizes the different bands that and their applications.
To implement radio communications in a quadcopter, we are using a transmitter and receiver operating at a frequency of 2.4GHz. This frequency lies in the ISM band (Industrial, Scientific and Medical band) and is open to wireless communications. Furthermore, there is no license required when using this frequency.
The RC protocols used in quadcopters can be divided into namely, Tx protocols and Rx protocols. Tx protocols are used when communicating between the transmitter and receiver whereas the Rx protocols are used for receiver and flight controller communication.
Rx protocols are mainly universal while some of them are brand specific. However for our project the Rx protocol used is PWM. This stands for Pulse Width Modulation and is a signal modulation technique that uses digital signals to create an analog signal. A PWM signal consist of two main components: duty cycle and frequency. The duty cycle gives the amount of time the signal is in a HIGH state as compared to the total time taken for a cycle to complete. The frequency states how fast the PWM completes a cycle and how fast it switches between states, both HIGH and LOW. When such a digital signal is cycled at a very high rate the output appears as analog voltage signal.
Figure 3: PWM duty cycle Representation
Such signals are used to drive servos and speed controllers. If the PWM pulse has a duration of 1000 microseconds the ESC’s know that the motors are not supposed to spin. If the pulse has a duration of 2000 microseconds then the ESC’s spin the motors at maximum speed. Any pulse with duration lying in between 1000 and 2000 microseconds is considered to be proportional and the ESC adjusts the motor speed according to this proportional. Suppose there is a pulse of duration 1500 microseconds, then the ESC’s will make the motor speed 50% of the maximum value and so on. This is implemented because DC motors require large amounts of current to operate. It is much easier to control the speed of motors at low RPM with PWM and hence increases the efficiency of the system. Moreover, the power loss in this technique is very minimal, mostly because PWM signals completely turn off the output power rather than reducing it to a minimum.
Global positioning system is a satellite navigation system that utilizes a radio receiver to get collect signals from the satellites orbiting around the earth and determine its exact position. Since it’s a broadcast radio system, it can be accessed from anywhere in the world and is widely used.
It mainly consists of three segments namely the space segment, the control segment and the user segment. The space segment consists of the GPS satellites that are deployed around the earth in six orbits. These satellites are placed at an altitude of 20000km and orbit the earth at 12-hour intervals. The control segment is responsible for the monitoring, controlling and maintaining satellite orbit and in case of any deviation it makes sure that they lie within the tolerance levels. Finally the user segments consists of the GPS receivers which are mounted on devices.
GPS navigation is manly based on the method of triangulation. By using this method the position of a radio receiver can be determined by calculating the radial distance of the signal received from different satellites.
The features that can be added to the drone once it has the GPS receiver are as follows:
1. Position hold: this allows the drone to stay at a fixed position by maintaining its altitude and location. Unless external command is not given the drone stays in its place.
2. Return to Home (RTH): this feature allows the drone to return to its initial position ie., where it had taken off from. Once the command is given form the transmitter, the drone safely makes its way through and lands on its initial position. In some drones, this feature is automatically enabled once the battery level reaches a minimum threshold.
3. Autonomous flight: this feature makes the drone follow a predetermined path. Once it has been enabled the drone uses its autopilot system to follow its course.