Section 3: Control Utilities.

==================== Control Utility 2: =======================

.......... Altitude Measurement & Landing Control .............

Altitude measurement and control is key for the flight of an autonomous drone. Next to an accurate altitude while cruising, precise altitude information is required for a smooth landing. Altitude measurement can be achieved in various ways. The following methods will be discussed:
1: GPS altitude in meters above sea-level.
2: Barometric Air-presurre measurement.
3: Ultrasound technology.
4: Laser technology.

Add-1: GPS-Altitude
Next to time and position info, the NMEA Scentence GPGGA also provides altitude in meters above Mean Sea-Level. Unfortunately the accuracy of this value is rather inaccurate and generally in the order of 1.5 times the horizontal error. For low-cost GPS receivers this latter error may be as high as +/-15 meters. An elevation error of +/-20m may be expected. Such an error may be acceptable when cruising at higher altitudes (around 100m), is however unacceptable when flying near ground levl, or landing.

Add-2: Barometric Pressure
At the start of a flight the barometric pressure at ground level is recorded by the relevant call in the Set_Up.ino function. With increase in altitude the airpressure decreases relative to this pressure at start. As a rule of thumb, valid for the first 1000m, the barometric pressure decreases 1mbar(=1hPa) every 8m increase in altitude. High sensitive low cost sensors are available on the market and able to measure small pressure fluctuations. Unfortunately barometric pressure is not constant and fluctuates with weather conditions. This makes precise altitude estimates from barometric measurements for a longer period of time difficult and unreliable. When for example cruising at an altitude of 1000m a variation of +/- 0.5mbar e.g. +/- 4m is not a problem. A number of Arduino compatible highly sensitive digital pressure sensors have been tested. Because of highest stability the Bosch BMP280 (Sec5 [Ref.12]) has been selected for barometric altitude control. The code, published by Bosch in the Data-Sheet is used for barometric measurement and altitude determination. The source-code can be found in Sec4: "17_Get_Altitude_from_Baro.ino"

3: Ultrasound technology.
Ultrasonic ranging modules like the US-026 are able to accurately measure the flight altitude to the max.height of 7m, within at a typical accuracy of several centimiters. It is clear that this sensor can not be used for controling cruising at greater altitude. However ultrasonic sensors can control the landing near ground level from something like 5m downwards. Ultrasound needs a fairly large, smooth, flat surface for proper reflection. The ultrasound signal spreads out in a cone specified at 15 degrees, and objects in the reflection area can interfere with the measurement. You canít always be sure about the surface from which the sound reflects. It should also be noted that ultrasonic sound is sensitive to cross-wind. This all can lead to errors in altitude.
Sensors like the HC-SR04, the US-026 or GY-US42 work best at 5V supply. It should be noted to savely communicate with the 3.3V Teensy micro-processor a levelshifter has to be added.

4: Laser technology:
According to the specs of TOF laser ranging sensors like VL53L1X is the max.range linited to 4m. It implies the sensor can not be used for flight-control during cruising, however may be well suitable for landing control. This needs to be investigated.

Taking off:
At start of the flight program, the set-up function records the barometric pressure in mbar. Based on the 1 mbar airpressure decrease with 8m increase in height, the P-setting of the Altitude PID-controler is by the flight program pre-set to an airpressure decrease of 25mbar. This will result in a straight climb of the drone to an altitude of 200m. From that level onwards pitch, roll and yaw control is switched-on, and the drone will continue to climb to the pre-set cruise altitude, however now fully controled by the flightcontrol software, with heading control direction target.

Landing:(What goes up will come down!)
Once the drone has completed its delivery mission, it will return to the landing location as specified in the flight program. The landing function will kick-in. The engine rpm will gradually be reduced, what results in a slow decent in altitude. At the altitude of 5m, reported by the ultrasonic sensor, the engine is switched off an the drone lands in soaring mode with aileron control only.

Free-Drones Company 2022