Professional Documents
Culture Documents
Nishant Gupta
Department of Electrical Engineering
Indian Institute of Technology Ropar
Punjab, India
2022 IEEE Delhi Section Conference (DELCON) | 978-1-6654-5883-2/22/$31.00 ©2022 IEEE | DOI: 10.1109/DELCON54057.2022.9753548
nishantgupta.nic@gmail.com
Abstract—Nitrogen (N), Phosphorous (P), and Potassium (K) A fertile and rich soil results in better crop quality as
are considered the most important nutrients and are essential well as higher yield. There are various soil components that
components in the soil affecting the growth and yield of play a vital role in better production, such as soil moisture,
crops. For optimal growth of the plant, the nutrients N, P,
and K present in the soil must be in a balanced proportion. electrical conductivity, presence of elements such as nitro-
However, based on the parent material (like sand, peat, and gen (N), phosphorus (P), potassium (K), magnesium, iron,
clay), climatic conditions, and the differences in the past etc. [1]. The macronutrients in soil are very important for
management of the crop residues and the use of fertilizers, crop quality and yield and therefore needed to be estimated.
the farmers need to know the accurate proportions of N, P, According to that, farmers need to plan to fertilize the field
and K to maximize the crop growth, production, and yield.
Therefore, its measurement to maintain an accurate balance to get a good yield. Adequate fertilizer can impact good
is crucial. In this paper, two methods to estimate N, P, and quality crop and yield, so that the world’s increasing food
K in the soil are proposed which can provide results in real- demands are met.
time without the need for any chemicals. The first method
makes use of electrical conductivity and pH sensors to measure
In this paper, we focus on three main nutrients present
these parameters from the soil and uses machine learning in the soil, namely, nitrogen (N), phosphorus (P), and
techniques to estimate the N, P, and K values. The second potassium (K). These three nutrients increase the growth of
method makes use of optical sensors to measure the amount the plant in different ways; N promotes the growth of leaves
of light absorbed and reflected by the soil and uses regression and vegetation, P promotes root and overall plant growth,
techniques to estimate N, P, and K. In both cases, the N, P,
and K values are classified into different classes. We obtain
and K promotes flowering, fruiting, and keeps regulation of
more than 75% accuracy in both cases. A hand-held electronic nutrients and water in the plant cells. Over the shelf low-
device to measure N, P and K can be easily designed using cost sensors are available to measure some of the mineral
these techniques. The proposed schemes can optimize fertilizer contents in the soil. However, for elements like N, P and K,
usage as well as assist farmers in an economical and efficient chemical tests are available commercially which essentially
crop yield.
use mixing of certain chemicals to measure the N, P and K
Index Terms—NPK status, soil quality, smart farming,
machine learning, optical sensing presence in soil. To measure N, P and K content in different
soils, complex setups involving different set of chemicals
I. I NTRODUCTION are required which adds to measurement complexity, time,
The agriculture sector is the most significant and crucial and it also requires an expert to carry out the measurements
sector in the world. People in major parts of the globe in a chemical laboratory.
are still using traditional farming and crop management In this regard, this work presents two methods to measure
techniques, which are not very efficient in current envi- the N, P and K content in the soil. These methods can be
ronmental conditions, such as a sudden change in climate, implemented as an electronic device and do not require any
erratic irrigation, soil degradation, etc. As a result, there is use of chemicals or an expert person to operate. Further, un-
a decline in crop yield and quality. To address this issue, like in the chemical techniques, multiple soil measurements
an adaptive soil and crop management system is necessary. can be made without any additional requirements.
978-1-6654-5883-2/22/$31..00 © 2022 IEEE
Authorized licensed use limited to: Zhejiang University. Downloaded on November 12,2023 at 14:32:53 UTC from IEEE Xplore. Restrictions apply.
TABLE I
A L IST OF VARIOUS P RODUCTS D EVELOPED TO M EASURE D IFFERENT N UTRIENTS C ONTENT OF THE S OIL
Product Producer/supplier Method Nutrient detected
LaMotte AST-5 LaMotte Colorimetry NO3 -,N, P, K, Ca, Mg and Cl, Cu
Kasetsart University and
Kasetsart (N-P-K) Colorimetry N, P, K
Boon Din Thai Co.
Columbia Univ./ Univ. Electrode Sensor Meters for different nutrients,
SoilDoc N, phosphate, K, P, sulfate-S
of Maryland Colorimetry + Android App system
Botanico Soil Test Kit Amazon UK Colorimetry N, P, K
Mobile Lab SoilCares X-ray, fluorescence, (mid) infrared spectroscopy. N,P,K, Ca,Mg
Botanico Soil Test Kit Amazon UK Colorimetry NO3 -, N, NH4 +-N, P, K, Ca, Mg
Prerana Soil Testing Kit PRERANA Laboratories Colorimetry N, P, K
Soil Testing Kit Innovative Instruments, India Colorimetry N, P, K
NO3 -N,
Laqua Twin Nutrient Meters Spectrum Technology Meter with sensor
Ca, K, Na
Authorized licensed use limited to: Zhejiang University. Downloaded on November 12,2023 at 14:32:53 UTC from IEEE Xplore. Restrictions apply.
TABLE II TABLE III
N, P AND K C LASSIFICATION INTO T HREE C ATEGORIES , VIZ . L OW, M ACHINE L EARNING M ODELS USED TO E STIMATE N, P AND K
M EDIUM AND H IGH VALUES FROM S OIL P H AND EC M EASUREMENTS
Range N (in mg/kg) P (in mg/kg) K (in mg/kg) Model Inputs Description
Low 0-165 0-10 0-100 Linear Regression pH and EC Linear Regression is used.
Medium 165-270 10-45 100-200 Hidden Layers = 9, 40 Nodes in
Neural Networks pH and EC
High > 270 > 45 > 200 each layer, and 40 epochs.
Authorized licensed use limited to: Zhejiang University. Downloaded on November 12,2023 at 14:32:53 UTC from IEEE Xplore. Restrictions apply.
Fig. 3. Potassium content (mg/Kg) in the soil: actual versus estimated
using linear regression. (blue *: actual; red +: predicted) Fig. 6. Potassium content (mg/Kg) in the soil: actual versus estimated
using neural networks. (blue *: actual; red +: predicted)
TABLE IV
C LASSIFICATION ACCURACY OF N, P, AND K USING L INEAR
R EGRESSION AND N EURAL N ETWORKS
Model N P K
Linear Regression 60.73% 51.54% 51.09%
Neural Networks 81.34% 75.39% 76.81%
B. Key Takeaways
We observe that, in general, neural networks provide
better estimation accuracy as compared to the linear re-
gression. We conclude that the relation between N, P, K,
Fig. 4. Nitrogen content (mg/Kg) in the soil: actual versus estimated using
neural networks. (blue *: actual; red +: predicted)
pH and EC is non-linear. Further classification accuracy
of Nitrogen is better than the other two. Though neural
network gives better results, it comes with an expense of
squared error (MSE). Adam optimizer is used with 0.001 increased computational complexity. Next, we present an
learning rate. optical sensing method to classify N, P and K content in
Figs. 4, 5, and 6 present the actual and the estimate N, P the soil.
and K values respectively. The units of N, P, and K in fig
1, fig 2, fig 3 are in mg/kg. In this case, we observe that III. O PTICAL S ENSING M ETHOD
the estimated values of N, P and K are close to the actual
and better estimated than the linear regression case. N, P and K in the soil absorb specific wavelengths
Estimated N, P and K values are classified into low, incident on it. N absorbs wavelength from 438 - 490 nm,
medium and high using Table II. The classification accuracy P absorbs wavelength from 528 - 579 nm, while K absorbs
in this case is 83.34% for Nitrogen, 75.39% for Phosphorus wavelength from 605 - 650 nm. These wavelengths are close
and 76.81% for Potassium. We observe that this model to the specific colors found in the visible light spectrum. For
provides a better result than the previous case with clas- example, red occupies a wavelength of 650 nm. Similarly,
sification accuracy > 75% for all the elements. blue and green colors occupy 450 and 550 nm, respectively.
A summary of the classification accuracy in the two Therefore, in this optical sensing method, we make use of
models is shown in Table IV. the red, blue and green color LEDs to estimate the amount
of K, N and P contained in the soil, respectively. The light
from these LEDs is incident on the soil sample and the
intensity of light reflected from the soil sample is measured
to estimate the N, P and K content. Fig. 7 presents the
experimental setup for the optical sensing method.
Here three LEDs of three different colours (red, green
and blue) are used to incident the light on the soil sam-
ple. The reflected light is incident on a light dependent
resistor (LDR). Depending on the reflected light intensity,
the resistance of LDR changes which results in change in
the voltage level which is fed to the Arduino board. The
Arduino measures the absorbed and reflected light intensity
by the soil and estimates the N, P and K content in the soil.
Fig. 5. Phosphorus content (mg/Kg) in the soil: actual versus estimated The estimation mechanism is presented later in this Section.
using neural networks. (blue *: actual; red +: predicted)
The same is displayed on an LCD display.
Authorized licensed use limited to: Zhejiang University. Downloaded on November 12,2023 at 14:32:53 UTC from IEEE Xplore. Restrictions apply.
TABLE VI
R EFLECTED LIGHT INTENSITY OBTAINED FROM SAMPLES USING
VARIOUS LED S
Sample Blue LED (in lx) Red LED (in lx) Green LED (in lx)
1 25 34.5 32.5
2 27 34 29.5
3 29 37.8 29.5
4 25 33 29
5 21 33 31
6 23 35.5 31
7 20 33 28
8 20 34 30
Fig. 7. Experimental Setup For Optical Sensing 9 21-22 34 31
10 18-19 36 29
Authorized licensed use limited to: Zhejiang University. Downloaded on November 12,2023 at 14:32:53 UTC from IEEE Xplore. Restrictions apply.
TABLE VII terms of accuracy. On the other hand, the optical sensing
C OEFFICIENT OF DETERMINATION (D2 ) VALUES BETWEEN N ITROGEN method highlighted a new method to estimate the N, P and
CONTENT (N) AND L IGHT I NTENSITY ABSORBED , REFLECTED FROM
LED’ S R ED , B LUE , G REEN K content in soil. Both these methods can be implemented
Order Ra Ga Ba Rr Gr Br on an electronic device that can instantly provide the N, P
1st 0.0225 0.0065 0.5251 0.0237 0.0074 0.5329 and K values without the use of any chemicals or reusable
2nd 0.0560 0.0486 0.5433 0.06185 0.05943 0.5355 materials and the results can be obtained without any delay.
3rd 0.2691 0.3785 0.6406 0.2649 0.3451 0.6121
4th 0.3167 0.5077 0.7291 0.3138 0.513 0.7284
Future work would include improving the accuracy of
the two methods. One way could be to combine the two
methods to obtain a higher accuracy. For the optical sensing
TABLE VIII
C OEFFICIENT OF DETERMINATION (D2 ) VALUES BETWEEN method, the scheme could be analysed for soil samples
PHOSPHOROUS CONTENT (P) AND L IGHT I NTENSITY ABSORBED , collected from a diverse set of fields.The proposed schemes
REFLECTED FROM LED’ S R ED , B LUE , G REEN can be used to reduce excessive use of fertilizers in the soil
Order Ra Ga Ba Rr Gr Br as well as provide an economical and efficient solution to
1st 0.01947 0.0070 0.0086 0.0196 0.0097 0.0075
2nd 0.0199 0.3876 0.0275 0.0206 0.3851 0.0152 increase crop quality and yield.
3rd 0.1448 0.3879 0.1690 0.1457 0.3895 0.2045 R EFERENCES
4th 0.1475 0.8335 0.2758 0.1495 0.8295 0.2679
[1] R. P. Potdar, M. M. Shirolkar, A. J. Verma, P. S. More, and
A. Kulkarni, “Determination of soil nutrients (NPK) using optical
methods: a mini review,” J. Plant Nutrition, vol. 44, no. 12, pp.
K have good relation with the light intensities. For the 1826–1839, Feb. 2021.
estimation of N content in the soil, we can use blue color [2] C. Dimkpa, P. Bindraban, J. E. McLean, L. Gatere, U. Singh, and
D. Hellums, “Methods for rapid testing of plant and soil nutrients,” in
which has a higher coefficient of determination. Its D2 is Sustainable Agriculture Reviews, vol. 25. Springer, Cham, pp. 1–43,
0.7291 and the curve that fits best is a 4th order polynomial. July 2017. DOI: https://doi.org/10.1007/978-3-319-58679-3-1.
As we keep increasing the polynomial order, over-fitting [3] M. Yamin, W. I. bin Wan Ismail, M. S. bin Mohd Kassim, S. B.
Abd Aziz, F. N. Akbar, R. R. Shamshiri, M. Ibrahim, and B. Mahns,
may occur. To obtain an optimal polynomial, we need to “Modification of colorimetric method based digital soil test kit
have a large dataset. We pose this as a direction for future for determination of macronutrients in oil palm plantation,” Int. J.
work, wherein more diverse set of data can be collected to Agricultural Biological Eng., vol. 13, no. 4, pp. 188–197, Aug. 2020.
[4] R.-T. Liu, L.-Q. Tao, B. Liu, X.-G. Tian, M. A. Mohammad, Y. Yang,
obtain a more better estimate. and T.-L. Ren, “A miniaturized on-chip colorimeter for detecting
For the estimation of P content in the soil, as anticipated, NPK elements,” Sensors, vol. 16, no. 8, pp. 1234, Aug. 2016.
the green color has the highest coefficient of determination. [5] N. Chauhan and S. Urooj, “The effect of azadirachta indica extract on
Its D2 is 0.8335 and again the curve that fits best is a the soil nutrients and the npk value determination by electrochemical
sensor,” Int. J. Biosen Bioelectron, vol. 5, no. 3, pp. 81–87, May 2019.
4th order polynomial. For K content, the red color has the [6] M. A. Coutinho, F. d. O. Alari, M. M. Ferreira, and L. R. do Amaral,
highest D2 value of 0.7079. “Influence of soil sample preparation on the quantification of NPK
content via spectroscopy,” Geoderma, vol. 338, pp. 401–409, Dec.
2018.
TABLE IX [7] Y. Yunus, P. Satriyo, A. A. Munawar, “Rapid prediction of soil quality
C OEFFICIENT OF DETERMINATION (D2 ) VALUES BETWEEN P OTASSIUM indices using near infrared spectroscopy,” in IOP Conf. Series:
CONTENT (K) AND L IGHT I NTENSITY ABSORBED , REFLECTED FROM Earth Environmental Science, vol. 365, no. 1. Sep. 2019, p. 012043.
LED’ S R ED , B LUE , G REEN DOI:10.17632/ny6ks93bnp.1
Order Ra Ga Ba Rr Gr Br [8] M. Masrie, A. Z. M. Rosli, R. Sam, Z. Janin, and M. K. Nordin,
1st 0.042 0.0019 0.3638 0.04787 0.0017 0.3805 “Integrated optical sensor for npk nutrient of soil detection,” in Proc.
2nd 0.5293 0.0140 0.4087 0.5187 0.0145 0.4257 IEEE 5th Int. Conf. Smart Instrum. Meas. Appl. (ICSIMA), Thailand,
3rd 0.5784 0.0167 0.4995 0.5749 0.0162 0.5024 Nov. 2018, pp. 1–4.
4th 0.7079 0.04717 0.5021 0.7095 0.04251 0.5025 [9] F. Monteiro-Silva, P. A. S. Jorge, and R. C. Martins,
“Optical sensing of nitrogen, phosphorus and potassium: A
spectrophotometrical approach toward smart nutrient deployment,”
Chemosensors, vol. 7, no. 4, pp. 1–5, Oct. 2019. [Online]. Available:
C. Key Takeaways https://www.mdpi.com/2227-9040/7/4/51
From our experiments on samples collected, we observed [10] Y. S. Lisu Chen, Shihan Huang, E. Zhu, and E. Zhu, “Rapid
identification of potassium nutrition stress in rice based on machine
that the optical sensing method can be used to estimate the vision and object-oriented segmentation,” J. Spectroscopy, vol. 2019,
N, P and K content in the soil. Red, green and blue colored pp. 1–8, Sep. 2019. DOI: https://doi.org/10.1155/2019/4623545.
LEDs can be used to measure the K, P and N content in [11] H. Li, S. Jia, and Z. Le, “Quantitative analysis of soil total nitrogen
using hyperspectral imaging technology with extreme learning
the soil, respectively. This study can be considered as a machine,” Sensors, vol. 19, no. 20, pp. 1–13, Oct. 2019.
preliminary study, with more data from other places can [12] M. Suchithra and M. L. Pai, “Improving the prediction accuracy of
be collected and analysed to see how well our results soil nutrient classification by optimizing extreme learning machine
parameters,” Inf. Process. Agriculture, vol. 7, no. 1, pp. 72–82, Mar.
corroborate. Further, with a larger dataset, we can use other 2020.
machine learning algorithms to understand the dependency [13] G.-B. Huang, H. Zhou, X. Ding, and R. Zhang, “Extreme learning
of N, P, and K on different color intensity absorbed by them. machine for regression and multiclass classification,” IEEE Trans.
Syst., Man, Cybern. Syst., vol. 42, no. 2, pp. 513–529, Apr. 2011.
IV. C ONCLUSION [14] M. Masrie, M. S. A. Rosman, R. Sam, and Z. Janin, “Detection of
nitrogen, phosphorus, and potassium (NPK) nutrients of soil using
In this paper, we presented two method to estimate the optical transducer,” in Proc. IEEE 4th Int. Conf. Smart Instrum.,
N, P and K content in the soil which plays a crucial role Meas. Appl. (ICSIMA), Putrajaya, Nov. 2017, pp. 1–4.
[15] A. Bas, “Addressing point and nonpoint source phosphorus loads
in crop yield and quality. N, P and K estimation from EC at selected sites in tyngsborough, massachusetts,” Ph.D. dissertation,
and pH readings using neural networks faired average in Worcester Polytechnic Institute, 2020.
Authorized licensed use limited to: Zhejiang University. Downloaded on November 12,2023 at 14:32:53 UTC from IEEE Xplore. Restrictions apply.