Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Point-of-use sensors and machine learning enable low-cost determination of soil nitrogen


Overfertilization with nitrogen fertilizers has damaged the environment and health of soil, but standard laboratory testing of soil to determine the levels of nitrogen (mainly NH4+ and NO3) is not performed regularly. Here we demonstrate that point-of-use measurements of NH4+, combined with soil conductivity, pH, easily accessible weather and timing data, allow instantaneous prediction of levels of NO3 in soil (R2 = 0.70) using a machine learning model. A long short-term memory recurrent neural network model can also be used to predict levels of NH4+ and NO3 up to 12 days into the future from a single measurement at day one, with \(R^2_{{{\mathrm{NH}}_4}^+} = 0.60\) and \(R^2_{{{\mathrm{NO}}_3}^-} = 0.70\), for unseen weather conditions. Our machine-learning-based approach eliminates the need for dedicated instruments to determine the levels of NO3 in soil. Nitrogenous soil nutrients can be determined and predicted with enough accuracy to forecast the impact of climate on fertilization planning and to tune timing for crop requirements, reducing overfertilization while improving crop yields.

This is a preview of subscription content, access via your institution

Access options

Rent or buy this article

Prices vary by article type



Prices may be subject to local taxes which are calculated during checkout

Fig. 1: Summary of the method.
Fig. 2: PoU soil ammonium sensor.
Fig. 3: Soil chemistry and nitrogen dynamics.
Fig. 4: ML model to predict soil nitrate.

Data availability

All data are available from the corresponding author upon reasonable request.


  1. World Population Prospects 2019 (United Nations Department of Economic and Social Affairs, 2019).

  2. Mosheim, R. Fertilizer Use and Price (United States Department of Agriculture—Economic Research Service, 2019).

  3. Alexandratos, N. & Bruinsma, J. World Agriculture Towards 2030/2050 (Food and Agriculture Organization of the United Nations, 2012).

  4. Tetteh, R. N. Chemical soil degradation as a result of contamination: a review. J. Soil Sci. Environ. Manage. 6, 301–308 (2015).

    Article  CAS  Google Scholar 

  5. Osman, K. T. Soil Degradation, Conservation and Remediation (Springer Netherlands, 2014);

  6. Beeckman, F., Motte, H. & Beeckman, T. Nitrification in agricultural soils: impact, actors and mitigation. Curr. Opin. Biotechnol. 50, 166–173 (2018).

    Article  CAS  Google Scholar 

  7. Smith, V. H., Tilman, G. D. & Nekola, J. C. Eutrophication: impacts of excess nutrient inputs on freshwater, marine, and terrestrial ecosystems. Environ. Pollut. 100, 179–196 (1999).

    Article  CAS  Google Scholar 

  8. Zheng, F. et al. Mineral and organic fertilization alters the microbiome of a soil nematode Dorylaimus stagnalis and its resistome. Sci. Total Environ. 680, 70–78 (2019).

    Article  ADS  CAS  Google Scholar 

  9. Wang, Q. et al. Impact of 36 years of nitrogen fertilization on microbial community composition and soil carbon cycling-related enzyme activities in rhizospheres and bulk soils in northeast China. Appl. Soil Ecol. 136, 148–157 (2019).

    Article  Google Scholar 

  10. Zhao, Z. B. et al. Fertilization changes soil microbiome functioning, especially phagotrophic protists. Soil Biol. Biochem. 148, 107863 (2020).

    Article  CAS  Google Scholar 

  11. Rosas, F. Fertilizer Use by Crop at the Country Level (1990–2010) Working Paper No. 12-WP 535 (Center for Agricultural and Rural Development, Iowa State University, 2012);

  12. Zhu, Q., Schmidt, J. P., Lin, H. S. & Sripada, R. P. Hydropedological processes and their implications for nitrogen availability to corn. Geoderma 154, 111–122 (2009).

    Article  ADS  CAS  Google Scholar 

  13. Shanahan, J. F., Kitchen, N. R., Raun, W. R. & Schepers, J. S. Responsive in-season nitrogen management for cereals. Comput. Electron. Agric. 61, 51–62 (2008).

    Article  Google Scholar 

  14. Tremblay, N. et al. Corn response to nitrogen is influenced by soil texture and weather. Agron. J. 104, 1658–1671 (2012).

    Article  Google Scholar 

  15. Cilia, C. et al. Nitrogen status assessment for variable rate fertilization in maize through hyperspectral imagery. Remote Sens. 6, 6549–6565 (2014).

    Article  ADS  Google Scholar 

  16. Kitchen, N. R. et al. Ground-based canopy reflectance sensing for variable-rate nitrogen corn fertilization. Agron. J. 102, 71–84 (2010).

    Article  CAS  Google Scholar 

  17. Stone, M. L. et al. Use of spectral radiance for correcting in-season fertilizer nitrogen deficiencies in winter wheat. Trans. ASABE 39, 1623–1631 (1996).

    Article  Google Scholar 

  18. CropSpec Crop Canopy Sensors (Topcon Totalcare, 2021).

  19. SS1 SunScan Canopy Analysis System (Delta-T Devices, 2021).

  20. N-Sensor (Yara, 2021).

  21. Morellos, A. et al. Machine learning based prediction of soil total nitrogen, organic carbon and moisture content by using VIS-NIR spectroscopy. Biosyst. Eng. 152, 104–116 (2016).

    Article  Google Scholar 

  22. Kim, H. J., Hummel, J. W. & Birrell, S. J. Evaluation of nitrate and potassium ion-selective membranes for soil macronutrient sensing. Trans. ASABE 49, 597–606 (2006).

    Article  CAS  Google Scholar 

  23. World’s First Wireless NPK Soil Sensor (Teralytic, 2021).

  24. Shaw, R., Lark, R. M., Williams, A. P., Chadwick, D. R. & Jones, D. L. Characterising the within-field scale spatial variation of nitrogen in a grassland soil to inform the efficient design of in-situ nitrogen sensor networks for precision agriculture. Agric. Ecosyst. Environ. 230, 294–306 (2016).

    Article  Google Scholar 

  25. Hengl, T. et al. Soil nutrient maps of sub-Saharan Africa: assessment of soil nutrient content at 250 m spatial resolution using machine learning. Nutr. Cycl. Agroecosyst. 109, 77–102 (2017).

    Article  CAS  Google Scholar 

  26. Zaman, B. & McKee, M. Spatio-temporal prediction of root zone soil moisture using multivariate relevance vector machines. Open J. Mod. Hydrol. 4, 80–90 (2014).

    Article  Google Scholar 

  27. Brewster, C., Roussaki, I., Kalatzis, N., Doolin, K. & Ellis, K. IoT in agriculture: designing a Europe-wide large-scale pilot. IEEE Commun. Mag. 55, 26–33 (2017).

    Article  Google Scholar 

  28. Dincer, C. et al. Disposable sensors in diagnostics, food and environmental monitoring. Adv. Mater. 31, e1806739 (2019).

    Article  Google Scholar 

  29. Burton, R. Nitrate Sensing in the Soil (Cambridge Consultants, 2016).

  30. Tully, K. L. & Weil, R. Ion-selective electrode offers accurate, inexpensive method for analyzing soil solution nitrate in remote regions. Commun. Soil Sci. Plant Anal. 45, 1974–1980 (2014).

    Article  CAS  Google Scholar 

  31. Choosang, J. et al. Simultaneous detection of ammonium and nitrate in environmental samples using on ion-selective electrode and comparison with portable colorimetric assays. Sensors (Basel) 18, 3555 (2018).

    Article  ADS  Google Scholar 

  32. Shaw, R., Williams, A. P., Miller, A. & Jones, D. L. Assessing the potential for ion selective electrodes and dual wavelength UV spectroscopy as a rapid on-farm measurement of soil nitrate concentration. Agriculture 3, 327–341 (2013).

    Article  Google Scholar 

  33. Viscarra Rossel, R. A., Walvoort, D. J. J., McBratney, A. B., Janik, L. J. & Skjemstad, J. O. Visible, near infrared, mid infrared or combined diffuse reflectance spectroscopy for simultaneous assessment of various soil properties. Geoderma 131, 59–75 (2006).

    Article  ADS  CAS  Google Scholar 

  34. Sinfield, J. V., Fagerman, D. & Colic, O. Evaluation of sensing technologies for on-the-go detection of macro-nutrients in cultivated soils. Comput. Electron. Agric. 70, 1–18 (2010).

    Article  Google Scholar 

  35. Xuejiang, W. et al. Conductometric nitrate biosensor based on methyl viologen/Nafion®/ nitrate reductase interdigitated electrodes. Talanta 69, 450–455 (2006).

    Article  Google Scholar 

  36. Wongchoosuk, C. et al. Electronic nose for toxic gas detection based on photostimulated core-shell nanowires. RSC Adv. 4, 35084–35088 (2014).

    Article  ADS  CAS  Google Scholar 

  37. Barandun, G. et al. Cellulose fibers enable near-zero-cost electrical sensing of water-soluble gases. ACS Sens. 4, 1662–1669 (2019).

    Article  CAS  Google Scholar 

  38. Grell, M. et al. Autocatalytic metallization of fabrics using Si ink, for biosensors, batteries and energy harvesting. Adv. Funct. Mater. 29, 1804798 (2018).

    Article  Google Scholar 

  39. Ainla, A., Hamedi, M. M., Güder, F. & Whitesides, G. M. Electrical textile valves for paper microfluidics. Adv. Mater. 29, 1702894 (2017).

    Article  Google Scholar 

  40. Hamedi, M. M. et al. Integrating electronics and microfluidics on paper. Adv. Mater. 28, 5054–5063 (2016).

    Article  MathSciNet  CAS  Google Scholar 

  41. Glavan, A. C. et al. Analytical devices based on direct synthesis of DNA on paper. Anal. Chem. 88, 725–731 (2016).

    Article  CAS  Google Scholar 

  42. Stark, J. M. & Firestone, M. K. Mechanisms for soil moisture effects on activity of nitrifying bacteria. Appl. Environ. Microbiol. 61, 218–221 (1995).

    Article  ADS  CAS  Google Scholar 

  43. Nguyen, L. T. T. et al. Impacts of waterlogging on soil nitrification and ammonia-oxidizing communities in farming system. Plant Soil 426, 299–311 (2018).

    Article  CAS  Google Scholar 

  44. Taylor, A. E., Giguere, A. T., Zoebelein, C. M., Myrold, D. D. & Bottomley, P. J. Modeling of soil nitrification responses to temperature reveals thermodynamic differences between ammonia-oxidizing activity of archaea and bacteria. ISME J. 11, 896–908 (2017).

    Article  CAS  Google Scholar 

  45. Hao, T. et al. Impacts of nitrogen fertilizer type and application rate on soil acidification rate under a wheat–maize double cropping system. J. Environ. Manage. 270, 110888 (2020).

    Article  CAS  Google Scholar 

  46. Smith, J. L. & Doran, J. W. in Methods for Assessing Soil Quality Vol. 49 (eds Doran, J. W. & Jones, A. J.) 169–185 (Soil Science Society of America, 1997).

  47. Rogovska, N., Laird, D. A., Chiou, C. P. & Bond, L. J. Development of field mobile soil nitrate sensor technology to facilitate precision fertilizer management. Precis. Agric. 20, 40–55 (2019).

    Article  Google Scholar 

  48. Ortega, L., Llorella, A., Esquivel, J. P. & Sabaté, N. Paper-based batteries as conductivity sensors for single-use applications. ACS Sens. 5, 1743–1749 (2020).

    Article  CAS  Google Scholar 

  49. Güder, F. et al. Superior functionality by design: selective ozone sensing realized by rationally constructed high-index ZnO surfaces. Small 8, 3307–3314 (2012).

    Article  Google Scholar 

  50. Güder, F. et al. Paper-based electrical respiration sensor. Angew. Chem. Int. Ed. 55, 5727–5732 (2016).

    Article  Google Scholar 

  51. Maier, D. et al. Toward continuous monitoring of breath biochemistry: a paper-based wearable sensor for real-time hydrogen peroxide measurement in simulated breath. ACS Sens. 4, 2945–2951 (2019).

    Article  CAS  Google Scholar 

Download references


We thank EPSRC (grant no. EP/R010242/1), Innovate UK (grant no. 33486), Cytiva (formerly General Electric Healthcare Life Sciences) and Imperial College, Department of Bioengineering, for their generous support. F.G. and M.G. thank the Imperial College Centre for Processable Electronics and the Centre for Doctoral Training in Plastic Electronics, S. Yaliraki from Imperial College Department of Chemistry, T. Bell from Imperial College Department of Life Sciences, C. Mace from Tufts University Department of Chemistry and T. Schaul from (Google) DeepMind Technologies Ltd. F.G. also acknowledges Agri Futures Lab. M.K. acknowledges EPSRC DTP (grant no. 1846144). A.S.P.C. acknowledges BBSRC DTP (grant no. 2177734).

Author information

Authors and Affiliations



M.G. designed and performed most of the experiments and wrote the manuscript. G.B. designed the homemade electronics. T.A. produced the supplementary videos and iterated on Fig. 1. M.K. performed the soil measurements and maintenance. A.S.P.C. and J.W. performed measurements with the homemade electronics. F.G. designed the experiments and edited the manuscript.

Corresponding author

Correspondence to Firat Güder.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Peer review information Nature Food thanks Arben Merkoçi, Anna Herland and Ramses Martinez for their contribution to the peer review of this work.

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary information

Supplementary Information

Supplementary Figs. 1–17.

Reporting Summary

Supplementary Video 1

Video illustration of the chemPEGS for measuring NH4+.

Supplementary Video 2

Video illustration of the ML models constructed to predict the levels of soil-N.

Rights and permissions

Reprints and Permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Grell, M., Barandun, G., Asfour, T. et al. Point-of-use sensors and machine learning enable low-cost determination of soil nitrogen. Nat Food 2, 981–989 (2021).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:

This article is cited by


Quick links

Nature Briefing: Translational Research

Sign up for the Nature Briefing: Translational Research newsletter — top stories in biotechnology, drug discovery and pharma.

Get what matters in translational research, free to your inbox weekly. Sign up for Nature Briefing: Translational Research