Quadcopter Altitude Estimation Using Low-Cost Barometric , Infrared , Ultrasonic and LIDAR Sensors

The goal of this research is to assess the different low-cost sensors for flight altitude measuring of a multirotor UAV at low altitude flight. For optimizing the sensor performances and accuracy, data filtering and other methods were applied. The flight altitude data were collected and stored for later analysis with reference to the true altitude. The correlation coefficient and the mean squared error were calculated in order to assess the sensors’ performance. On the basis of the results of the study, it was possible to determine the choice of the adequate sensor for this specific use. The study showed that the best characteristics for this experiment conditions had the Garmin LIDAR-Lite V3HP sensor and the Bosch Sensortech BME280 that combined air humidity, atmospheric pressure, and air temperature sensor.


INTRODUCTION
It is said that sensors are the sensing organs of a technical system. For an autonomous multirotor or unmanned aircraft, it is essential to know the height above ground in order to avoid collision and ensure safe navigation, thus the importance of the altitude sensors and systems. Depending on the need, the height above ground could be measured directly from a downward facing distance sensor, or in relation to the starting point level, or above the average sea level using various sensors, etc.
If the purpose of the aircraft is the precise flight with constant above ground altitude, altitude sensing becomes the most important feature. These measurements are influenced by many factors such as weather conditions, temperature deviations and different air layers if a barometric sensor is used, while they suffer from an overly simple model of the Earth's geoid when using GPS. Various sensors can be used for altitude (height) determination, and each one has its own characteristics, benefits, and problems.
The goal of this research is to analyse and assess the results of different low-cost sensor altitude readings and possibly offer the best solution for altitude estimation in low altitude flight multirotor use.
The most used sensors for commercial solutions are based on sonar, barometric, or radar principle. For precision altitude sensing on crop-spraying drone described in [1], three different time-of-flight (TOF) altitude sensors are used. The objective of this work was to analyse the best approach for altitude sensing in a variety of conditions aiming at precision agriculture applications. It is shown that data acquisition from different environments combined with the proposed methodology may provide better decisions in the product design. The sensors which provided the best performance in the used metrics and tested environment were "Lightware SF11-C" and "LeddarTech M16" sensors.
Estimation of the altitude of a UAV is extremely important when dealing with flight maneuvers like landing, taking off, low altitude flight, etc. The work described in [2] shows the relative error comparison between height measurements with a barometric and ultrasonic sensor, and the possible decision height for the flight controller altitude hold application.
In Airborne Gamma-Ray Spectroscopy (AGRS) the flight altitude is a fundamental parameter for correcting the gamma signal produced by terrestrial radionuclides measured during airborne surveys. The radiometric measurements with UAVs require light and accurate altimeters for flying at some 10 m from the ground. This research has shown that at altitudes below 70 meters, the radar and barometric altimeters provide the best performances, while Global Navigation Satellite System (GNSS) data may be used only for barometer calibration as they are affected by a large noise due to the multipath error from the sea surface [3].
The work shown in [4] investigates the use of a single camera to accomplish resorting to machine learning techniques, while [5,6] use stereo vision cameras to avoid the lack of information suffered by a single camera setup. For UAV altitude measuring the work reported in [7] uses a fusion of barometric altitude estimate with GPS altitude data, while the work [8] uses fusing altitude measurements from a barometric sensor and an ultrasonic sensor for estimating the UAV altitude, finding that measurement errors were around 5%.

The quadcopter
The drone used in this research, shown in Figure 1, is a home-made quadcopter with "F450" frame, "DJI NAZA-M Lite" flight controller, and GPS antenna [9]. It has a mass of 1310 g and dimensions 63 × 63 × 35 cm. The drone is powered by four "2212 920KV" DC brushless motors with "9450 type" propellers, driven by four "Simonk 30A 5V/2A" electronic speed controllers. Two types of batteries have been used during flight, the 3300 mAh 50C and the 4000 mAh 60C batteries, both with 4S Lithium-Polymer technology cells, which provide from 15 to 20 minutes of flight, depending on flight conditions. The remote control is achieved with "Flysky FS-iA10B" receiver and "Flysky FS-i6s" with 10 channels and a 2.4 GHz radio control system. The total cost of this system, including the quadcopter and the radio controller, was around 200 USD. To measure the flight altitude, the sensors were attached under the drone during flight, by a specially made platform.  Table 1. It is important to mention that the accuracy and the resolution of the barometric sensor are originally given in Pascal, and transferred in meters afterward.

The ultrasonic rangefinder
The ultrasonic sensors use high-frequency sound to detect and localize objects in various environments, and they are not affected by the colour of the detected object [10]. These types of sensors measure distance up to 3 m with accuracy class 0.5%, the distances up to 6 m was accuracy class 0.7% and in case of measurement distances over 6 m the accuracy class was 0.4%. It can be seen that the sensor accuracy was in all cases related to the measurement range and that the maximum measurement error of 3-4 cm indicated by the manufacturer was confirmed with reserve [11]. The paper [12] presents an overview of indoor and outdoor drone localization methods with an ultrasonic rangefinder, which continues research in [13] using ultrasonic sensors for SLAM (Simultaneous Localization And Mapping).
The ultrasonic altimeters are not suitable for terrain covered in vegetation. Because of the ultrasonic frequency, which is generally about 40 kHz to 45 kHz, and the wavelength that is much larger than the vegetation geometry, it is easy to penetrate vegetation. Therefore, ultrasonic altimeters should not be suitable for forests and other vegetation covered terrain.
The sensor used in this research is the "HC-S04" [14]. It is a low-cost ultrasonic ranging module with a range from 2 cm to 400 cm and accuracy up to 3 mm.

Infrared rangefinder
Optical sensors, such as infrared rangefinders, are very convenient for measuring height and displacement. Their main advantages are simplicity and the absence of the loading effect. Their insensitivity to straying magnetic fields and electrostatic interferences makes them quite suitable for many sensitive applications, but they can be affected by the sunlight. Usually, it requires at least three essential components: a light source (for example a light emitting diode -LED), a photodetector (such as a position-sensitive detector -PSD), and light guidance devices, which may include lenses, mirrors, optical fibres, and so forth [10]. These sensors usually operate in near infrared region. The position (distance) of an object is determined by applying the principle of a triangular measurement, while the PSD operates on the principle of photoeffect. Their limited dimensions allow their wide use in small systems like in [15].
The infrared sensor used for this research was "Sharp GP2Y0A710K0F", which is a distance measuring sensor unit composed of an integrated combination of position sensitive detector (PSD), an infrared emitting diode (IRED), and a signal processing circuit. It outputs the voltage corresponding to the detection distance. The emitting wavelength range of LED for this product is λ = 870 ± 70 nm, and the measuring range of this sensor is from 100 cm to 500 cm [16].

Barometric altimeter
Issues regarding dimensions and accuracy of barometric sensors are resolved nowadays using the MEMS (Microelectro Mechanical Systems) technology. The MEMSbased sensors have several advantages such as high sensitivity, high frequency response, low cost and mass production, but also involve problems like temperature drift, nonlinearity, offset, aging, hysteresis, and sensing problems due to the environmental effects [20]. Usually, the altitude is calculated from the pressure using the (1): where H is the altitude, 0 T is the static temperature in Kelvin, 0 p is the reference atmospheric pressure at altitude 0 H = m and p is the measured pressure. The (1) follows the assumption that 0 T is constant during measurements and its obtained after some simple passes from the equation where M is the molar mass of air g is the acceleration of gravity 2 9.80665 m s g = and R is the universal gas constant The sensor used in this research is the "Bosch Sensortec BME280". This digital sensor can measure atmospheric pressure, air temperature and humidity. The low power consumption of 3.4 μA and small dimensions (2.0 × 2.0 × 0.8 mm) allow easy implementation [21].

Data acquisition platform
The data acquisition platform (DAP) is an Arduino [22]-based board, constructed especially for this research. The solution with a single DAP, rather than carrying out individual flights with every sensor, was chosen in order to measure the flight altitude with the same flight conditions for each sensor and to ensure gathering only the relative differences between the sensors, and not those due to ground path, relief or any other time and place related change. It is equipped with four different sensors, which have been already mentioned, and it is attached under the aircraft, with sensors facing down.

Figure 2. The data acquisition platform
The platform (Figure 2) is made for measuring and gathering data about the quadcopter flight altitude and storing the data on the SD card for further analysis. The sensors used are, as mentioned before, the ultrasonic rangefinder "HC-SR04", the barometric sensor "BME-280", the LiDAR "Garmin LIDAR-Lite V3HP" and the infrared rangefinder "Sharp GP2Y0A710K0F".  The DAP is connected to the battery through the DC-DC voltage converter, considering that the battery has a nominal voltage of 14.8 V and the Arduino board has 5 V input voltage. All sensors are connected to the Arduino Nano board for power supply, control and data communication. For signalling and error visualisation from the ground a LED is installed on the DAP, controlled by the Arduino Nano board. The electric scheme of the DAP is shown in Figure 3.
Before take-off, at the beginning of the measurement, the static temperature 0 T and the pressure 0 p are measured and stored in the processor memory by pressing the apposite button on the DAP, which is then signalled by the appropriate preprogrammed LED flas-hing code. Those data are later used as zero altitude reference values for the altitude measurements calculations of the barometric sensor. It is important to mention that the ultrasonic module uses temperature and humidity data from the "BME 280" sensor measurements, for correction of the value of the speed of sound for those specific conditions, in order to calculate the exact flight altitude measured by the ultrasonic sensor.

METHODS AND DATA ACQUISITION
The method for controlling the sensors and collecting data uses Arduino Nano board integrated with sensors on a DAP. In order to obtain the most accurate possible measurements, the sensor parameters were made changeable. The correlation between measured and true altitude and mean squared errors for every sensor was calculated in order to assess the sensor accuracy.
All the filtering of the measured data was done by the DAP (with integrated Arduino Nano board) and the data stored on the SD card were ready for use and analysis. It is important to mention that the ultrasonic, infrared, and LIDAR sensor have different sensitivity to colors, textures or relief of the obstacle that is being detected, while barometric sensor is influenced by the atmospheric pressure, air temperature, and humidity, which obviously influences the measuring of the flight altitude. To minimize these influences and to set the sensors for this specific application, fine settings had to been made for every sensor. The initial sensor testing was made with DAP fixed to a stand with changeable height, which results are shown in Figure 4, and later the DAP was attached under the aircraft. All airborne measurement experiments were executed on fair days, without the wind, in order to minimize the errors and influence due to atmospheric condition.

The Arduino code
For programing the Arduino Nano board, the code is written in the original Arduino IDE (Integrated development environment) software. The Arduino code uses already prepared libraries as a part of the code for controlling the sensors [23]. The architecture of the code was designed with the previously determined requisite of easy parameter changing, in order to reduce the time between the flights for system adjustments and to enable simplified code management as possible [24].
For barometric altitude estimation, the Kalman filter [25] has been used for filtering the pressure data before converting into altitude, for this work the equation (1) is used, in order to make the barometric altitude measurements more accurate and to filter the false measurements. The Kalman filter was optimised for this application, and the focus was on the altitude measurement delay (the response of the sensor to aircraft altitude change) and the accuracy of the measurement. For better sensor performance of the BME280 sensor, it was possible to change the sensor functioning mode, the number of samples for temperature, pressure, and humidity measurements, the filter mode, and standby time. The signal LED and the 0 0 p T reset button were also included in the code. For the ultrasonic altitude estimation, the calculation of the precise speed of sound value was needed and it was included in the code: 331.4 0.606 0.0124 In (6) a represents the speed of sound in m/s, T is the temperature, and h is the air humidity percentage. The temperature T and the humidity h are estimated by the BME280 sensor before each altitude measurement. In order to achieve a more accurate measurement, the HC-SR04 ultrasonic sensor library allows the possibility to change the number of ultrasound travel time measurements -ping, for the arithmetic mean calculation, which is the final time that is used for calculating the altitude.

Data acquisition
The quadcopter altitude measurements are executed using the DAP during the flight of the quadcopter ( Figure 5). The DAP sensors start measuring the altitude with a pre-flight changeable delay, after the platform is turned on.
The flight was conducted in a way that is as smooth as possible, with no abrupt manoeuvres, mainly in a vertical direction, in order to avoid problems with sensor position on the DAP. Because of the limitations of the infrared and ultrasonic sensor, the altitude was limited to 4 meters. The ground relief was plain, with low growth green garden grass.
Every set of measurements contains the four altitude values from each single sensor, and it was done almost contemporary, with a 10 milliseconds interval between every single sensor measurement, which allows to neglect the quadcopter flight speed related influence on the results. The measuring period for every set of measurements was 1 second.
Both intervals of time can be changed and adjusted if needed. The four altitude values from each sensor are stored on the SD card, for further analysis.

Data analysis
During one quadcopter flight, which lasted for about 5 minutes, a total number of 290 sets of measurements have been taken and stored on the SD card. The Microsoft Excel tools were used for visualisation of the altitude measurements from the sensors and for data analysis. In order to compare the data from the sensors, it was necessary to have the altitude reference value, and the arithmetic mean of the four altitude measurements was taken as the true altitude. For describing the functioning quality of sensors, the correlation between the measured values and the true altitude and the mean square error was considered [26]. The correlation coefficient was calculated for every sensor, considering all measurements, using the (7).
where r is the correlation coefficient, X are the average observations of the variable X, and Y are the average observations of the variable Y. The variable X is the measured altitude, and the Y is the true altitude. Also, the mean squared error [26] was calculated for every sensor using the (8): where i x is the single altitude measurement and ˆi x is the true altitude in the specific instant of measuring (for that set of measurements). The (8) can be written in shorter form:

RESULTS
During the multirotor flight, the altitude measurement data have been collected. The flight altitude did not exceed 4 meters above ground, in order to stay within the range limits of the ultrasonic sensor. The data from the total number of 290 sets of the altitude measuring were then passed to a computer for analysis and graphic representation. The graph in Figure 6 represents the measured altitude by the infrared sensor (IR), ultrasonic sensor (US), barometric sensor (BAR), and LiDAR vs. time, since the measuring period was 1 second. The graph shows that the difference between the minimal and maximal values, measured with different sensors for one set of measurements, doesn't exceed 0.5 meters, which is a satisfactory result for this type of application. The graph also shows the relative delay of the measured value by the barometric sensor, due to Kalman filter application, which was optimised for this research as the optimal solution between the altitude measurement delay and the accuracy of the measurement.
The correlation coefficient is shown in Table 2. It can be seen that the best correlation coefficient, as a result of this experiment, has the GARMIN LIDAR-Lite v3HP sensor, followed by the ultrasonic HC-SR04 sensor.
The mean squared error shown in Table 3 confirms that the LiDAR sensor has shown the best performance in this experiment. The LiDAR sensor was the most expensive sensor used for this research, and it could be said that the result was expectable. The second-best sensor HC-SR04 costs around 3 USD, which is 43 times less than the LiDAR sensor, which could, in some projects, have a critical impact on the decision-making process.

CONCLUSION AND FUTURE WORK
The common requirement during a multirotor flight is altitude determination on low altitude flights, and this research contributes to the altitude sensing problem by comparing different altitude sensors and offering the optimal sensor for this type of application. During this research real-time measurements and computing were executed using the Arduino platform, in order to achieve greater accuracy in measuring altitude. The goal is achieved by measuring the altitude during a multirotor flight with four different sensors, applying different methods of filtering, and comparing the sensors correlation coefficient and mean squared errors with a reference altitude values. It can be concluded that GARMIN LIDAR-Lite v3HP, with a correlation coefficient of 0.97 is the best sensor for this type of application, followed by the ultrasonic HC-SR04 sensor, with a correlation coefficient of 0.96. It could be supposed that the mentioned LIDAR sensor would offer the best results, since it contains hardware and software subsystems that enhance the measurements.
The LIDAR sensor was also the most expensive sensor used in this research. It should be noted that the commercial price of the second-best sensor is around 40 times of the first ranked sensor, which can be of great importance in some situations.