DEF presents the proof of concept on using the BME688 gas sensors on a drone sensor platform for monitoring and classification of harmful gases emitted from soil after fertilization.
Harmful gases In agriculture, a major problem is the excess nitrogen from fertilization, which enters the air as ammonia (NH3) and nitrous oxide (N2O). Ammonia significantly damages land and water ecosystems through acidification and nutrient enrichment. Nitrous oxide is a greenhouse gas that is around 300 times more harmful to the climate than carbon dioxide. Lowering of the nitrogen excess especially at the soil surface leads to an increase in amount of nitrogen for the nutrification of the plants. Fertilization monitoring is a prerequisite to lower air pollution and to get a more efficient nutrification. Up to now there is a lack of spatially and temporally resolved data and a reliable database on ammonia emissions after the application of fertiliser.
Monitoring The emitted nitrogen excess is required to be monitored on ppm or even below ppm-level. State of the art are laboratory analysers which are rather bulky, expensive, time consuming and do not deliver real time monitoring. Resistive Metal OXide semiconductors (MOX) sensors are available on the market for decades and are known to provide the required high sensitivity. However, the selectivity is low, as the MOX sensors show sensitivity for all Volatile Organic Compounds and many other gases. However, the availability of the BME688 with BME-AI Suite provides a tool to solve the selectivity problem. Giving application engineers access to control the integrated temperature modulation of the MOX sensors represents a real breakthrough. It provides a unique fingerprint characteristic of the gas specimen.
Drone Platform A mobile platform for real-time monitoring of nitrogen excess in three-dimensional space above the fertilized soil is proposed. As a rover crossing the field has great impact on the soil and fertilizer distribution, a drone is chosen to be the adequate mobile solution. However, as the drone circulates a lot of air and influences the micrometeorological situation during the mission, the MOX sensors are suspended four meters below the drone platform and the drone hovers in about five meter over ground to monitor nitrogen excess.
Impact Lower nitrogen excess means lower pollution, addressing the green deal. An improved calculation of the nitrogen emission flux factor has a strong impact on economic issues. A lower nitrogen excess directly results in better nutrification of the plants and a more efficient use of the fertiliser. This is a great ecological and economic impact for farmers and other stakeholders.
Motivation The basic motivation is coming from the opportunity to design a sustainable engineering project supporting the green deal. The availability of the NXP HoverGames drone for 3D-exploration of the atmosphere above soil in combination with the provision of the BME688 gas sensor DevKit and the Bosch Artificial Intelligence (AI) Studio boosts the project concept proposed. These kits prevent to start from the scratch in UAV navigation, sensor data perception and Artificial Intelligence. Furthermore, the team of five application engineers wants to meet the technology challenge by bringing together complementary expertise in navigation of drones, exploring MEMS devices and Artificial Intelligence.
The Full StoryThe overall objective in DEF is to monitor and classify nitrogen excess after fertilisation with a drone as mobile platform. The nitrogen excess strongly varies in time and space, depending on the micrometeorological weather conditions and the parcel of land. However, as DEF is a short term project we explore the NXP HoverGames drone (WP1-WP3) and the BME688 MOX gas sensors (WP4-WP6) only. First of all, the use case is defined and requirements are given. Next, we present the developments for an autonomous mission with geo data and picture logging and sensor data labelling (WP1), hover on the spot supported by a ground distance sensor (WP2) and a dedicated sensor platform attached to the drone with a four metre fishing line (WP3). A laboratory setup is deployed for gas specimen training (WP4). The micro-hotplate integrated gas sensors enable heater profile exploration (WP5). The training data sets are recorded and algorithms are evaluated with the AI Studio (WP6).
Use CaseExcess Nitrogen from soil is either emitted as N2O or as NH3. Compared to ammonia there is only a minor influence of the atmospheric N2O partial pressure on the N2O-outgassing. This is why it is possible to measure the increase in N2O concentration in closed chambers placed on the soil-ground. However, this doesn`t work with NH3. The NH3 emissions are required to be measured in ambient air over the soil, which represents an excellent scenario for drones being mobile in 3D. The challenge of this short term project is to classify NH3 in a first proof of concept. If successful, major challenges are remaining to classify the nitrogen excess containing NH3 as well as N2O. In agriculture, for the first application of synthetic fertilizer in spring Urea Ammonium Nitrate (UAN) is used containing nitrogen for nutrification of the plants. UAN is a colorless liquid mixture of ammonium nitrate, urea and water. NH3 volatilization occurs when ammonium is converted to NH3 and lost to the atmosphere. The higher the soil pH level and temperature, the more NH3 is emitted. If the conversion takes place at the soil surface, losses are highest. These conditions are met when the fertilizer is spread and not immediately incorporated. A more detailed explanation on the transformations of fertilizer in soiI is shown in figure 1.
RequirementsWP1 The objective of the ammonia and nitrous oxide emission studies is often to develop advanced manure treatments and application methods of fertiliser. The emission very much depend on the soil and the weather conditions. This means logging of geo data and pictures for a parcel, including soil information from the farmer during the gas emission monitoring is required. State of the art in estimating ammonia emissions is a micrometeorological method, the so called Integrated Horizontal Flux (IHF) method, described in more detail below. This method uses gas concentration and wind speed measurement at different heights above soil. According to this the main requirement in this project is to deploy an autonomous mobile platform equipped with sensors for monitoring spatially well resolved gas data in 3D-space. A rover enables 2D data only. Moreover, a rover is disadvantageous due to its interaction with the soil while driving. Therefore a drone is required in an autonomous mission with setpoints to hover on the spot, geo information data, a picture of the parcel and the exact time to trigger gas monitoring, later referred to as labelling.
WP2 The FMU comes with integrated GPS, Inertial Measurement Unit (IMU) and pressure sensor for input to the Extended Kalman Filter (EKF2) on board. This is almost perfect for the flight mission. The FMU integrated GPS reports in latitude-longitude-altitude coordinates coming from the World Geodetic System as input for the EKF2. These models depend on shape-models of the earth Reference Inertial Navigation Primer. However, as according to the IHF method high accuracy altitude above ground is required, the use of anadditional sensor as EKF2 input for ground distance estimation is proposed.
WP3 For monitoring ammonia volatilisation the assembly of gas sensors on the drone has to be specified. In a test flight the ambient air vortex produced by the drone is shown to have influence on the micrometeorological parameters up to four meters below the drone. It is required to develop a gas sensor system platform, which is located four meters below the drone platform. In addition gas sensors have to be protected against impact from weather conditions.
WP4 The BME688 Dev-Kits with high sensitivity MOX sensors combined with Heather Profile Exploration and AI-algorithms are ideal for the gas monitoring proposed. The question arises whether the drone with relatively high power consumption is an adequate platform for gas sensor training. This is explored by a test flight with the HoverGames drone. After about eight minutes of hovering on the spot the battery is almost down. Therefore training in the lab simulating the fertilisation is proposed. Alab setup for ammonia gas specimen training is required.
WP5 The very new with the BME688 is to perform application engineering with an own use case by the ability to produce suitable fingerprint resistance profiles of the sensitive layer of the gas sensor. This is enabled by exploring different temperatures produced by the micro-hotplate underneath the sensitive layer. Bosch provides us with a multitude of Heater Profiles. The task is to find out the Heater Profile that best fits to the use case of ammonia monitoring.
WP6 The requirements for ammonia gas specimen training and validation are to produce an adequate amount of training data sets, an appropriate method of training in the lab under realistic conditions and to vary the measurement environmental condition according to the realistic situations on the field after fertilisation.
WP1 - Autonomous drone missionDrone assembly The assembly of the HoverGames drone and components, e.g. the radio controller setup, the PX4 configuration with QGroundControl and the FMU programming, are implemented following the HG Drone User Guide on Gitbook. These instructions are well presented in written and video form. For the GPS antenna and the telemetry radio additional assembly from Thingiverse is printed. During assembly the antenna support structure provided by the drone kit was damaged. Therefore we printed and replaced it by a design from Thingiverse. All parts are printed with state of the art thermoplastic material PETG, as it offers good mechanical properties. The complete DEF drone is shown in figure 2.
Drone mission An autonomousdrone mission is enabled with the FMUK66 supplied with the NXP HoverGames equipment. However, an onboard computer mounted on the drone platform is required during nitrogen excess classification on the fertilised fields, especially for exchange of information with the FMU. In DEF we propose to label new gas specimen with geodata and picture information while hovering on the spot. More computational load is required in future when enabling sensor data fusion algorithms from a multitude of BME688s with the goal to improve nitrogen classification by taking into account micro-meteorological models and data given by BME688s pressure, temperature and humidity sensors. NAVQ+ assembly The NAVQ+ computer first of all is assembled to the drone with a 3D-printed mounting plate. The design is downloaded from Thingiverse. The NavQ+ is fixed by two 20 mm spacers and custom made shims just above the FMU, figure3.
FMU settings Now the flight controller FMUK66 is connected with the NAVQ+ computer via UART. There was some delay in providing an adequate documentation in Gitbook NAVQ+. However, in the mean time the information is helpful. To enable data exchange between flight controller and onboard computer, the MAVLink protocol is usually used in the PX4/Arducopter context, Gitbook RDDRONE-FMUK66. This protocol is independent of the transmission mode. A simple, but relatively slow connection is realized using an UART interface. Three directly configurable serial ports GPS, TELEM1, TELEM2 are default in configuration of the HoverGames drone. Two of these ports are already occupied by the GPS system and the telemetry link. TELEM2 is free to be configured for a serial interface. The used baud rate must be set according to the 8N1 definition. We propose to use 621600 baud. Required settings are to be found under "Serial" SER_TEL2_BAUD: 921600 These settings represent the interface settings of the FMU, but not the MAVLink instance required for communication. The instance provides an interface between external devices and the flight controller's own communication structure uORB. To enable communication with the NAVQ+, the MAVLink instance has to be set according to the setting options and explanations of the MAVLink instances. The most important settings are the hardware interface (TELEM2) and the transmission mode (onboard).
MAV_1_CONFIG: TELEM2
MAV_1_MODE: onboard
MAV_1_RATE: 80000
MAV_1_FORWARD: True
The transmission mode defines which data are transmitted to the NAVQ+. This setting is related with the maximum achievable data rate of the transmission mode (Serial/UART) and the maximum achievable transmission frequency. The slower the connection, the lower the transmission frequency. The more different data to be transmitted, the lower the transmission frequency. The settings are not further optimized for our use case, as real-time transmission of sensor data is not needed. For improvement a faster connection type like USB or Ethernet is recommended. For the physical connection between FMU and NAVQ+ another cable is needed. On the FMU side a 4 pin connector is used. Please note that the VCC pin should not be used, as a supply voltage of the FMU via the NAVQ+ or vice versa leads to errors. Both devices are powered directly from the system battery. The serial interfaces of the NAVQ have 6-pin connectors, with the same pinout as the Serial1 of the FMU. To enable communication TX_FMU and RX_NAVQ+, RX_FMU and TX_NAVQ+ are connected.The NAVQ+ has three serial ports. However, two ports are available for communication with the FMU only. In this project we propose to use UART3, orange in figure 4.
To test if data is send to the serial port you can test with "Screen" on NAVQ+.
sudo apt-get install screen
screen /dev/ttymxc2 921600
If this does not work, the reason could be a wrong cabling or an insufficient authorization of the user. Check if the user is in dialout group:
groups
To make this data available on the companion computer there are several MAVLink APIs. (MAVSDK/Pymavlink/ROS/ ROS2). A quick and easy way to read certain MAVLink messages is pymavlink.
pip install pymavlink
The examples are designed for UDP connections, if in the line e.g. 'udpin:0.0.0:14450' is replaced by 'serial:/dev/ttymxc2', 921600 the serial interface can also be used.
#!/usr/bin/env python3
"""
Example of how to filter for specific mavlink messages coming from the
autopilot using pymavlink.
Can also filter within recv_match command - see "Read all parameters" example
"""
# Import mavutil
from pymavlink import mavutil
# Create the connection
# From topside computer
#master = mavutil.mavlink_connection('udpin:0.0.0.0:14550')
master = mavutil.mavlink_connection("/dev/ttymxc2",921600)
while True:
msg = master.recv_match()
if not msg:
continue
if msg.get_type() == 'HEARTBEAT':
print("\n\n*****Got message: %s*****" % msg.get_type())
print("Message: %s" % msg)
print("\nAs dictionary: %s" % msg.to_dict())
# Armed = MAV_STATE_STANDBY (4), Disarmed = MAV_STATE_ACTIVE (3)
print("\nSystem status: %s" % msg.system_status)
Data logging and labelling The next step is to enable the NAVQ+ onboard computer to label new specimen and log geodata and picture. The BME688 Development Kit consists of an Adafruit HUZZAH32 Feather Board with a compatible BME688 Board, which contains eight BME688 gas sensors. As soon as the board is powered via USB or the JST connector, it starts recording data and storing it on the MicroSD card. The board has two label buttons that have to be pressed by the user whenever a new specimen is to be measured. When the button is pressed, a label tag is added to the measurement data. This allows the measurements to be assigned to the samples of the new specimen during evaluation with the Bosch AI-Studio. To automate this process without having to physically press the buttons on the board, we control the GPIO pin on the Adafruit HUZZAH32 board with a microcontroller (Adafruit QT Py RP2040) connected to button 1 on the DevKit. Pressing button 1 brings GPIO7 to a potential of 0V as shown in the schematics of the BME688 DevKit, figure 5.
It is proposed to control the pin dedicated to button 1. Button 2 is not used here. The software on the ESP32 microcontroller unit (MCU) Adafruit feather board is modified so that the label tag in the raw data of the BME688 DevKit board is incremented by one for each GND level at GPIO7. Figure 6 illustrates the label process for the gas sensor platform with five BME688 DevKits. The DevKits are proposed to be mounted to the gas sensor platform in different heights adapted to a micrometeorological method for measurement of ammonia emitting from soil after fertilisation. More details are given in section WP3.
As soon as the motors of the drone are started, the FMU transmits a 5 V PWM signal with a frequency of 50 Hz and a pulse width of 1000 µs via PWM channel 5. To control the labelling via this channel, we propose the following settings in QGroundControl, figure 7
Thus, by pressing the left button on the back of the drone's remote control, the pulse width of the signal is changed to 2000 µs. This signal is regulated down to 3.3 V via a voltage divider to be compatible with the QT Py RP2040 MCU. The MCU recognises the change in pulse width and sends the label signal (GND level) directly to the GPIO7 pins of the DevKits via an output pin.
from machine importPin, time_pulse_us
from time import sleep
#input pin A0 connected toPWM channel 5 of the FMU via a voltage divider
pin_input = Pin(29, mode = Pin.IN)
#output pin A1 connected to GPIO7 fromDevKits
pin_label = Pin(28, mode = Pin.OUT)
pin_label.high()
#Checks to see ifthe duty cyle changes. If so, sets the output pin toGND.
while True:
value = time_pulse_us(pin_input, 1)
if value > 1100:
pin_label.low()
sleep(1)
else:
pin_label.high()
sleep(0.1)
Geodata and Picture Logging Ammonia excess from fertilised fields is classified by a mission of the drone with setpoints across the field. For each classification the drone hovers on the spot. For the validation on performance of the proposed technology it is of very high importance to save information about the location of the spot. A small program was created using pymavlink for saving the last known GPS localization when a new measurement is triggered and for taking a picture from the environment. The photo is taken by the google Coral Camera supplied with the NAVQ+ computer. The camera is assembled to the drone and aligned to ground. The labelling signal is triggered by the remote control. As channel 9 is connected directly to the PWM output, the MAVLink messages "SERVO_OUTPUT_RAW" or "RC_CHANNELS" are exploited. Whenever the left button at the backside of the remote control unit is pressed, a photo is taken and stored together with the last known GPS coordinates, see Button_trigger.py in the attachments.
The QT Py RP2040 MCU, which is responsible for labelling the measurement data during flight, is attached to the bottom of the drone together with the voltage divider in a custom-made housing. Its power supply is realised via the drone's battery. In conclusion, the NXP HoverGames drone, FMU and onboard computer NAVQ+ fits well with the requirements for an autonomous drone mission.
WP2 - Ground Distance EstimationInformation from satellite signals is used to determine position, velocity and time of the GPS receiver assembled to the drone platform. The GPS receiver calculates the position of the drone platform by trilateration from pseudoranges with a position accuracy on the order of several meters. However, for improving the position accuracy the GPS data are combined with data from an IMU. The FMU of the HoverGames drone is equipped with an IMU with a 3-axis accelerometer and a 3-axis gyroscope. The acceleration and angular rate data are used as inputs of the EKF2, enabling advanced Kalman filtering estimation techniques. This leads to an improvement of the accuracy in position. GPS provides the information in latitude, longitude and altitude. As in our use case the vehicle is only some meters above ground we have to take into account if the ground is hilly. The model of an ellipsoid shape of the Earth used in the World Geodetic System is valid and roughly provides us with the z-position. However, the accuracy on ground distance information is limited. For improved ground distance estimation a MEMS pressure sensor on the FMU board is used. As the drone produces ambient air turbulences during the flight, there is a strong scatter in the pressure sensor data. However, GPS and IMU data are combined with the pressure sensor data in the Kalman filter updating of the position towards ground.
As the use case presented above needs to have high accuracy ground distance estimation for hovering on the spot during nitrogen excess classification, we propose to implement a Time of Flight (ToF) distance sensor. The Terabee TeraRanger Evo 60m is assembled to the drone platform. The two rails of the platform offer the option of a horizontal alignment of the ToF sensor. The mounting is designed with Autodesk-Fusion 360, figure 9. To prevent occlusion by a slipping battery, the ToF sensor has a distance of about seven centimeters from the rail. In addition, the two upper holes of the ground distance assembly provide us with an opportunity to mount the Google Coral camera for autonomously taking pictures during the classification session. Thermoplastic PETG with 0.2 mm thickness and 50% infill is used for printing, as this material has good mechanical properties and UV resistance.
The ToF ground distance sensor is connected via the "I2C/NFC" port of the FMU K66. All required drivers are pre-installed. Only the option SENS_EN_TRANGER in the PX4-sensor settings has to be set to "Autodetect". In QGroundControl, the following settings were used under Vehicle Setup > Parameters > EKF2, where the parameters EKF2_RNG_POS_X/Y/Z depend on the attachment of the ToF ground distance sensor to the drone, figure 10.
A Terrain Following test mission is performed to verify the improvement of ground distance estimation by adding the ToF sensor. In our use case it is expected to have a hilly terrain.
Therefore it is of strong importance to have steady state ground distance control especially for the duration of the nitrogen excess classification. Access to the settings in QGroundControl used in the test mission is given with the appendix ("QGC_terrain_following_setup.params"). The Terrain Following mode is used for a mission of our drone over a terrain with almost constant slope of a hilly surface. This allows us to test the drone in a scenario that was as realistic as possible related to the use case. Figure 12 shows the (x, y) position of the drone. The drone starts on the highest point of the grassland terrain just behind our university. The horizontal speed was limited to 1 m/s. The mission is controlled remotely. After about 112 seconds, the drone reached the lowest point of the terrain, which is estimated to be about 1 m lower compared to the highest point of the terrain. We expect the drone to have steady state ground distance for this mission.
Figure 13 shows the z-position and corresponding ground distance over time for about 112 s from highest to lowest point of the terrain. The blue curve represents the z-position setpoint at 5, 4 meter and a short period at 5, 8 meter respectively. The black curve shows the raw data from the ToF ground distance sensor. The hilly ground is assumed to be the reason of a slight sensor data scattering. However, the ToF sensor failed twice. At two points in time (around second 102 and 114) there is a loss of ToF sensor data.The z-position estimate in Red provided by the Extended Kalman filter (EKF2) follows the ToF sensor data with a slight offset. This is expected according to the settings made in QGroundControl, where the primary source is the ToF sensor data. The z-position estimate from EKF2 is affected by the loss of ToF sensor data. Therefore, a more reliable ground distance sensor is prerequisite in the next cycle of the drone platform design. While the distance of the drone above the ground remains constant, the altitude determined by the GPS (orange) decreases about one meter from the highest to the lowest point. This is expected, as the GPS world model with ellipsoid shape of the Earth and the IMU doesn`t provide local information about hilly terrain.
Figure 14 provides with the raw pressure sensor data in Green. It has to be mentioned that an offset is subtracted to enable qualitative data comparison with the line in Black, which represents the ground distance ToF sensor data. Figure 14 not only shows the mission from starting point to the lowest terrain point, but halfway up to the starting point as depicted in figure 12. The main issue is that pressure sensor data is extremely noisy. The start phase fits well to the pressure sensor data. During the landing phase, the pressure increases with a higher slope than the ToF distance data decrease, which is expected as in addition to the decrease in altitude, the level of the terrain at the end of the mission is about half a meter below the level of the starting point. In conclusion, the reliability of ground distance control with EKF2 estimates from GPS combined with the noisy pressure sensor data is insufficient. A reliable ToF ground distance sensor as input for the EKF2 is proposed to enable precise ground distance control of the drone during the hover on a hilly parcel for nitrogen excess classification.
Based on the use case requirements a gas sensor system platform is designed and realised as a demonstrator. The main components are five BME688 DevKits. Each Kit comes with eight gas sensors type BME688. For protection of gas sensors the Kits are embedded in an orange housing. The sensor platform is defined by the DevKits arranged one below the other with a distance of about 12cm and a small box power unit for the sensors, figure 15. To reduce air turbulence evident just above the soil produced by the drone's rotor blades, the sensor platform is attached to the drone with a four meter long fishing line, which is fixed at the rails and connected to the labelling MCU, figure 19.
The BME688is a System-In-Package (SiP) MEMS device with sensors for gas, pressure, humidity and temperature measurement. It represents a drop-in replacement of the BME680. An Application Specific Integrated Circuit (ASIC) chip with code for sensor filtering and calculation of micro-meteorological quantities like barometric pressure, ambient air temperature and ambient relative humidity is part of the SiP. Overall, the sensing software is dedicated to environmental monitoring of gases, including an Index for Indoor Air Quality monitoring. Because of the projects maturity the resistive gas sensor chip with integrated micro-hotplate is considered here only. First of all the objective is to monitor and classify ammonia excess from ammonia aqueous solution with zero, low, medium and high ammonia concentration with the BME680 gas sensors, figure 16 . The BME688 is a digital with AI version of the BME680 gas sensor, available since almost two years.
The sensitive layer of the gas sensor is fabricated by Metall Oxide (MOX) Semiconductor material, resulting in decreasing resistance with increasing temperature. The micro-hotplate and micromechanical design of the Bosch gas sensor provides a sensitive layer temperature of 50 up to 400 degree Celsius stabilised within less than 140 milliseconds. The MOX sensors are well known for their high sensitivity for organic compounds, e.g. Volatile Organic Compounds (VOC) as well as for inorganic compounds, e.g. ammonia or nitrous oxide. In ambient air oxygen (O2) is adsorbed at the surface of the sensitive MOX layer. As electrons from the MOX layer are captured by the O2 to form oxygen ions, a depletion layer is formed at the surface, resulting in increasing resistance. If molecules of oxidizing or reducing gases are present at the sensitive layer surface, they react with the adsorbed oxygen. Gases, e.g. CO or H2 which reduce the sensitive layer will then lead to more electrons and therefore decreasing resistance, whereas gases, e.g. O3 or NOx bring additional oxygen to the sensitive layer, thereby increasing the resistance. For NH3, which is to be monitored in this project, a decrease in resistance with increasing ammonia concentration is expected due to the reaction of NH3 to N2 and H2 and the reducing effect of hydrogen at the MOX surface.
The BME688 DevKitcomes with eight BME688 gas sensors on the BME688 board (figure 17), an ESP microcontroller on the feather board and the BME AI-Studio. The Kit is dedicated to application engineering. We take this challenge to propose the classification of ammonia excess after fertilisation in agriculture into four classes, with zero, low, middle and high ammonia concentration. The DevKit enables to define a set of temperatures for gas sensor operation. The sensitivity and reaction kinetics of ammonia at the surface of the sensitive layer strongly depends on the temperature provided by the micro-hotplate. By exploring a heater profile with 10 steps at different temperatures in between 50 and 400 degree Celsius a so called fingerprint for the gas specimen under consideration is created. This fingerprint is composed out of the 10 steps. In each step data from one temperature level only is explored. Therefore, the temperature dependence of the semiconductor material resistance is eliminated and purely the chemisorption of the gas specimen is evident. After creation of the greatest possible training and validation data set (WP4), a neural network is trained with the AI-Studio, which after training is ported to the ESP32 MCU (figure 18) for validation and testing (WP5).
The housing of the DevKits is designed according to the guidelines for the Bosch gas sensor BME680. The objectives are to align and fix the DevKit in the housing. Furthermore, the housing prevents damage and the penetration of soil e.g. in the case of a crash to the ground. The housing lid points upwards and protects against rain. On the one hand, there is the protection leading to small openings. On the other hand, good ambient air flow through the openings and avoidance of sticking of ammonia to the housing and gas sensor openings is required. In addition, the housing is designed to protect the sensors against light incidence, as the gas sensitive layer is a semiconductor, changing its resistance with light and therefore increasing the challenge for the AI suite to classify the gases with high accuracy. Another issue is to avoid the usage of housing materials, which are emitting cross-sensitive gases. The material PETG is used for printing, as it has good UV and humidity resistance and has favourable mechanical properties. In order to increase the visibility of the sensor devices the housings are printed in eye-catching orange, figure 17, 18.The housing has cut-outs for all eight sensors as well as for the SD card, the battery connection and the micro-USB connection of the board. Inside the housing are spacers to protect the sensors, to which the DevKits are attached with two M2.5 screws. At the upper end there are two holes in the centre of each side for hanging up the orange kits to the drone, figure 19.
Sensor platform assembly To power the sensors an additional 3000 mAh 1S LiPo battery is used and housed in a custom-made 3D-printed box. A board with 3-pin JST-XH connectors for power supply and label signal is assembled at the bottom of the box, figure 20. The DevKits are wired to the battery and the wire for the label signal is soldered directly to the GPIO7 pin of the DevKit board.
A strong goal in agriculture is to reduce excess of ammonia emitting from the soil after fertilisation. However, to compare state of the art with new improved manure treatments and application methods, methods for quantitatively and qualitatively measure ammonia emissions are required. The most widely used method is a "non-invasive" micro-meteorological technique, which does not affect the ammonia excess flux, the so called Integrated Horizontal Flux (IHF) method, NIFLUM Int. Expert Workshop 2018. With the IHF wind speed and ammonia concentration profiles are measured in different heights typically up to two meters above ground, figure 21, Projekt NH3-Min, 2020-2024.
The design of our sensor platform is adapted to the IHF method, resulting in five measurement spots at different heights above ground. Attention has to be paid to the payload constraints of the drone. We decided to use fishing lines for the attachement, as they are lightweight and have a high tensile strength. Each DevKit is connected to the next one via a loop. The ends of the fishing line are knotted. The spacing between the DevKits is about 12 cm. A test mission has shown the distance of drone to sensor platform to be at least four meters in order to minimise influences on the measurements through air turbulence from the rotor blades, figure 22.
In conclusion, the drone is a suitable mobile platform for monitoring of fields after fertilisation. However, the platform represents a pendulum with low frequency vibrations excited by wind breezes and by the drone's movement. The power consumption of the drone as well as the vibrations make the drone unsuitable for training. A redesign with increased stiffness is proposed for future developments of the drone to be used as mobile platform for monitoring after fertilisation.
WP4 - Setup for Ammonia Gas Specimen TrainingFour ammoniagas specimens Ammonia dissolves easily in water and is commercially available as a 25% aqueous ammonia solution. The Bosch AI Studio allows the specimens to be characterized in a maximum of four classes. Thus we decided to prepare specimens with different ammonia gas concentration emitting from a ceramic bowl with aqueous ammonia solution (figure 23) designated as Water, Low Ammonia, Middle Ammonia and High Ammonia specimen.
Safety The exposure to ammonia is considered a high health hazard because it is corrosive to the skin, eyes, and lungs. It is toxic if inhaled and the exposure to 300ppm is immediately dangerous to health. Most people can smell ammonia between 0.04 to 20 ppm.
TheLab A laboratory setup is deployed under a fume hood in our chemistry lab at the University of Applied Sciences Westphalia, figure 24. When handling ammonia the team is wearing safety goggles, rubber gloves and a full-length, long-sleeved laboratory coat. The aqueous ammonia solutions in the non-corrosive PVC containers are stored below eye level in a corrosives compatible vented cabinet, on the right side of the figure 24. In the case of exposure of skin or eyes to ammonia the lab provides water showers. The volume flow rate in the fume hood is about 420 cubic metres per hour, which corresponds to a very light wind breeze.
Aqueous ammonia solution Commercially available 25% aqueous ammonia solution is used and diluted to prepare aqueous ammonia solutions emitting different ammonia gas concentrations. The dispenser (Dispensette S Digital) with backflow valve for 5-50ml is a suitable tool to prepare the aqueous ammonia solutions.
- Water, 0 % = pure water
- Low, 0, 01 %= 100 ppm ammonia, 0, 006 mol/l solution
- Medium, 0, 1 % = 1000 ppm ammonia, 0, 058 mol/l solution
- High, 0, 2 % = 2000 ppm ammonia, 0, 116 mol/l
Ammonia Gas Concentration It is a real challenge to calculate the ammonia gas concentration emitting from the aqueous ammonia solution filled bowls. For the short term project DEF it is not feasible to solve this multiparameter task. The gas concentration above the surface of the bowl is proportional to the ammonia concentration in the aqueous solution via Henry's Law. However, the gas concentration depends very much on the surface area of the aqueous solution, the temperature and ambient air velocity in the fume hood and ambient air pressure. In a first estimation the ammonia gas concentration emitting from the bowl is expected to be smaller by a factor of about 10 up to 100 relative to the ammonia concentration in the aqueous solution. A commercially available reference instrumentation is needed. We decided to work with the Ammonia Gas Detector AR8500 from Smart Sensor, which is widely used in the agriculture community. This handheld device operates an electrochemical sensor in the range of up to 100 ppm ammonia gas. The smallest distinguishable change the sensor can detect is 0.1 ppm. The accuracy is +/-2 %. One has to wait about two minutes to get a stabilised reading (T90 time). After stabilisation the following gas emissions are measured for the four classes:
- Water: 0 ppm ammonia gas
- Low: 0, 3 ppm - 2 ppm ammonia gas (100 ppm solution)
- Medium: 10 ppm - 80 ppm ammonia gas (1000 ppm solution), figure 26
- High:20 ppm - no evaluation due to handheld range (2000 ppm solution)
The challenge in using MOX gas sensors is to ensure the sensitivity and selectivity required for our use case. This means monitoring of ammonia gas with concentrations in the ppm range in the presence of other gases like nitrous oxide in ambient air after fertilisation. For hydrogen sulfide, ethanol, carbon monoxide and breath-Volatile Organic Compounds the selectivity and sensitivity is reported in the BME688 Datasheet. However, ammonia and nitrous oxide is not reported. Therefore, first of all the sensitivity to ammonia gas in ambient air is to be sufficiently clarified. The classification of specimen with various ammonia concentrations emitting from bowls filled with water and aqueous ammonia solution in four classes with the label Water, Low, Middle and High are reported in WP5 and WP6. In conclusion a setup in the lab with realistic conditions for data recording is built up.
WP5 - Exploration Heater ProfilesInitial round - Out of the box In a first approach we start measurements with the out of the box configuration (Default Configuration), to get a base idea from what we can expect. The Default Configuration includes a Heater Profile (HP) and a Duty Cycle (RDC). Within a Heater Profile 10 temperature steps are specified. The sensitive MOX layer is operated at these different temperatures to enable sensitive fingerprint creation of various ammonia concentrations. During the Scanning Cycle the sequence of 10 temperature steps, with a time base of 140ms is performed. The control is executed in the BME688 System in Package ASIC. It also provides us to put the sensor into sleep mode. During a Sleeping Cycle the sensor does not perform any measurement. The Duty Cycle is a repeated sequence of a defined number of Scanning Cycles followed by a defined number of Sleeping Cycles. An excellent documentation is given with the BME AI-Studio manual. The BME688 board is pre-configured with the Default Configuration HP-354, shown in figure 27, and RDC 5-10 defined by 5 Scanning Cycles and 10 Sleeping Cycles. First recordings and trainings are performed with the date and exact time of the recording and logging of lab temperature. The ammonia concentration is measured in regular intervals with the electrochemical reference gas detector AR8500. There are three main observations. Some of the resistance data measured with the BME688 sensors are clipping for temperature steps below 100 degree Celsius, figure 28. Clipping results from resistance data, which are above the threshold of the internal analog-to-digital converter. The data are out of full scale output. The AI-Studio manual addresses clipping by an option called "Apply clipping prevention", which allows to filter the data used to train the algorithm. If this option is enabled all data points recorded with a step below 125 degree Celsius will be ignored for the training. We do not use this option, as clipping effects can confuse trained algorithms, e.g. AI-Studio manual "especially if the algorithm is trained with relatively new sensors (without clipping) and later run with aged sensors (with clipping). Instead we are looking for the Heater Profile which best fits to our use case. There is a large change in resistance when opening the fume hood to bring the handheld in reference position over the bowl. This is explained by an ambient air flow and dilution of the ammonia concentration nearby the sensor. Last but not least, less data and information are available during Sleeping Cycles. These observations results in
- Heater Profiles with low temperature steps close to clipping effects are not considered any more in the exploration for the best fit to the use case, as clipping of the resistance data is a feature of the sensor and not of the gas specimen.
- At this stage of maturity of the project realistic conditions coming from wind and weather on the field or changing background in the lab fume hood will not be considered. Therefore the gas measurement sessions will take place without opening the fume hood, having a constant ventilation.
- As well power consumption consideration by putting the sensor into a sleep modus is too early at this stage of proof of concept. In the following we work in continuous Scanning Cycle mode without any Sleeping Cycle.
Default Heater Profile Exploration The goal of this first full exploration is to operate the sensitive MOX layer at different temperatures to enable sensitive fingerprint creation of various ammonia concentrations. We test the default Heater Profiles HP-354, HP-301, HP-411 and HP-501, which are shown in figure 27. The HP-354 explored in our initial round is the default HP. The HP-301 shows the same temperature steps but time steps and distribution are different. The HP-411 has different temperatures and two very short (280 ms) temperature steps in between. The HP-501 shows lots of different temperature steps.
The measurement sessionismade with ammonia gas concentrations emitting from the ceramic bowl (setup in figure 23) with aqueous solution of 100 ppm, 1000 ppm and 2000 ppm and a bowl filled with pure water. The air ventilation is on. The temperature in the fume hood is around 23 degree Celsius. The water measurements lasts for 10 minutes in between the ammonia measurements. Each specimen measurement takes 30 minutes, which results in a total of two hours including water intervals. At the beginning, a considerable 10 minute waiting time is respected, until the sensors stabilize. The measurements are time catalogued and repeated for more data gathering and background variations. The resistance fingerprint over time is shown in the figures 28. The Blue line denotes the start of a new specimen. Overall the results are
- The higher the ammonia gas concentration, the lower the resistance.
- The higher the ammonia gas concentration, the higher the scatter.
The specimen data of class Water needs 10 minutes and more to stabilize. This may be due to reaction kinetics of oxygen chemisorption at the sensitive layer grain boundaries. However, as expected the specimen data of class Low shows a lower resistance, which could be explained by reaction of NH3 to N2 and H2 and reduction of the chemisorbed oxygen at the sensitive layer by the H2. This effect is even more pronounced for the specimen data of classes Middle and High. The high scattering at high concentrations is may be explained by contaminations of the bowls and sensors with ammonia. It is a known fact that ammonia gas sticks everywhere.
The next step is to train the algorithm with the BME AI-Studio for resistance feature interpretation. The specimens are labelled and the data of all classes is split into two parts. The training data are used to train the neural net. The algorithm defines the weights and biases of the neural net. To train we use 70% of the data from the two hour session. 30% of the test data are used to test the performance of the trained net. The data of the first 10 minutes are not part of the training and testing data, as the sensors stabilise in this phase.
The confusion matrix in figure 29 shows the result on performance of the trained net. The HP-301 and HP-501 show a much better accuracy than the other two Heater Profiles. However, one of the temperature steps in HP-301 shows the clipping effect. As mentioned above this may confuse trained algorithms, we decided to not consider any longer the HP-301. Therefore heater profile HP-502 remains.Improved Heater Profile Exploration As we try to find out the profile that best fits to the use case of ammonia monitoring, we decided to perform an improved Exploration with one of the Heater Profile sets proposed by Bosch, the HP-50x. Figure 30 shows the Heater Profiles HP-501, HP-502, HP-503, HP-504 with a lot of different temperatures. The 10 steps of the four Heater Profiles differ in time and temperature.
The procedure and background conditions for the measurement session with HP-50x is the same as for the default Heater Profile Exploration. The resistance fingerprint over time is shown in the figures 31. However, the introduction of an end of measurement line is new. The start is marked by the Blue line and stop by the Red line. The data in between will not be considered in the training and testing. Some of the steps again show resistances in saturation. Overall again the main result of lower resistance and higher scatter for increasing ammonia gas concentration is shown. The lower resistance value of the water classes, which are obvious in some of the data, is possibly due to ammonia contamination of the water bowl. For the next sessions we ensure conatminant-free bowls.
The next step again is to train the algorithm with 70% of the data and to test the performance of the trained net with 30% of the data. Again, the data of the first 10 minutes are not part of the training and testing data. The confusion matrix is shown in figure 32.
The Heater Profiles HP-50x are clearly in favour compared to the performance of the trained net to the one of the Default Heater Profiles. The accuracy is rather high being above 90% for three of the four HP-50x Profiles. The Heater Profiles HP-503 and HP-504 show clipping. Therefore, they are not any more considered for the best fit to our use case. The same happens to HP-501, even if the resistance data doesn`t show direct clipping. However, clipping may be happen in future for HP-501 if data are so close to the clipping threshold. In conclusion, we decided to select Heater Profile HP-502 for the best fit to our use case.
WP6 - Ammonia Specimen Training and Validation of Trained NetAfter Heater Profile Exploration training of the neural net with a larger amount of training data is required. New aqueous ammonia solutions are provided. The lab setup for the training is same as for the Heater Profile Exploration. The final training Heater Profile HP-502 is applied to each of the eight BME688 sensors, figure 32.
The resistance data are recorded with ammonia specimens from the four classes. After approximately one hour sensor stabilisation with the eight sensors above the water filled bowl, each specimen is recorded for one hour. Two measurement session are carried out on two different days with three days apart and identical setup. However, the temperature, relative humidity and ambient pressure in the lab are different. As well the situation varies because of background conditions like fume hood operation. Figures 33 and 34 show the resistance fingerprints of the two five hour measurement sessions.
The data of the first hour recordings are not involved in the training and test data set, as most probably one hour is not sufficient for full stabilisation in ambient air. Comparing the two sessions the resistance data shows great similarity. With increase in ammonia concentration the resistance decreases and data scatter increases. The next step is training the algorithm with 70% of the data and testing the performance of the trained net with 30% of the data of both measurement sessions. Compared to the Heater Profile Exploration measurements we have a factor of about four in the amount of data. The confusion matrix is shown in figure 35. The accuracy of about 81 % is rather high. However, it should be mentioned that prediction of the High and Middle classes is limited.
The final step in this project is to validate the trained net with additional data not used in the training of the net, coming from a measurement session with the HP-502 during Heater Profile Exploration. These data are recorded on another day with other environmental conditions related to lab temperature, relative humidity and ambient pressure and aqueous ammonia solution. The full number of data (780) is used for the test of performance of the 8 hour data trained net.
Considering the situation that test data are coming from non trained data in a varying situation, the performance of the net with about 71 % is excellent. This is the proof of concept of the feasibility to monitor ammonia gas with the BME688.
Conclusion and Future AspectsThe project successfully demonstrates an autonomous drone mission with geodata and picture logging, labelling of sensor data and controlled hover on the spot. A redesign with increased stiffness of the sensor platform suspension is proposed for future developments of the drone to be used as mobile platform for monitoring after fertilisation.
In using the BME688 DevKit with AI-Studio a proof of concept of an innovative instrumentation to monitor and classify ammonia emissions is shown. The measurements in the lab with ammonia gas emitting from aqueous ammonia solution in a fume hood with ventilation shows high accuracy classification of Zero, Low, Medium and High ammonia concentrations. However, the training dataset has to be improved related to amount of data, variation of background situations and introduction of other gases like nitrous oxide. Furthermore the sensors are to be trained on non-fertilised fields with a large number of ceramic bowls with aqueous ammonia solution simulating fertilisation. Last but not least, training in full realistic situations after fertilisation with high sensitive reference instrumentation is to be explored.
In future, the precise calibration of barometric pressure, ambient air temperature and relative humidity from BSEC software is proposed to be explored. Furthermore an anemometer for wind speed measurement as required with the IHF method is to be added to further improve the instrumentation. The NAVQ+ onboard computer will play an important role. The code of the algorithms for sensor fusion of multiple BME688s mounted in different heights above ground and micrometeorological models based on the temperature, humidity and pressure data from the BME688s are proposed to be implemented on the NAVQ+. Furthermore, the NAVQ+ serves as the transmitter for the messages about the ammonia classification to the remote unit or an App on the smartphone.
Main impact to agriculture stakeholders is a new sensitive, selective, non-bulky and low cost instrumentation to compare different manure treatments or application methods under different micrometeorological and soil conditions. This project represents the very first step of development towards the new instrumentation.
...This Was Fun
Comments