GAS SENSOR WITH FIRST AND SECOND ELECTRODES AND A REAGENT FOR BINDING THE TARGET GAS

20230366864 · 2023-11-16

    Inventors

    Cpc classification

    International classification

    Abstract

    A gas sensor for sensing a target gas, the gas sensor comprising first and second electrodes; a support layer between the first and second electrodes; and a reagent on the support layer for binding the target gas, wherein the first and second electrodes are in electrical contact with the support layer and the reagent.

    Claims

    1. A gas sensor for sensing a target gas, the gas sensor comprising: first and second electrodes; a support layer between the first and second electrodes; and a reagent on the support layer for binding the target gas; wherein the first and second electrodes are in electrical contact with the support layer and the reagent.

    2. The gas sensor of claim 1, further comprising a voltage source, wherein the voltage source is configured to apply an electrical potential between the first and second electrodes.

    3. The gas sensor of claim 1, wherein the target gas is an alkaline gas and the reagent is acidic.

    4. The gas sensor of claim 3, wherein the target gas is ammonia or an alkyl amine.

    5. The gas sensor of claim 1, wherein the target gas is an acidic gas and the reagent is alkaline.

    6. The gas sensor of claim 5, wherein the target gas is carbon dioxide, hydrogen fluoride, hydrogen chloride, hydrogen bromide or hydrogen iodide.

    7. The gas sensor of claim 1, wherein the gas sensor is a device for determining a quantity of target ions in a sample, the gas sensor further comprising a container for receiving the sample, wherein the container is fluidically connected to the gas sensor.

    8. The gas sensor of claim 7, wherein the target ions in the sample are ammonium ions, alkylammonium ions, fluoride ions, chloride ions, bromide ions, iodide ions or bicarbonate ions.

    9. The gas sensor of claim 7, wherein the sample is soil, agricultural runoff, river water, sea water, sewage, blood, urine, an extract of soil, an extract of agricultural runoff, an extract of river water, an extract of sea water, an extract of sewage, an extract of blood, or an extract of urine.

    10. The gas sensor of claim 7, wherein the container contains or is fluidically connected to a reagent for converting the target ions in the sample into the target gas.

    11. The gas sensor of claim 10, wherein the reagent for converting the target ions in the sample into the target gas is an acidic or basic solution.

    12. The gas sensor of claim 7, wherein the sample is soil extract, the ions are ammonium ions and the container contains a sodium hydroxide solution.

    13. A method of determining a concentration of a target gas, the method comprising: exposing a gas sensor to a gas sample comprising a target gas, such that the target gas is bound by a reagent, wherein the gas sensor comprises first and second electrodes, a support layer between the first and second electrodes, and a reagent on the support layer for binding the target gas, the first and second electrodes being in electrical contact with the support layer and the reagent; measuring an impedance of the support layer by applying, at a first time, an electrical potential between the first and second electrodes; measuring an impedance of the support layer by applying, at a second time, an electrical potential between the first and second electrodes; and determining the concentration of the target gas based on the impedance at the first time and the impedance at the second time.

    14. A method of determining a concentration of target ions in a sample using a gas sensor device, the gas sensor device comprising a gas sensor, wherein the gas sensor comprises first and second electrodes, a support layer between the first and second electrodes, and a reagent on the support layer for binding target gas, the first and second electrodes being in electrical contact with the support layer and the reagent, the gas sensor device further comprising a container for receiving the sample, the container being fluidically connected to the gas sensor, the gas sensor device being a device for determining a quantity of the target ions in the sample, the method comprising: inserting the sample into the container; mixing the sample with the reagent for converting the target ions in the sample into the target gas, thereby releasing the target gas into the container; measuring an impedance of the support layer by applying an electrical potential between the first and second electrodes at a first time; measuring an impedance of the support layer by applying an electrical potential between the first and second electrodes at a second time; and determining the concentration of target ions in the sample based on the impedance at the first time and the impedance at the second time.

    15. The method of according to claim 14, wherein the reagent is an acidic or basic solution.

    16. The method of claim 14, wherein the determined concentration of target ions comprises a determined concentration of ammonium ions in a soil sample, wherein the gas sensor device is a device for determining a quantity of the target ions in the sample, the gas sensor device further comprising a container for receiving the sample, the container being fluidically connected to the gas sensor, the container containing or being fluidically connected to the reagent for converting the target ions in the sample into the target gas.

    17. The method of claim 16, wherein the reagent is an acidic or basic solution.

    18. The gas sensor of claim 8, wherein the sample is soil, agricultural runoff, river water, sea water, sewage, blood, urine, an extract of soil, an extract of agricultural runoff, an extract of river water, an extract of sea water, an extract of sewage, an extract of blood, or an extract of urine.

    19. The gas sensor of claim 8, wherein the container contains or is fluidically connected to a reagent for converting the target ions in the sample into the target gas.

    20. The gas sensor of claim 9, wherein the container contains or is fluidically connected to a reagent for converting the target ions in the sample into the target gas.

    Description

    [0027] Embodiments will now be described by way of example with reference to the drawings of which:

    [0028] FIG. 1 illustrates a gas sensor for measuring ammonia concentration;

    [0029] FIG. 2 is a flow diagram for a method of using the gas sensor of FIG. 1;

    [0030] FIG. 3 illustrates a device for determining a quantity of ammonium ions in soil sample extract;

    [0031] FIG. 4 is a flow diagram for a method of using the gas sensor of FIG. 3;

    [0032] FIG. 5 illustrates an approach to determining nitrogen levels in soil;

    [0033] FIG. 6 illustrates time series data concerning dynamics of soil nitrogen;

    [0034] FIG. 7 illustrates machine learning models to estimate soil nitrate levels and forecast them into the future;

    [0035] FIG. 8 shows plots of the performance of a range of different paper-based electrical gas sensors;

    [0036] FIG. S1 illustrates calibration curves for ammonium nitrate in water;

    [0037] FIG. S2 illustrates a schematic showing electronics for measuring ionic impedance;

    [0038] FIG. S3 illustrates raw data showing decrease in ionic conductivity (measured as a voltage), as sulphuric acid in a paper scrubber is neutralized by ammonia gas;

    [0039] FIG. S4 illustrates soil-ammonium measurements made in soil fertilized in a variety of weather conditions;

    [0040] FIG. S5 illustrates correlation of dryness with rainfall and temperature;

    [0041] FIG. S6 illustrates prediction of the level of nitrate in soil instantaneously, using supervised machine learning, and both ammonium and nitrate into the future;

    [0042] FIG. S7 illustrates R.sup.2 scores for sets of environmental conditions to find a general regressor to estimate levels nitrate;

    [0043] FIG. S8 illustrates the process of FIG. 7.1 (bottom left) with test inputs from an external lab rather than the inventors' lab;

    [0044] FIG. S9 illustrates prediction of nitrate using a K-nearest-neighbours algorithm; and

    [0045] FIG. S10 illustrates the R.sup.2 score for data in FIG. 7.2, showing soil-NH.sub.4.sup.+ and soil-NO.sub.3.sup.− predicted by LSTM ML model 1-12 days into the future.

    [0046] With reference to FIG. 1, in a first embodiment, a gas sensor 100 for sensing ammonia gas comprises first and second interdigitated carbon electrodes 102/104 (No. C2130925D1 conductive carbon ink, 55/45 wt % with No. S60118D3 diluent from GWENT Group) screen printed onto a chromatography paper support layer 106 (Whatman™, grade 1 chromatography paper, 20 cm×20 cm, 0.18 mm thickness). The electrodes are dried overnight at room temperature to remove excess organic solvents from the electrodes. The design of the electrodes consists of three interdigitated electrodes with 1 mm spacing between each finger. First and second electrode contacts 110/112, also printed carbon ink, respectively connect to the first and second electrodes 102/104 and are used to connect the first and second electrodes to a voltage source when the sensor is in use, to apply an electrical potential between the first and second electrodes.

    [0047] A reagent is provided on the support layer for binding ammonia. The first and second electrodes 102/104 are in electrical contact with the support layer 106 and the reagent. A hydrophobic wax barrier, for limiting the spread of the reagent, surrounds the electrodes 102/104. Wax designs using a Xerox ColorQube 8580 are printer onto Office Depot transparent acetate sheets, then heat-transferred to the support layer 106 with a Vevor HP230B heat press (at 180° C.).

    [0048] In the first embodiment, the reagent is 10 μl of 0.025 M sulphuric acid, which is drop cast onto the support layer 106. In other embodiments, other acids and concentrations may also be used, for instance when the sensor is configured to detect alkaline gases other than ammonia, such as alkyl ammonia gases, or concentrations may by adjusted based on the range of target gas concentrations being measured.

    [0049] In a second embodiment, the gas sensor 100 is for sensing carbon dioxide, and the reagent is 10 μl of 0.025 M sodium hydroxide. Other alkalis and concentrations may also be used, in particular when the sensor is configured to detect acidic gases other than carbon dioxide, such as hydrogen fluoride, hydrogen chloride, hydrogen bromide or hydrogen iodide, and for different target gas concentrations.

    [0050] In use, the sensor of the first and second embodiments is connected to an electronic controller. The controller is configured to apply an alternating electrical potential (10 Hz, 4 V amplitude peak-to-peak) between the first and second electrodes and measure the impedance of the support layer 106. This can be achieved using conventional means well known to the skilled person, for example as illustrated in FIG. S2, which is a schematic showing electronics for measuring ionic impedance..sup.[27] An alternating voltage is supplied (Vin) across the electrodes, and the current passing through measured as a voltage (Vout) with a transimpedance amplifier (implemented with an Operational Amplifier), amplified with a resistor (Gain). There is an increase in ionic impedance (decrease in ionic conductivity) during neutralization of the reagent as the target gas contacts the reagent (i.e. the sulphuric acid is neutralised by ammonia in the first embodiment or the sodium hydroxide is neutralised by carbon dioxide in the second embodiment). As the neutralization of the reagent proceeds, the impedance increases. Thus, a change in impedance is indicative of the presence of the target gas (the concentration of the gas need not be determined) and the sensor may be used to determine the presence of the target gas. Alternatively, the concentration of the target gas may be determined in accordance with the following method.

    [0051] FIG. 2 is a flow diagram for a method of determining a concentration of ammonia gas using the gas sensor of the first embodiment. The method comprises exposing 202 the gas sensor 100 of the first embodiment to a gas sample comprising ammonia. The ammonia is bound by the reagent, changing the impedance of the reagent/support layer 106. The impedance of the support layer 106 is measured 204 by applying an electrical potential between the first and second electrodes 102/104 at a first time. The impedance of the support layer 106 is then measured 206 again by applying an electrical potential between the first and second electrodes 102/104 at a second time. The concentration of ammonia is then determined 208 based on the impedance at the first time and the impedance at the second time. This is achieved by calculating the rate of change of impedance from the first and second impedance measurements. If the rate of change is below a threshold rate of change, it is determined that the reagent is neutralised and the time taken for neutralisation is converted into an ammonia concentration using a calibration curve prepared by measuring the neutralisation time for a range of known ammonia concentrations (previously measured using the gas sensor—a new gas sensor must be used each time). Other ways of determining the ammonia concentration from the impedance measurements are possible, such as determining the rate of change of impedance after a fixed period of exposure of the gas sensor to the target gas, and comparing this with a corresponding calibration curve. This method may also be used to measure carbon dioxide concentration using the gas sensor 100 of the second embodiment, mutatis mutandis.

    [0052] FIG. 8 shows performance for a range of different paper-based electrical gas sensors (PEGS) prepared in accordance with the above-aspects and embodiments. In this instance, the admittance of PEGS is measured when a sinusoidal signal of 4 V and 10 Hz is applied to the sensors. (For A-C) The horizontal axis shows time and the vertical axis shows the relative change in admittance of the sensor in percentage. (For D) The horizontal axis shows the ammonia concentration the PEGS were exposed to and the vertical axis shows the slope/min (of the drop of the admittance value of the sensor in Figure (A-C). (A) shows four PEGS treated differently: one bare-PEGS (blank) and three acidic PEGS (A-PEGS) with different concentrations of sulfuric acid (H.sub.2SO.sub.4) (0.001 M, 0.01 M and 0.1 M), are exposed to 5% CO.sub.2 for 10 minutes. The signal for all sensors increases overtime. The bar plot shows maximal signal changes in a 10 min interval for the differently treated sensors and the error bars indicate the standard deviation for n=3. (B) is analogous to (A): one bare-PEGS (blank) is compared to three basic PEGS (B-PEGS) with different concentrations of sodium hydroxide (NaOH) (0.001 M, 0.01 M and 0.1 M) when exposed to 5% CO.sub.2 for 10 minutes. The acidic gas neutralizes the alkaline pre-treatment and the signal for B-PEGS initially drops. For low concentrations of base (0.001 M and 0.01 M) the PEGS are depleted quickly and the signal starts increasing again. (C) is the same array used in (A) but exposed to 5 ppm of ammonia for 10 min. For high concentrations of acid (0.01 M and 0.1 M) the alkaline gas neutralizes the acidic pre-treatment and the signal drops constantly over time (slope is the black solid line; slopes for different concentrations of ammonia are summarized in (D)). For the lowest concentration (0.001 M) the acid is depleted quickly and the sensor starts behaving like a bare-PEGS. (D) shows an A-PEGS treated with 0.01 M sulfuric acid and shows the best signal in terms of error and especially sensitivity to ammonia (see (C)). A-PEGS were exposed to a wide range of ammonia concentrations (0.05 ppm to 5 ppm) and the slope of the drop calculated (black solid line in (C)). This gives a linear correlation between slope and ammonia concentration with a coefficient of determination of R.sup.2=0.977. At lower concentrations (grey inlet) the errors get bigger. The error bars are the standard deviation for n=3-12.

    [0053] FIG. 3i illustrates a third embodiment of a gas sensor 100 for determining a quantity of ammonium ions in a soil sample extract. The gas sensor 100 of the first embodiment, further comprises a chemically inert 50 ml VWR centrifuge tube container 114 with a gas-tight screwcap lid 116. The container 114 and lid 116 are chemically inert. First and second wires 118/120 pass through the lid 116 and connect to the first and second electrode contacts 110/112 of the gas sensor 100, respectively. 1 ml of 15 M sodium hydroxide solution 122 is provided in the bottom of the container 114. As illustrated in FIG. 3i, in use, an aqueous soil sample extract, comprising ammonium ions, is mixed with the solution 122, releasing ammonia gas into the headspace of the container. The ammonia neutralises the sulphuric acid reagent, changing the impedance of the support layer 106, as is the case with the first embodiment. The change in impedance can then be used to determine the ammonium concentration in the soil sample extract, for example using the method below. Instead of soil extract, the sample can be any sample comprising ammonium ions, including agricultural run-off, river water, sea water, sewage, blood, urine, or an extract of any of these.

    [0054] In a fourth embodiment, the gas sensor 100 is for determining a quantity of bicarbonate ions in a sample. As such, the gas sensor 100 of the second embodiment further comprises a container 114 with a lid 116, and 1 ml of 5 M sulphuric acid solution is provided in the bottom of the container 114. In use, a sample comprising bicarbonate ions is added to the solution, releasing carbon dioxide into the headspace of the container 114. The carbon dioxide reacts with the hydroxide reagent, changing the impedance of the support layer 106, as is the case with the second embodiment. The change in impedance can then be used to determine the bicarbonate concentration in the sample, for example using the method below. In further embodiments, the sample may comprise other ions, such as alkylammonium ions, fluoride ions, chloride ions, bromide ions, iodide ions or bicarbonate ions, paired with a suitable sample activating solution and reagent. The sample can be any sample comprising bicarbonate ions, including agricultural run-off, river water, sea water, sewage, blood, urine, or an extract of any of these.

    [0055] FIG. 4 is a flow diagram for a method of determining the concentration of ammonium ions in a soil sample extract using a gas sensor 100, wherein the gas sensor 100 is the gas sensor 100 of the third embodiment. First, the sample is inserted 302 into the container 114. The sample is then mixed 304 with a 15 M sodium hydroxide solution 122 for converting the ammonium ions in the sample into ammonia, thereby releasing ammonia into the headspace of the container 114, where the ammonia diffuses up to the support layer 106 and neutralises the sulphuric acid reagent. The impedance of the support layer is then measured 306 by applying an electrical potential between the first and second electrodes at a first time, and measured 308 again in the same way at a second time. The concentration of ions in the sample is then determined 310 based on the impedance at the first time and the impedance at the second time, as discussed below.

    [0056] This method has a limit of detection of 3±1 ppm ammonium, up to at least 144 ppm. FIG. S1 shows calibration curves for ammonium nitrate in water (no soil), which verify that the soil measurements are from ammonium alone. Sensing of ammonia with the sensor 100 may be susceptible to interferences from other water-soluble alkaline gases; however, because ammonia has the highest water solubility and is the dominant water-soluble alkaline gas species in common soil samples due to the presence of fertilizer (ammonium nitrate), the signal generated by the sensor 100 largely originates from ammonium. In detail, the soil sample extract is created by pressing 100 ml deionized water through 100 g of soil. A 5 ml soil solution is injected into the container 114. In the container 114, the solubilized soil-ammonium is in equilibrium with solubilized ammonia (Equation 1), which is in equilibrium with volatilized ammonia in the headspace of the container under Henry's law (Equation 2).


    NH.sub.4(aq).sup.++OH.sub.(aq).sup.−.Math.NH.sub.3(aq)+H.sub.2O  (1)


    NH.sub.3(aq).Math.NH.sub.3(g)  (2)

    [0057] The pH is increased to 14 when mixed with the concentrated sodium hydroxide solution 122, shifting the equilibrium toward NH.sub.3(aq) and ultimately NH.sub.3(g). The ammonia in the headspace of the container once again dissolves in the sulphuric acid on the support layer 106, for example as described in Barandun et. al.,.sup.[27] and then neutralizes the sulphuric acid causing an increase in the ionic impedance (presumably due to the neutralization of highly mobile H.sup.+ ions) of the support layer 106 in a concentration dependent manner (see FIG. 3ii). Neutralization of volatilized ammonia (Equation 3) draws out more ammonium from the soil extract to maintain equilibrium, hence the reagent on the support layer 106 acts as a scrubber of soil-ammonium.


    2NH.sub.4.sup.++2OH.sup.−+2H.sup.++SO.sub.4.sup.2−.fwdarw.2NH.sub.4.sup.++SO.sub.4.sup.3−+2H.sub.2O  (3)

    [0058] There is a decrease in ionic impedance during neutralization, which is measured electrically..sup.[27] An alternating voltage (10 Hz, 4 V amplitude peak-to-peak) is supplied across the electrodes 102/104 via wires 118/120 (discussed in further detail below), and the current passing through measured as a voltage with a transimpedance amplifier, amplified with a gain resistor (see FIG. S2). As the neutralization continues, the impedance of the paper increases slowly and the time it takes to complete or slow dramatically used as the analytical signal shown in FIG. 3iii (the analytical signal is circled in red and the error shown in grey (calculated by standard deviation of n=5 measurements; see FIG. S3 for raw data). This may be determined by determining the time taken for the rate of change in impedance to drop below a threshold level. In this instance, the time used as analytical signal was A) when the gradient was zero or B) when there was a step change in gradient (>80% change in <10 minutes), which ever happened sooner. Before measuring unknown concentrations, the sensor is calibrated in a range of concentrations of ammonium from 4.5-144 ppm, in soil fertilized with ammonium nitrate; the calibration curve (log-log) is shown in FIG. 3iv. The inventors' measurements of ammonium concentration were compared to external laboratory measurements with a score of R.sup.2=0.85 (FIG. S4). A calibration curve for ammonium nitrate in water (no soil) was also measured, to verify the soil measurements are indeed from ammonium alone (FIG. S1).

    [0059] The method of FIG. 4 can also be used with the gas sensor of the fourth embodiment to measure bicarbonate ions in a sample, mutatis mutandis.

    [0060] Overfertilization with nitrogen fertilizers has damaged the environment and health of soil; yields are declining, while the population continues to rise. Soil is a complex, living organism which is constantly evolving, physically, chemically and biologically. Standard laboratory testing of soil to determine the levels of nitrogen (mainly NH.sub.4.sup.+ and NO.sub.3.sup.−) is infrequent, expensive and slow, but levels of nitrogen vary on short timescales. Current testing practices, therefore, are not useful to guide fertilization. The above PoU sensor of the third embodiment measures levels of NH.sub.4.sup.+ in soil with a level of detection down to 3±1 ppm (R.sup.2=0.85) using a chemically functionalized near ‘zero-cost’ paper-based electrical gas sensor. Gas-phase sensing provides a robust method of sensing NH.sub.4.sup.+ inexpensively due to the reduced complexity of the gas-phase sample as opposed to complex liquid samples that are typically extracted from samples of soil. It is demonstrated that PoU NH.sub.4.sup.+ measurements, when combined with soil conductivity, pH and easily accessible weather data, allow instantaneous prediction of levels of NO.sub.3.sup.− in soil with of R.sup.2=0.70 using the following machine learning (ML) model. The same model can predict NO.sub.3 with R.sup.2=0.87 when using laboratory-grade sensors. This approach eliminates the need of using dedicated, expensive sensing instruments to determine the levels of NO.sub.3.sup.− in soil which is difficult to measure reliably with inexpensive technologies. It is also shown that a long short-term memory recurrent neural network model can be used to predict levels of NH.sub.4.sup.+ and NO.sub.3.sup.− up to 12 days into the future from a single measurement at day one, with R.sup.2.sub.NH4+=0.64 and R.sup.2.sub.NO3−=0.70, for unseen weather conditions.

    [0061] With the approach presented, crucial nitrogenous soil nutrients can be determined and predicted with enough accuracy to forecast the impact of climate on fertilization planning, and tune timing for crop requirements, reducing overfertilization while improving crop yields.

    [0062] There is a global effort to find practices for food production that can sustainably feed the population, which is expected to surpass 11 billion people by 2050..sup.[1], The Haber-Bosch process enabled inexpensive nitrogen-based fertilizers to feed the booming population, with >600% increase in their use in the past 50 years..sup.[2,3] Increased fertilization has, however, come with a great environmental cost. Approximately 12% of available arable land is now degraded, of which >240 Mha (˜926,000 mi.sup.2 or four times the area of France or the state of Texas) is chemically degraded—i.e. contaminated with heavy metals and/or acidified, especially from nitrogen fertilizers, which interfere with nutrient mobility and uptake by plants..sup.[4,5] Over-fertilization has visibly destroyed ecosystems by the leaching of excess NO.sub.3.sup.− into surface waters causing eutrophication, which gives rise to dead zones such as in the Gulf of Mexico..sup.[6] Over-fertilization also impacts the soil microbiome..sup.[7,8] Although this is an actively studied topic, N fertilization appears to shift relative abundance of certain microbial communities in soil, with important implication on C cycling and ecosystems.

    [0063] Application of fertilizers is poorly understood and largely varied between regions and countries, for example eight times more is applied per hectare in China than Australia..sup.[9] Farmers across the globe typically rely on guidelines from their governments, fertilizer suppliers, or family know-how when deciding the economic optimum rate of fertilization to ensure maximum crop yields. Professional agronomists generally advise along guidelines and look at yields from previous years to estimate fertilizer requirements; they may also take soil samples for laboratory testing prior to sowing. Laboratory testing, however, is an expensive and slow process hence not performed regularly. Soil nitrogen (Soil-N) is crucial for high yields, and nitrogen fertilizer is the most frequently applied fertilizer. The optimal application rate is highly variable, however, since soil-N fluctuates widely with the properties of soil and weather over short timescales. Benchmark guidelines are unable to account for these variations. With the lack of data concerning the current and future nitrogen levels in soil, farmers tend towards overfertilization to protect yields, an environmentally and economically inefficient practice..sup.[10-13]

    [0064] Measurement of Soil-N is important for optimizing the use of nitrogen fertilizers and enabling spatiotemporal variable rate fertilization. Indirect spectroscopic precision farming technologies such as crop canopy sensors (e.g., near infrared spectroscopic cameras) can be used to approximate the N requirements of plants..sup.[14-16] Indirect spectroscopic techniques, however, do not measure the levels of nitrogen in soil, instead they measure green light from the leaves of plants (related to nitrogenous compounds) to indirectly estimate levels of N fertilizer required. Machine learning algorithms are suitable for calibrating spectra (e.g., near-infrared) to soil-N..sup.[17] Spectroscopic methods require plant mass (e.g., leaves), so the measurements cannot be performed until after germination and growth. Fertilizer, however, is usually applied just before seeds are sown, hence spectroscopic techniques rarely help in-season, and only compliment national guidelines. Using ion-selective membranes, levels of nitrogen in soil (mainly in the form of NO.sub.3 and NH.sub.4.sup.+) can be directly detected electrochemically..sup.[18] Such sensors can be integrated into Internet-of-Things (IoT) type remote sensors that can provide continuous data streams concerning levels of nitrogen in soil. To provide spatiotemporal resolution, however, many units would need to be deployed to fields..sup.[19] Statistical models using machine learning are, therefore, well suited for filling in missing soil data.sup.[20] and forecasting them into the future..sup.[21] Given each sensor node is not disposable (and expensive), they would require collection before harvest (i.e. labour intensive) and are susceptible to theft. They also require infrastructure investments to a wireless network with access points etc. With the challenges such as large investment requirements, sector heterogeneity, data ownership and privacy, user acceptance and lack of interoperability, the adoption of IoT systems for soil sensing has been slow.[.sup.22] Ion-selective electrochemical sensors can also be produced in a small PoU formfactor (e.g., Horiba LAQUAtwin, ELIT 8021). These sensors demonstrate high accuracy for NO.sub.3.sup.− (R.sup.2=0.96).sup.[23] and NH.sub.4.sup.+ (R.sup.2=0.98)[.sup.24] however they are delicate, relatively expensive (i.e. Horiba LAQUAtwin NO.sub.3 sells for ˜350 USD; each electrode ˜150 USD), require sample preparation and calibration..sup.[25,26]In this work a new and quick approach is demonstrated for determining crucial, but difficult to measure N-levels in soil. A new type of gas-phase NH.sub.4.sup.+ sensor (of the third embodiment above), simulated climate data (i.e. rainfall and temperature) and off-the-shelf soil pH and conductivity sensors are combined with a statistical machine learning model to instantaneously and accurately determine levels of NO.sub.3.sup.− in soil. It is demonstrated that the N-levels in soil can also be predicted into the future using a long short-term memory recurrent neural network over a 12-day period. With this new approach (FIG. 5), fertilization can be provided more precisely to improve yields, while preventing over fertilization, thus environmental degradation.

    [0065] With reference to FIG. 5, nitrogen fertilizer is the backbone of modern agriculture, and is typically applied as urea or ammonium nitrate, fuelling the soil-nitrogen cycle. This outputs solvated NH.sub.4.sup.+ and NO.sub.3.sup.−, which are strongly taken up by plant roots. PoU electrical measurements (including a new soil-NH.sub.4.sup.+ sensor disclosed above) are combined with a machine learning model to quantify difficult-to-measure soil nutrients (such as NO.sub.3) and forecast them into the future. This provides real-time dynamic soil nitrogen information to guide fertilization—reduce over-fertilization, understand the effect of weather, and ensure enough plant-available nitrogen to maximise crop yield—without laboratory measurements. At scale, this model could use a bare minimum of readily available input data to quantify and predict crucial outputs (e.g. soil macronutrients) in highly complex systems (such as soil).

    [0066] Time-Dependent Nitrogen Dynamics in Soil

    [0067] Understanding how nitrogen species evolve after fertilization, in particular the nitrification from NH.sub.4.sup.+ to NO.sub.3.sup.−, is important to growers for tailoring fertilization to climatic conditions and crop types, while reducing losses and environmental damage.sup.[28]. Time series data concerning dynamics of soil nitrogen were collected over short timescales (<20 days) in experiments simulating soil in a field (FIG. 6). To reduce complexity, no plants were grown and the nitrogen dynamics only due to microbial activity, run-off and volatilization (escape of NH.sub.3(g)) were investigated. 5.1 kg of soil (Westland Top Soil) were placed in 15 L plastic pots and stored in the laboratory without covering their tops. In each experiment, the environmental conditions were controlled in two ways: i) adding a controlled amount of water to simulate rainfall, ii) passing an electrical current through a resistive heating wire (nichrome wire), wrapped around the containers, to control temperature uniformly. The soil type (sandy loam, sieved) and amount of fertilizer added were kept fixed for all experiments (fertilizer NH.sub.4NO.sub.3 was added in the beginning of each experiment to produce a concertation of 120 ppm, approximately equal to 241 kg/ha of NH.sub.4NO.sub.3 or 85 kg/ha nitrogen—calculation in SI). Experiments were performed for eight sets of environmental conditions spanning arid (1 mm/day rainfall) to tropical (10 mm/day rainfall) with temperatures ranging from 19-21° C. (temperate) to 26-34° C. (warm). Measurements of soil temperature, rainfall, pH, electrical conductivity (EC) and NH.sub.4.sup.+ were made in the inventors' laboratory (Guder Research Group—GRG). Levels of pH, EC, NH.sub.4.sup.+ were also measured in an external laboratory (NRM, Cawood Scientific), in addition to dryness and NO.sub.3.sup.−, for comparison and training of the machine learning model. Although when building the machine learning model the dryness values provided by the commercial laboratory were relied upon, dryness is highly correlated with rainfall and temperature (in the inventors' dataset, temperature and rainfall predict dryness using linear regression with R.sup.2=0.86, see FIG. S5 and the equation in the SI) hence can be estimated using these two metrics without needing further analytical measurements.

    [0068] With reference to FIG. 6, Time series data of soil nitrogen dynamics were measured over short timescales (<20 days), where each corresponds to soil under different environmental conditions. Rainfall and temperature were controlled by adding a controlled amount of water, and passing current through a resistive heating wire (top of FIG. 6). Environmental conditions span arid (1 mm rain/day) to tropical (10 mm rain/day), temperate (19-21° C.) and warm (26-34° C.). Initial fertilization with NH.sub.4NO.sub.3 was fixed at 120 ppm. Measurements of soil temperature, rainfall, pH, EC and NH.sub.4.sup.+ were made in the inventors' laboratory (GRG), and pH, EC, dry %, NH.sub.4.sup.+ and NO.sub.3.sup.− were measured in an external laboratory (NRM) for comparison and training the machine learn model.

    [0069] With reference to FIG. S4, after calibration shown in FIG. 3.4 with data from Figure S3, 35 soil-NH.sub.4.sup.+ measurements were made in soil fertilized with in for a variety of weather conditions (see FIG. 6). Soil-NH.sub.4.sup.+ measurements from the inventors' gas-phase NH.sub.4.sup.+ sensor (GRG) compared to external laboratory measurements with a score of R.sup.2=0.85. [0070] Calculation of Fertilization Rate [kg/ha] from Concentration [ppm] and Soil Parameters [0071] Fertilization Rate [kg/ha]=Hectare Area [m.sup.2]×Sample Depth[m]×Density [kg/m.sup.3]×Concentration [ppm] [0072] Hectare Area=10,000 m.sup.2 [0073] Sample Depth=Pot height=0.26 m [0074] Soil Density=774 kg/m.sup.3 [0075] Concentration of NH.sub.4NO.sub.3=120 ppm [0076] 10,0000×0.26×774×(120/1,000,000)=241 kg/ha

    [0077] Dynamics of soil NH.sub.4.sup.+: In all time dependent soil experiments, the level of NH.sub.4.sup.+ dropped rapidly over time, levelling out after about a week, independent of the environmental conditions. Temperature played a considerable role only in the case of 1 mm/day rainfall in which the NH.sub.4.sup.+ levels settled at −50 ppm for warm conditions, in comparison to ˜0 ppm for temperature conditions. In all other scenarios, temperature or rainfall only slightly affected the NH.sub.4.sup.+ dynamics without large differences in the trends. Decreasing levels of NH.sub.4.sup.+ result from multiple processes, such as nitrification (i.e. conversion of NH.sub.4.sup.+.fwdarw.NO.sub.2.sup.−+NO.sub.3.sup.−) or environmental losses (leaching or volatilization), that run in parallel; however, the extent of each process might vary with environmental and soil conditions. Soil dehydration tends to limit nitrification, by restricting substrate supply to microbes and lowering activity of enzymes,.sup.[29] which may explain retention of NH.sub.4.sup.+ at higher temperatures (and low rainfall). This observation is further supported by the fact that the levels of NO.sub.3.sup.− were lower for warm conditions than temperate conditions.

    [0078] Dynamics of soil NO.sub.3.sup.−: Nitrification is a complex, aerobic microbial process affected by temperature, moisture, levels of O.sub.2, pH and of course availability of NH.sub.4.sup.+ among other things (e.g., nitrifier populations)..sup.[28] It was observed that, while at 1 mm/day rainfall the level of NO.sub.3 increased compared to the initial (day zero) concentration, for 3 mm/day it remained relatively unchanged both for warm and temperate conditions. For 5 mm/day rainfall in warm conditions, the levels of NO.sub.3 only slightly increased toward the end of the experiment. For temperate conditions the concentration of NO.sub.3 nearly halved with a rapid drop after day 10. For heavy rainfalls (10 mm/day), the concentrations of NO.sub.3.sup.− dropped toward zero in a linear manner over the course of the experiments. From these experiments, it could be concluded that the optimum point for maximum nitrification and retention of NO.sub.3 in soil occurs in temperate and drier conditions, which are consistently more favourable than warm and wetter conditions. The reasons behind these trends may differ, however, depending on the conditions. While the run-off caused by the heavy rainfall (i.e. 10 mm/day) may physically leach NO.sub.3.sup.− away (the excess water was pouring out from the bottom of the pots), less rainfall (5, 3 mm/day) may hinder penetration of O.sub.2 into the soil (i.e. waterlogged soil) therefore reduce nitrification, especially if the climate is temperate so that not enough water is removed from the soil to allow oxygenation..sup.[30] The optimal temperatures for nitrification are typically reported between 24-27° C.,.sup.[31] in line with the inventors' observations. In the experiments where the dryness of soil did not increase, however, temperature did not have a large effect, evidenced by the first 4 days of the experiment with 3 and 5 mm/day rainfall. Dryness (i.e. rainfall+temperature), therefore appears to be a more important factor in determining the levels of NO.sub.3.sup.− than temperature alone.

    [0079] Dynamics of soil EC and pH: EC and pH were measured to investigate their correlation with soil nitrogen under different environmental conditions. Due to technical difficulties, it was not possible to complete the EC and pH measurements for all samples in a single day, hence missed measurements which were to be performed in the inventors' laboratories. Nevertheless, no major trends in pH or EC regardless of rainfall or temperature except for the experiments with 1 and 10 mm/day rainfall were observed. For 1 mm/day rainfall, the EC only slightly increased and pH slightly decreased overtime. Ammonium based fertilizers are known to acidify soil therefore decrease pH..sup.[32,33] With an increase in the concentration of mobile NO.sub.3.sup.− ions in soil, EC is also known to increase..sup.[33] When the rainfall was increased to 10 mm/day, however, the run-off leached out ionic species from the soil, in turn reducing EC of soil without affecting pH. The EC and pH measurements performed in the inventors' laboratory and externally did not correlate to the degree expected, although the instruments used in the inventors' laboratory were calibrated weekly with calibration solutions to produce reliable measurements. Upon investigation, it was found that the difference in sample preparation was the likely culprit behind differences in the results. The external laboratory dried the soil samples before taking a fixed weight and mixing with water for measurements, whereas the samples were taken directly from the pots without drying and mixed with water, which caused varied values for EC and pH. In any case, in the context of this work, these differences in sample preparation did not affect the underlying trends in the data generated by the external laboratory and such small errors may happen under real experimental conditions at the point-of-use (hence the entire system should be robust enough to absorb these errors).

    [0080] Retention, conversion or loss of nutrients added to soil is a complex function of rainfall, temperature, pH, microbe populations, soil type etc. This complexity renders creation of deterministic models to understand the relationship between nitrogenous species and their levels in soil, difficult (if not impossible) after some time, even if initial concentrations are known. The inventors have, therefore, attempted to create a statistical model using (existing) ML approaches to predict levels of hard-to-measure NO.sub.3.sup.− in soil using information concerning weather (i.e. rainfall and temperature), time since fertilization, pH, EC, and NH.sub.4.sup.+.

    [0081] Using supervised ML, the inventors attempted to predict the level of NO.sub.3.sup.− in soil instantaneously, and both NH.sub.4.sup.+ and NO.sub.3.sup.− into the future (see FIG. S6 for the ML prediction process flow). The measurements performed by the external laboratory (FIG. 6) were used as a training set. The performance of the model was then tested either with data from the external lab or data generated by the PoU sensors in the inventors' lab as inputs. Training data matching the same environmental conditions (temperature and rainfall) as the test inputs were removed, so the model was always tested on unseen environmental conditions. Features were ranked in order of importance (by XGBoost, FIG. 7.1 top left), where soil dryness, time since fertilization and NH.sub.4.sup.+ were the most important. Combinations of features, regressors and tuning parameters were compared exhaustively (by grid search) to find the best general regressor to estimate the levels of NO.sub.3.sup.− instantaneously (see FIG. S7 for R.sup.2 scores for each set of environmental conditions). It was determined that the K-nearest-neighbours (Knn) algorithm, trained on all 7 features with tuning parameters of k=14, leaf size=1 and p=1, can predict instantaneous levels of NO.sub.3.sup.− with R.sup.2=0.63 using external lab results for training and the inventors' lab PoU sensors for test input (FIG. 7.1 bottom left). Using the same model, but with external lab results as test inputs, removes the impact of inaccuracy from the inventors' lab sensors, resulting in R.sup.2=0.68 (FIG. S8). It was also determined that XGBoost regressor produced the best predictions for dryer soils and Knn for wetter. Taking the inventors' lab PoU sensors as test inputs, and the optimal regressor and tuning for each set of environmental condition offers even better performance, giving an optimised score of R.sup.2.sub.av=0.70 (score averaged across each set of environmental conditions—FIG. 7.1 bottom left). The same process, but with external lab results as test inputs, produces on optimized score of R.sup.2.sub.av=0.87 (FIG. 7.1 bottom right). This score for predicting levels of NO.sub.3.sup.− in soil is comparable to direct measurements using optical (R.sup.2=0.83; Fourier-transform infrared spectroscopy) or electrochemical methods (R.sup.2=0.96; ion selective electrodes) as reported in the literature..sup.[24,34] This result was pleasantly surprising given that no additional hardware was required for determining levels of NO.sub.3 with high accuracy. The inventors also tuned a Knn model (k=11, leaf size=3, p=1) to predict levels of NO.sub.3 in soil using only the most basic inputs—days since fertilization, rainfall and temperature (i.e. requiring no soil sensors at all) which yielded R.sup.2=0.54 (FIG. S9).

    [0082] With reference to FIG. S6, machine learning models trained with readily available environmental data and PoU measurements enable prediction of difficult-to-measure soil nitrogen instantaneously with machine learning regressors (1). Prediction into the future is then enabled by treating data as time series in a LSTM neural network (2).

    [0083] Data Processing for Machine Learning:

    [0084] The following steps were taken to predict instantaneous soil—NO.sub.3.sup.− (FIG. S6.1) [0085] Anomalous data removed [0086] Data for missing days interpolated smoothly with Akima spline [0087] Time series length capped at 16 days [0088] Data normalized over range 0-1 [0089] Feature selection: Features ranked for predicting NO.sub.3.sup.− calculated by weight and gain using XGBoost—see FIG. 7.1. Combinations are tested starting with all 7 features, then only 6 most important features, then the most important 5, down to the single most important feature [0090] Cross-validation: Data from each time series is removed from the training data set sequentially, and used as test data instead [0091] Regressor selection: Random Forest, Gradient Boosting, Adaboost, Extra Trees, Knn and XGBoost were tested [0092] Hyperparameter tuning: Grid search used to tune up to 3 hyperparameters for each regressor

    [0093] The following steps were taken to predict soil-NH.sub.4.sup.+ and soil-NO.sub.3.sup.− 1-12 days into the future (FIG. S6.2) [0094] Concatenate all time series into one multivariate time series [0095] Normalize data −1<x<1 (for a bounded and stable neural network computation) [0096] Format time series data for supervised learning (generate additional input features with time lag, generate output, which is soil-NH.sub.4.sup.+ and soil-NO.sub.3.sup.− at future time) [0097] Remove each time series sequentially and train model on remaining data [0098] Predict the removed time series from its measurements on Day 0 [0099] Create LSTM model and tune hyperparameters with grid search (time lag, epochs, batch size, number of neurons) [0100] Record score (mean squared error) of predictions, repeat each prediction 7 times and compare average scores to determine optimal tuning, train LTSM model with optimal tuning to generate predictions of NH.sub.4.sup.+ and NO.sub.3.sup.− into the future

    [0101] With reference to FIG. S7, each time series 1-8 (corresponding to soil under different environmental conditions, by controlling rainfall and temperature—see FIG. 6) was sequentially removed from the data, and predicted using the remaining data. Testing all combinations of features, regressors and tuning parameters results in a best-case prediction score for each time series, shown in FIG. S7. XGBoost is gives the best predictions for dryer soils and Knn for wetter soils. Poorer NO.sub.3.sup.− predictions at moderate (3-5 mm) rainfalls, where NO.sub.3.sup.− levels were relatively constant overtime. The number of features (n_features), regressor and optimal tuning parameters for each time series are listed below. [0102] n_features=5, XGBoost (eta=0.0, gamma=0.0, max depth=6.0) [0103] n_features=3, XGBoost (eta=0.0, gamma=0.0, max depth=6.0) [0104] n_features=4, XGBoost (eta=0.0, gamma=0.0, max depth=7.0) [0105] n_features=7, XGBoost (eta=0.0, gamma=0.0, max depth=1.0) [0106] n_features=4, Knn (n neighbours=8.0, leaf size=1.0, p=1.0) [0107] n_features=7, Knn score (k=50.0, leaf size=1.0, p=3.0) [0108] n_features=7, Knn score (k=14.0, leaf size=1.0, p=1.0) [0109] n_features=6, Knn score (k=20.0, leaf size=1.0, p=10.0)

    [0110] With reference to FIG. S8, the same process was followed as for FIG. 7.1 (bottom left), with the same tuning parameters (k=14, leaf size=1, p=1), but test inputs were from the external lab rather than PoU sensors from the inventors' lab, thus removing any impact of inaccuracy from the inventors' lab. The resulting score is R.sup.2=0.68 (compared to the R.sup.2=0.63 with inventors' lab inputs).

    [0111] With reference to FIG. S9, Knn predicts NO.sub.3.sup.− using a model tuned (k=11, leaf size=3, p=20) to only the most basic inputs—days since fertilization, rainfall and temperature (i.e. requiring no soil sensors at all.) with R.sup.2=0.54. One model was used for all environmental conditions.

    [0112] Although determining the concentration of NH.sub.4.sup.+ and NO.sub.3.sup.− in soil at any given moment is important (as described above), from an operational point of view, it would also be useful to know what the levels of soil nitrogen (i.e. NH.sub.4.sup.+ and NO.sub.3.sup.−) will be in the future from a single measurement to create a precise schedule for future fertilization. Soil, however, introduces a memory effect: nutrient levels today depend on the nutrient levels and other factors from yesterday (property X and time t will be a function of X at t−1). Forecasting of soil-N into the future must, therefore, consider time and sequence of data, and possess a degree of memory, for multiple correlated features. Using the time-series dataset generated by the external lab, a long short-term memory recurrent neural network (LSTM) model (another supervised ML algorithm) was trained to forecast NH.sub.4.sup.+ and NO.sub.3.sup.− into the future for unseen environmental conditions. The model was tuned using grid search, minimizing root-mean-squared error using time lag and model hyperparameters (training epochs, batch size, number of neurons). The optimal tuning was time lag=1, epochs=50, batch size=3 and number of neurons=3. The dataset was first concatenated into one multivariate time series. Each time series was then removed sequentially, and the model trained to predict the removed time series from the remaining data. Models were retrained for each desired forecast time (1-12 days into the future). Predictions for longer time periods were distorted by subsequent time series in the concatenation. Comparing predicted to real values over the 12-day period gives a score of R.sup.2.sub.NH4+=0.64 and R.sup.2.sub.NO3−=0.70 using only the initial concentrations for NH.sub.4.sup.+ and NO.sub.3.sup.− on Day 0 which demonstrates efficacy with even the limited training dataset (FIG. 7.2, with R.sup.2 plots in FIG. S10). In essence, by measuring NH.sub.4.sup.+, EC and pH in the field and gathering other environmental data from public sources, levels of NO.sub.3 can be estimated for today and both levels of NH.sub.4.sup.+ and NO.sub.3.sup.− into the future.

    [0113] With reference to FIG. 7, low-cost PoU measurements and machine learning models were used to estimate crucial, difficult-to-measure, parameters in complex systems, then forecast them into the future. NO.sub.3.sup.− was predicted with instance based and ensemble learning regressors. Features were first ranked by importance to the XGBoost model, calculated by weight (number of times the feature occurs in the trees) and gain (each feature's contribution to each tree), shown in FIG. 7.1 (top left). Dryness is highly correlated with rainfall and temperature and can be predicted from temperature and rainfall using linear regression with R.sup.2=0.86 (FIG. S5), without requiring further analytical measurements. There are unique environmental conditions for each time series (by controlling rainfall and temperature). Each time series was sequentially removed from the complete dataset, before training a model with the remaining dataset to make predictions for the removed set of environmental conditions. The trained model then gave instantaneous predictions for NO.sub.3 using only test inputs from PoU sensors in the inventors' lab (temperature, rainfall, calculated dryness, time since fertilization, EC, pH and NH.sub.4.sup.+). Optimal feature combinations, regressors and tuning parameters were compared using grid search. Data processing steps are described in more detail in the SI. The best performing regressor for all environmental conditions is Knn, which predicts NO.sub.3 using only PoU sensors from the inventors' lab as test inputs with R.sup.2=0.63 (FIG. 7.1 top right). Optimizing the model for each set of environmental conditions (regressor and tuning for each shown in FIG. S7) improves the score to R.sup.2=0.70 (FIG. 7.1 bottom left). Using external lab data as test inputs (removing any inaccuracy from the inventors' PoU sensors) gave optimized predictions for NO.sub.3.sup.− with R.sup.2=0.87 (FIG. 7.1 bottom right). The dataset was then used to train a LSTM-RNN model to forecast NH.sub.4.sup.+ and NO.sub.3.sup.− into the future, also for unseen environmental conditions (FIG. 7.2). Each time series was removed sequentially, and the model trained on the remaining data. Feature time lag and model hyperparameters (training epochs, batch size, number of neurons) were tuned to optimize forecasting. Models were retrained for each desired forecast time (1-12 days into the future) and comparing predicted to real values over the 12 day period gives a score of R.sup.2.sub.NH4+=0.64 and R.sup.2.sub.NO3−=0.70.

    [0114] With reference to FIG. S5, in the dataset, dryness is highly correlated with rainfall and temperature. Dryness can be predicted using linear regression with R.sup.2=0.86 using the equation below, and hence can be estimated using these two metrics without needing further analytical measurements.


    Dryness[%]=0.8853 Temperature[° C.]−3.0373 Rainfall[mm]+49.3928

    [0115] FIG. S10 illustrates R.sup.2 score for data in FIG. 7.2, showing soil-NH.sub.4.sup.+ and soil-NO.sub.3.sup.− predicted by LSTM ML model 1-12 days into the future. The LSTM ML model was poorer at predicting lower soil-NO.sub.3.sup.− levels and higher soil-NH.sub.4.sup.+ levels.

    [0116] In accordance with the above, it is possible to estimate the levels of hard-to-measure chemicals in soil using easily accessible soil/climate data and ML models. This entirely new strategy allows determining and predicting levels of nitrogen (NH.sub.4.sup.+ and NO.sub.3.sup.−) in soil, both instantaneously and into the future. The inventors have produced the first soil nitrification dataset that provides enough temporal resolution (˜3 day measurement frequency), for a range of conditions, to train a ML model. The strength of the present approach is that it primarily uses, inexpensive/easily accessible tools for the soil measurements (pH and EC meter with the exception of a new paper-based, gas-phase NH.sub.4.sup.+ sensor developed in this work) and publicly available weather data (rainfall and temperature; in this study the inventors simulated weather in a controlled manner) to estimate the levels of soil nitrogen through ML. The method presented is remarkably high performance such that concentration of instantaneous soil-NO.sub.3.sup.− can be estimated using PoU inputs with R.sup.2.sub.av=0.70, and using laboratory inputs with R.sup.2.sub.av=0.87 (comparable to existing high performance NO.sub.3 sensors) without the need for additional hardware. Using a LSTM model, the levels of NH.sub.4.sup.+ and NO.sub.3.sup.− can also be forecast 12 days into the future, for unseen environmental conditions, with R.sup.2.sub.NH4+=0.64 and R.sup.2.sub.NO3−=0.70. Furthermore, the paper-based, disposable, gas-phase NH.sub.4.sup.+ sensors (i.e. chemPEGS of the third embodiment above) developed in this work could also be used alone at the PoU without the ML model or other sensors if instantaneous detection of NH.sub.4.sup.+ is needed alone. The approach presented in this work may have the following three potential weaknesses: [0117] The supervised ML algorithms used for the prediction of soil-N require a training dataset, meaning prior measurements/climate data are needed to make the estimation algorithms work. This problem could partially be resolved by using data for soil nitrogen already published in the literature to create a training dataset. A training dataset could also be created using the PoU sensor toolkit described in this work in addition to occasional measurements of soil-NO.sub.3.sup.− in an external laboratory. It is expected that performance of the algorithms will increase over time as more data are generated using the sensors and laboratory measurements. The LSTM approach also concatenated all training data into one long multivariate time series, resulting in a model that would only predict cyclical patterns if allowed to predict longer times than the length of the input time series (t≥16 days). This problem may be addressed by treating each set of environmental conditions as panel data (with separate multivariate time series for PoU measurements in different locations/environmental conditions), linking between panels and training over longer time periods. [0118] chemPEGS (for measuring NH.sub.4.sup.+ at the PoU) may be cross-sensitive to other alkaline gases and currently takes a long time to perform a measurement; 30-450 minutes for 144-4.5 ppm NH.sub.4.sup.+. chemPEGS, however, demonstrated sufficient performance for measuring soil-NH.sub.4.sup.+ as it is most sensitive to NH.sub.3(g) due to its high water solubility. The time it takes to produce a result could also be reduced by measuring the rate of change during neutralization or training a predictive machine learning model on short measurement times. The sensitivity of chemPEGS could also be improved by using a lower concentration of H.sub.2SO.sub.4..sup.[35,36] [0119] The dataset generated is limited (sparse) and does not include various scenarios such as sudden changes in weather, different types of soils and fertilizers (e.g., urea). The current work also does not include crops, which would draw nitrogen from the soil and affect nitrogen dynamics. Further work is needed to create a model to predict nitrogen uptake by plants.

    [0120] The impact of this work is that growers can instantly determine crucial soil nutrients using only point-of-use measurements and weather data, and forecast nutrients into the future to build better fertilization plans. This would ensure that appropriate nutrients are present, when needed, by the crops. This approach could enable precision farming of a new calibre (with significantly lowered capital investment), reducing fertilizer requirements, soil degradation and eutrophication, while improving crop yields. Furthermore, it is hoped this approach will extend to complex media other than soil, where simple chemical measurements and easily accessible data, combined with machine learning, can be used to predict, and forecast crucial outputs in healthcare, food and environmental monitoring.

    [0121] Soil experiments: Top soil with sandy loam texture (69% sand 2.00-0.063 mm diameter, 25% silt 0.063-0.002 mm diameter, 6% clay <0.002 mm diameter, density 774 g/l measured in NRM Laboratories, part of Cawood Scientific, United Kingdom) was purchased from Westland and used in the experiments without further modifications. For the soil experiments performed in the inventors' laboratory, the water-soluble compounds and small particles were extracted from the soil samples by mixing 100 ml diH.sub.2O with 100 g of soil, and pressing with a potato press (VonShef). The solution extracted was used in the subsequent, pH, EC and NH.sub.4.sup.+ measurements in the inventors' laboratory. Soil samples (200 g), for the measurements at the external laboratory (NRM), were extracted from the soil pots and stored in a Ziploc bag (placed inside a cool box along with cooling element) which were collected and analysed within 2 days. Different to the inventors' method of handling, the external lab used a soil-to-water ratio of 1:2.5 as they dried the samples before processing to improve consistency (this was not done, which caused issues surrounding unmatching results between the external measurements and measurements performed by the inventors' group). Levels of soil nitrogen were measured colorimetrically by the external laboratory. NH.sub.4.sup.+ was reacted with alkaline hypochlorite and phenol to form indophenol blue. Sodium nitroprusside acted as a catalyst in formation of indophenol blue which was measured at 640 nm. NO.sub.3.sup.− was reduced to nitrate using cadmium in an open tubular cadmium reactor. A diazo compound formed between nitrite and sulphanilamide, which was coupled with N-(1-Napthyl)ethylenediamine dihydrochloride to give a red azo dye, measured at 540 nm. For all soil experiments, soil was weighed into pots of 5.1 kg, and fertilized with 51 ml 0.665 M (12,000 ppm) NH.sub.4NO.sub.3 while mixing thoroughly, resulting in soil at approximately 120 ppm NH.sub.4NO.sub.3.

    [0122] Control of rainfall and temperature: Rainfall was fixed at 1, 3, 5, or 10 mm/day, implemented by adding a daily equivalent (pots were watered every 2 days) of 57 ml, 172 ml, 286 ml and 573 ml respectively to a pot area of 573 cm.sup.2. Temperature was controlled by wrapping pots containing soil with nichrome wire (purchased from Amazon) and applying a 36 V potential, resulting in an electrical current of 1.5 A supplied from two Tenma 72-8350A power supplies in series. Soil temperature was measured at 3 points (centre, edge and in between) and averaged to estimate the temperature of soil periodically, using a Silverline 469539 Pocket Digital Probe Thermometer.

    [0123] Measurement of EC and pH of soil: Using a Hanna Instruments H15222-type benchtop EC/pH meter, the pH and EC of the solution extracted from the samples of soil were measured. Each sample was measured five times and the readings were averaged to reduce error.

    [0124] Machine learning model: All computational work was performed using Python (3.6) in PyCharm integrated development environment. For modelling and optimization, the following core packages were used: Keras API for Tensorflow (LSTM model), Scikit-learn (ensemble and Knn regressors), XGBoost, pandas and NumPy.

    [0125] The following references, cited above, are incorporated by reference. [0126] [1] United Nations, World Population Prospects 2019, 2019. [0127] [2] R. Mosheim, United States Dep. Agric.—Econ. Res. Serv. 2019. [0128] [3] N. Alexandratos, J. Bruinsma, Land use policy 2012, DOI 10.1016/S0264-8377(03)00047-4. [0129] [4] R. N. Tetteh, 2015, 6, 301. [0130] [5] K. T. Osman, Soil Degradation, Conservation and Remediation, 2014. [0131] [6] V. H. Smith, G. D. Tilman, J. C. Nekola, in Environ. Pollut., 1999. [0132] [7] F. Zheng, D. Zhu, M. Giles, T. Daniell, R. Neilson, Y. G. Zhu, X. R. Yang, Sci. Total Environ. 2019, DOI 10.1016/j.scitotenv.2019.04.384. [0133] [8] Q. Wang, M. Ma, X. Jiang, D. Guan, D. Wei, B. Zhao, S. Chen, F. Cao, L. Li, X. Yang, J. Li, Appl. Soil Ecol. 2019, DOI 10.1016/j.apsoil.2018.12.019. [0134] [9] J. F. Rosas, Card Work. Pap. 2012. [0135] [10] J. Melkonian, H. Van Es, A. Degaetano, J. Sogbedji, L. Joseph, Proc. Symp. Integrating Weather Var. into Nitrogen Recomm. 2007. [0136] [11] Q. Zhu, J. P. Schmidt, H. S. Lin, R. P. Sripada, Geoderma 2009, DOI 10.1016/j.geoderma.2009.10.004. [0137] [12] J. F. Shanahan, N. R. Kitchen, W. R. Raun, J. S. Schepers, Comput. Electron. Agric. 2008, DOI 10.1016/j.compag.2007.06.006. [0138] [13] N. Tremblay, Y. M. Bouroubi, C. Belec, R. W. Mullen, N. R. Kitchen, W. E. Thomason, S. Ebelhar, D. B. Mengel, W. R. Raun, D. D. Francis, E. D. Vories, I. Ortiz-Monasterio, Agron. J. 2012, 104, 1658. [0139] [14] C. Cilia, C. Panigada, M. Rossini, M. Meroni, L. Busetto, S. Amaducci, M. Boschetti, V. Picchi, R. Colombo, Remote Sens. 2014, DOI 10.3390/rs6076549. [0140] [15] N. R. Kitchen, K. A. Sudduth, S. T. Drummond, P. C. Scharf, H. L. Palm, D. F. Roberts, E. D. Vories, Agron. J. 2010, DOI 10.2134/agronj2009.0114. [0141] [16] M. L. Stone, J. B. Solie, W. R. Raun, R. W. Whitney, S. L. Taylor, J. D. Ringer, Trans. Am. Soc. Agric. Eng. 1996, DOI 10.13031/2013.27678. [0142] [17] S. M. Sze, K. K. Ng, J.-P. Colinge, C. A. Colinge, Phys. Semicond. Devices 2006, i. [0143] [18] H. J. Kim, J. W. Hummel, S. J. Birrell, Trans. ASABE 2006. [0144] [19] R. Shaw, R. M. Lark, A. P. Williams, D. R. Chadwick, D. L. Jones, Agric. Ecosyst. Environ. 2016, DOI 10.1016/j.agee.2016.06.004. [0145] [20] T. Hengl, J. G. B. Leenaars, K. D. Shepherd, M. G. Walsh, G. B. M. Heuvelink, T. Mamo, H. Tilahun, E. Berkhout, M. Cooper, E. Fegraus, I. Wheeler, N. A. Kwabena, Nutr. Cycl. Agroecosystems 2017, 109, 77. [0146] [21] B. Zaman, M. McKee, Open J. Mod. Hydrol. 2014, 04, 80. [0147] [22] C. Brewster, I. Roussaki, N. Kalatzis, K. Doolin, K. Ellis, IEEE Commun. Mag. 2017, DOI 10.1109/MCOM.2017.1600528. [0148] [23] K. L. Tully, R. Weil, Commun. Soil Sci. Plant Anal. 2014, 45, 1974. [0149] [24] J. Choosang, A. Numnuam, P. Thavarungkul, P. Kanatharana, T. Radu, S. Ullah, A. Radu, Sensors (Switzerland) 2018, 18, DOI 10.3390/s18103555. [0150] [25] R. Burton, “Nitrate Sensing in the Soil,” can be found under https://www.cambridgeconsultants.com/insights/nitrate-sensing-in-the-soil, 2016. [0151] [26] R. Shaw, A. P. Williams, A. Miller, D. L. Jones, Agric. 2013, DOI 10.3390/agriculture3030327. [0152] [27] G. Barandun, M. Soprani, S. Naficy, M. Grell, M. Kasimatis, K. L. Chiu, A. Ponzoni, F. Güder, ACS Sensors 2019, DOI 10.1021/acssensors.9b00555. [0153] [28] F. Beeckman, H. Motte, T. Beeckman, Curr. Opin. Biotechnol. 2018, DOI 10.1016/j.copbio.2018.01.014. [0154] [29] J. M. Stark, M. K. Firestone, Appl. Environ. Microbiol. 1995, 61, 218. [0155] [30] L. T. T. Nguyen, Y. Osanai, I. C. Anderson, M. P. Bange, M. Braunack, D. T. Tissue, B. K. Singh, Plant Soil 2018, 426, 299. [0156] [31] A. E. Taylor, A. T. Giguere, C. M. Zoebelein, D. D. Myrold, P. J. Bottomley, ISME J. 2017, 11, 896. [0157] [32] T. Hao, Q. Zhu, M. Zeng, J. Shen, X. Shi, X. Liu, F. Zhang, W. de Vries, J. Environ. Manage. 2020, 270, 110888. [0158] [33] J. L. Smith, J. W. Doran, Soil Sci. Soc. Am. 1996, 169. [0159] [34] N. Rogovska, D. A. Laird, C. P. Chiou, L. J. Bond, Precis. Agric. 2019, 20, 40. [0160] [35] N. Albilal, Nanomaterials for Pregnancy Detection, Imperial College London, 2014. [0161] [36] M. Grell, C. Dincer, T. Le, A. Lauri, E. Nunez Bajo, M. Kasimatis, G. Barandun, S. A. Maier, A. E. G. Cass, F. Güder, Adv. Funct. Mater. 2018, DOI 10.1002/adfm.201804798.

    [0162] It will be appreciated that the above description is made by way of example and not limitation of the scope of the appended claims, including any equivalents as included within the scope of the claims. Various modifications are possible and will be readily apparent to the skilled person in the art. Likewise, features of the described embodiments can be combined with any appropriate aspect described above and optional features of any one aspect can be combined with any other appropriate aspect.