Introduction

Soil is a complex system and a natural resource which consist of heterogeneous mixture of minerals, gases and organic matter. It supports life and hence it is responsible for plant growth and survival. A series of process steps are involved in maintaining this system. Due to the mentioned reasons, addressing soil quality is of utmost importance. There are several indicators of soil quality which is broadly classified into physical, chemical and biological indicators. A combined response is preferred while collecting information from these indicators. Some notable chemical indicators include the level of soil nitrate and pH. Most of these indicators give a brief idea about the correct functioning of the soil ecosystem and a status about the nutrient availability and level of contaminants. A right balance of nutrient along with key features like ideal pH can accelerate the crop production keeping the soil fertility intact. Soil pH is an indicator of the alkalinity or acidity of the soil. Most plants grow well in pH close to the neutral value even though some grow well in acidic or alkaline medium. A right amount of pH plays a massive role in maintaining the soil ecosystem as well as nutrient availability to plants. For example when the soil pH is low, nitrogen, phosphorous and potassium are tied up to the soil and becomes unavailable to the plants. Other nutrients like calcium and magnesium may be absent or deficient. The decomposition of organic matter by soil organisms slows down in soil with low pH. Soil fertility is a primary factor which determines the crop yield. Soil quality and fertility depletion are some of the serious issues to be analysed. There are about 17 plant nutrients essential for the growth of a plant out of which Nitrogen, Phosphorous and Potassium are the macronutrients. This paper is more focused on Nitrogen and its importance. A right balance of all these nutrients is necessary for plant growth. Nitrogen is available to the plants in various forms. In general, ammonium (NH4 +) and nitrates (NO3 ) are the chemical forms of nitrogen that the plant takes up. Ammonium releases hydrogen ion into the soil for every intake by plants thus making the soil acidic overtime by lowering the pH. The opposite is for anions like nitrates which decrease the hydroxide ions in the medium or the surrounding environment of the soil. Provided the advantages of ammonia in plant growth, too much of it can hinder its growth. When plants takes up excess ammonium and stores it, cell damage can occur. Symptoms of ammonium toxicity include upward or downward curling of lower leaves depending on plant species and yellowing between the veins of older leaves which can progress to cell death. In addition to this, presence of excess chemical in soil and its run-off leads to ground water pollution and disruption in the whole ecosystem. Hence there is a need to develop simple yet reliable systems to detect the right amount of nutrients for improving crop yield and also, considering the risk it poses to the environment. The technology employed in the field of agriculture has been evolving since there has been a rise in demand for food productivity over the following years. To increase crop yield fertilizers containing predominantly nitrate (N), phosphate (P) and potassium (K) are essential. One of the conventional ways of amending nutrient needs in agricultural field is the use of chemical fertilizers. However, accumulation of these chemicals have an adverse effect on the soil ecosystem. Hence there is a need to develop novel ways where only the right amount of fertilizers can be applied. Precision agriculture uses information technologies to segment a field into smaller units and determine each individual characteristics. In this way, the producer can apply production inputs at localized areas and precise quantity needed for maximum economic yield. The concept behind precision agriculture is that production inputs should be applied only as needed and where it is needed. A key in soil testing for formulated fertilization is to determine the amount of soil nutrients followed by recommendation of nutrient needs and site-specific fertilization. Integrated crop management systems have been designed to study spatial and temporal behaviour of NPK. Continuous monitoring of these along with proper pH, temperature and humidity is leading to automation in agricultural areas to improve crop productivity. A lot of development is seen wherein sensor prototype models have been developed so as to integrate it further into standard systems. In [1], a distributed polymer optical fiber sensing of moisture and pH in soils has been designed which is made feasible for e-agriculture. The system operates in the visible region of the spectrum. The principle used is monitoring of spatial differences around the root systems along the length of the fiber. The above approach helps in imaging soil behaviour and potentially the effect of plant roots. Colorimetric based sensor systems are also common. In [2], fiber optic based sensor was designed in order to detect the NPK nutrients of the soil. A colorimetric measurement of aqueous solution of soil has been carried out. It works on the principle of absorption of colour by soil. Similar work was reported where an optical sensor for analysis of soil nutrients by using LED light sources was presented. The sensor could detect the colour changes caused by chemical reaction between soil nutrients in the sample and colour developing reagents [3]. Studying the property of reflectance is a popular approach while developing optical based sensor systems. Near infrared diffused reflectance spectroscopy was employed to build up a portable system showing absorption peaks at 850 nm and 940 nm. It was also established from experimentation that with increase in the amount of chemical in the soil, greater intensity of light was absorbed [4]. In [5], an optical fibre ammonia sensor probe was developed. A bent optical fibre with dual coatings of poly methyl methacrylate (PMMA) and chloro-phenol red (CPR) was used to test for monitoring trace amount of ammonia. The sensor was found to be sensitive. It was also reversible and it has a response time of 25 min. It can be used for air quality monitoring. In [6], a highly selective optical fibre ammonia sensor was reported. It used a broadband optical source, optical fibre for transmission and a miniature ultraviolet/visible spectrometer for detection. The concentration level noted was between 0 and 2 ppm. Repeatability of the sensor was also verified through experimentation. The sensor so developed offered high sensitivity at low cost. Absorption spectroscopy was used in UV region for the ammonia sensing and also to check the cross sensitivity with oxygen and carbon dioxide gas in this region. An open path optical technique was used to analyse the absorption lines of ammonia as different gas react at different wavelengths. It was also found that at the wavelength range of 200 nm to 230 nm there was no cross-sensitivity resulting from carbon dioxide and oxygen. In order to derive information of a single soil nutrient existing systems like spectroscopy should be combined with newer techniques. One such system was reported in [7] where a MEMS light source was used in conjunction with reflectance spectroscopy for characterization of soil composition. It was proved to be advantageous in terms of cost, size and portability. The coefficient of determination of total nitrogen and organic matter was found to be 0.8324 and 0.8833. Several works has been carried out in predicting the various soil requirements in the near IR region. In [8], NIR spectroscopy described to be used in predicting the soil attributes. The goals of this study was to analyse the potential of NIR spectroscopy to estimate soil nitrogen content (N), phosphorus content (P), potassium content (K), organic matter content (OM), and pH and to combine these predictions with geographic information systems (GIS). Different soil types were considered in order to detect added nitrate to soil both in laboratory as well as in situ. Fourier transform infrared attenuated total reflectance method was employed. It gave a coefficient of determination (R2) as high as 0.98 for field experiments and 0.99 for laboratory experiments. Study on nitrate level is important since presence of abundant nitrate and soil can cause nitrate leaching posing a threat to ground water as well as drinking water supplies [9]. In another work presented in [10], near infrared spectroscopy used to study the detection methods for soil organic matter along with nitrogen, phosphorous and Potassium .54 samples were randomly divided into 40 prediction sets and 14 validation sets. Principle component analysis and LS-SVM was used to build up the prediction model with the coefficient of determination 0.87 for soil organic matter, 0.7206 for soil available nitrogen and 0.6858 for available potassium. Despite emerging and diverse applications of spectrophotometers, its use in the field is of great challenge due to its bulky nature. In [11], a portable soil nitrogen detecting system was designed. The developed model uses six LEDs which corresponds to six nitrogen sensitive wavebands (940, 1050, 1100, 1200, 1300, and 1550) and six photo-detectors. Nitrogen absorbance is highest near wavelength 1200 and 1300 nm. The device was calibrated Partial Least Square Regression (PLSR) analysis which gave a calibration coefficient of determination (R2) of 0.875 and a Validation (R2) of 0.803. Given the basic requirements of soil nutrients and its detection using sensors in various ways one of the factor to be considered is the environmental pollution. The use of fertilizers has enhanced crop yield in many ways but over-utilization of it can lead to degradation in the product quality. Amending the soil pH requires some form of chemical. For example lime is required in case of acidic soil whereas gypsum for alkaline. A lot of attention has been given wherein effects of polarization. In [12], a set-up was introduced in order to mend the soil pH level by using a circularly polarized light. Certain samples of acidic and alkaline soil were exposed to 85 W source for 1 h. It was found that circularly polarized light has the ability to significantly increase the pH of sandy loam acidic soil while it had no appreciable effect on the alkaline soil. This can be base for non-chemical means of managing soil acidity. It is expected that when the circularly polarized light strikes the soil samples, the electrons and ion cores will oscillate in response to the light’s electric field vector which is rotating and this could enhance the polarizability of the ions leading to the overall effect on the pH of the soil samples. In [13], the effect of circularly polarized light was made to study the electrical conductivity of aqueous solutions of soil nutrients and the process was found to be exothermic. It was also concluded that circularly polarized light significantly lowered the electrical conductivity. In [14], the sensor technologies which can be used in precision farming were introduced. Ideally sensor devices are fitted with a global positioning system to allow for soil data to be captured on-the-go and instantaneously converted into distribution maps. This will help in real-time monitoring and intervention of soil nutrient. In [15], two different samples taken from different fields were considered. The study was carried out for soil nutrient, texture and diffused reflectance between 250 and 2500 nm. The raw data was analysed to find the relationship between soil properties and reflectance data and also, the sources in the variability of the reflectance data. Reflectance spectroscopy have gained popularity in assessing soil macronutrients and other soil properties like pH of the soil. A similar work was reported in [16] where optical diffuse reflectance spectroscopy was used in order to predict soil pH, organic matter and macronutrients content. Through several experimentation and pre-processing methods, correlations between the measured soil properties and the spectra was established. Principle component analysis was carried out. It was concluded that the method so used was ideal for soil pH and OM content of unknown soil samples with coefficient of determination 0.92 and 0.85. In [17], nitrogen transformation in acid soils was studied in relation to pH changes. The transformation of nitrogen to other forms is different in acidic soil than alkaline and neutral soil. The aim of this work was to determine which application of fertilizer and lime material does not form toxic quantities of nitrite nitrogen and when the losses by denitrification are the lowest in the examined acid soils. Changes of available nitrogen forms were examined by the method of short-term incubation experiments. Remote sensing is used in order to study the chemical attributes of the soil. The application of fertilizers is, without a doubt, one of the greatest costs involved in agricultural production, and therefore, determining the best possible cost–benefit ratio for this type of input is very important. In this respect, it has been shown to be a valuable source of information in soil fertility variability management, especially after the establishment of precision agriculture [18]. One of the areas where precision agriculture has been commercially applied is in managing the variability in soil fertility. Technologies like variable rate applicators, variable rate irrigation, precision irrigation as well as dairy farm effluent irrigation sums up to sustainable management of agriculture. The variable rate modification units are programmed in such a way that different soil management zones are assigned for a particular unit. Similarly, fertigation, that is the application of nutrients in irrigation water to plants has evolved with irrigation technology which is more time and cost efficient than two separate operations applying water and nutrients. The practice of a single rate of N fertilizer applied across a whole crop may result in insufficient or excessive N fertilizer rates in certain positions because of the spatial variability of soil mineral N and potential yield within any unit. A more accurate estimate of plant N requirements is therefore required for economic and environmental sustainability [19]. The ability to use remote sensing data to determine fertilization needs of plants based on the nutrient content of crops and soils helps in increasing yields and improve the quality of harvested seeds and fruits, which is important for improving the crop profitability [20]. Soil productivity, spatial and temporal variability in crop is mainly influenced by both intrinsic and extrinsic factors. Precision farming is mainly used to optimize fertilizer use efficiency to improve crop production and quality [21]. Any plant nutrient can be available to the plant in many forms. Not all forms are equal and different forms have different significance. For Nitrogen, the common forms are ammonia, nitrate and urea. Many commercial forms are a mixture of the three. In [22], optimization of nutrient needs for greater productivity was described. It stressed on the importance of balancing the different soil nutrients as focusing attention on a single nutrient can take a toll on the other minor yet important nutrients. The near infrared spectral technology is the measuring technique which makes use of near infrared light to illuminate the sample, and then analyses the reflected light carrying the material information about the components of the sample. Through extensive literature survey, we can conclude that there has been a lot of research where optical methods and concepts are being implemented so as to develop effective sensor systems. Newer technologies are being combined with existing ones to create more compact and cost-effective systems. Simple components like LEDs are used to build portable systems which aims to replicate the existing systems. This will be advantageous in terms of size and cost. The conventional laboratory analysis is time-consuming and expensive. The use of spectrophotometer in the field directly is still a challenge. Moreover, considering the environmental factors and the degradation of soil quality over the following years, there should be alternatives to amend the fertilizer needs and requirements for specific plants and soil types. Studies are being carried out to amend soil pH without the use of chemicals.

Therefore, a novel technique for detection of soil nutrients is of ardent need. In this paper, an overview of an experimental set-up is presented in the interest of building a cost effective optical soil sensor that is focused on estimating the nitrogen and tailoring the soil pH as per need.

Experimental details

Several experiments were carried out for monitoring soil ammonia using a He–Ne laser source of wavelength 632.8 nm and a near infrared source of 850 nm. The same experiment was carried out for studying the effect of polarized light on pH of the soil sample using the same laser source of 632.8 nm. For monitoring soil nitrogen, experiments were carried out using the same 850 nm NIR source and analysed with urea as the source.

Materials and methods

Soil samples were collected from the turmeric and coconut fields at a temperature of 23 °C and relative humidity of 65%. Grid sampling was used to collect the samples. In each site, 5 samples were collected (one at the centre and four in each corner) at the depths of 15–30 cm (Fig. 1). The samples were air-dried for around a week. It was then grinded and sieved through a 2 mm sieve (Fig. 2). It was found to be clay-silty loam. The samples were mixed with distilled water to form an aqueous solution of the soil. Diffused reflectance was employed to obtain the reflectance ratio. An NIR source and a red source was chosen in the initial stages of the experimentation.

Fig. 1
figure 1

Grid sampling figure

Fig. 2
figure 2

Pre-processing steps

Monitoring soil pH and ammonia using red light source (He–Ne laser)

Polarization of light have been used effectively in various works and it can be defined as vibrations of light waves in a single plane. Linear polarization is a type of polarization in which the direction of electric field vector points in one fixed direction with varying magnitude whereas circularly polarized light wave possesses constant amplitude where the tip of the rotating electric field vector describes a circle.

Soil pH is an indication of acidity or alkalinity of soils and it is an indication of the amount of hydrogen ions present in the soil. As the amount of hydrogen ions in the soil increases, the soil pH decreases thus becoming more acidic in nature. Soil pH plays a key role and forms an important factor to be considered for soil nutrient management system. Soil pH governs many plant soil chemical reactions particularly the availability of micronutrients and toxic ions [23].

Factors such as organic matter decomposition, nitrogen fertilizer source, climatic conditions and also land management practices affects the soil pH. Variation in soil pH had been demonstrated by using circularly polarized light in [12]. However, in the current work, an attempt was made to study the effect of linearly polarized light on soil pH. The experimental set-up for controlling the soil pH without adding chemical fertilizers is shown in Fig. 3. It consists of a 632.8 nm He–Ne laser source, polarizer, beam expander and finally the soil sample mixed with distilled water.

Fig. 3
figure 3

Block diagram of experimental set-up

The pH change was measured using a pH paper and cross.-checked with litmus paper. The beam expander was used to help in alignment of the light from the source to the sample. Misalignments can lead to back-reflectance and hence loss of optical power. The laser source used is coherent in nature. The polarized light changes the pH of the sample. The experiment was carried out using the same source for checking reflectance of soil. Figure 4 shows the set-up.

Fig. 4
figure 4

Set-up for measuring the reflectance ratio of soil using laser source

The source is kept horizontal w.r.t. the sample. A photo detector is used to pick up the reflected light signal.

Monitoring of soil ammonia using IR LED

Figure 5 shows a schematic diagram for measuring the reflectance ratio of soil. It consists of an IR LED source and a detector along with the sample. The circuit is kept very close to the soil sample since it will measure the reflectance ratio of the soil. The source is kept vertically w.r.t. the sample.

Fig. 5
figure 5

Diagram for measuring reflectance using IR source

The Reflectance ratio which is the ratio of the output voltage to the input gives information about the absorption ratio since the two parameters are inversely proportional to each other. Several experiments were carried out in presence and absence of ammonia source. Input voltage was measured using a detector.

The reflected energy from the soil surface was noted and read as voltage change.

The reflectance ratio, R is given by

$$R = \frac{Output\;Volatge}{Input\;Voltage}$$
(1)

The corrected reflectance ratio,

$$R^{\prime} = \frac{R}{R0}$$
(2)

R0 is the empty beaker reflectance. This can be used to calculate the absorbance of a particular sample which is given by:

$$A = { \log }\frac{1}{{R^{{\prime }} }}$$
(3)

Experimental procedure of the proposed set up

The experiment was carried out in a dark room at room temperature. The apparatus was set up in an optical bench. Aqueous solution of the sample were made by taking about 50 g of soil and mixed with 10 mL distilled water. The container used was beaker which weighed around 100 g. Initially the reflectance ratio of the beaker was calculated. Distilled water was used in order to maintain the neutral nature of the sample taken. Figure 6 shows the soil samples taken. In addition to this various combinations of urea in soil were made and response to the same 850 nm was studied, analysed and compared with the experiments on ammonia. A database was formed from the raw data so collected. Statistical analysis was carried out as well as system parameters like accuracy, error, precision, repeatability, reproducibility were verified and found to be satisfactory. Also based on results two algorithms namely SRA and SCR (discussed in next section) were developed where the success rate was 95% and 96% respectively.

Fig. 6
figure 6

Soil samples

For the experiment of tailoring the pH of a soil sample by using a polarizer, it can be rotated in any angle. For this particular experiment it was kept around 0–30°. The source and the sample to be measured was kept at a distance around 40 cm. The pH of the sample was tested before subjecting it to the polarized light and it was found to be neutral by a standard pH paper indicator. The sample was exposed for about 1 h and it was observed that the sample was changed to slightly acidic which was confirmed by a standard pH paper. The source used here is a 632.8 nm He–Ne laser source which is coherent in nature.

Figure 7 shows the set-up for tailoring pH using a polarizer. The next experiment was carried out for calculating the reflectance ratio of soil when subjected to a coherent source like laser as well as a non-coherent source like the IR LED. A 5 V supply was used to light up the LED. The results were compared and analysed. The next step is the addition of ammonia or nitrogen source to the soil so as to check the changes observed in the reflectance ratio as well as the absorbance. Different concentrations of ammonia were added to the soil and the response was recorded. The source of ammonia used was ammonium hydroxide. The experiment was carried for several samples from the same sample itself and the response was noted after every 10 min. Figure 8 shows the experimental set-up for monitoring soil ammonia using NIR source.

Fig. 7
figure 7

Set-up for tailoring pH using polarizer

Fig. 8
figure 8

Set-up for measuring reflectance ratio of soil using IR LED

Results and discussion

The response of the samples taken to the He–Ne laser source is shown in Fig. 9 and the values corresponding to the above response is tabulated in Table 1.

Fig. 9
figure 9

Response in He–Ne laser source

Table 1 Reflectance ratio of soil when illuminated with He–Ne laser source

Another experiment was set up in order to study the effect of polarization on the pH of the samples taken. A He–Ne laser source of 632.8 nm was used. From Table 2, it can be seen that the samples which was previously neutral was changed to slightly acidic. As the sample is subjected to linearly polarized light for a duration of about 1 h, the molecular vibration of sample increases which leads to decrease tendency to form hydrogen bonds. As a result of this there is an observable reduction in soil pH.

Table 2 Effect of polarized light on neutral soil samples

Different crops have different soil pH requirement. For example, Assam tea (a type of tea plant grown in a North-Eastern state of India) grows well in acidic soil. So, the findings listed in Table 2 can serve as a very important cue for tailoring soil pH as per the needs of the crop and therefore be of significance to site specific crop management practices.

In both the cases the reflectance from the samples were found to be almost constant. But an IR LED was preferred over a laser source because of the alignment w.r.t. the soil sample. The detector collects the reflected light at a much better rate since it is kept very near to the soil surface. For a horizontal alignment picking up of reflected optical signals is difficult. After extensive experimentation it was found that with increase in the amount of chemical in soil, the absorbance increases and hence reflectance decreases. Figure 8 shows the response of the sensor system to variable amount of chemical. Different amounts of chemical was added to the soil sample taken and the response was analysed. Table 3 corresponds to the normalized absorbance values. Figure 10a shows that how mean absorbance varies with variable amount of chemical added to the sample and Fig. 10b shows the trend observed in some set of experiments. Table 4 gives the correlation values between various samples.

Table 3 Response of samples to IR source
Fig. 10
figure 10

a Absorbance versus Amount of chemical. b Trend observed in some experiments

Table 4 Correlation between various experiments

The experiment was conducted several times in order to establish the repeatability of the sensor system. It can be seen from Fig. 11a that for all the experiments under consideration, the value was found to be almost coinciding and Fig. 11b shows the trend observed in some experiments.

Fig. 11
figure 11

a Repeatability of the Sensor System. b Trend observed in some experiments

The system was also found to be stable when tested with the 850 nm source. We tested the reflectivity of samples consisting of variable amount of chemical while keeping the amount of soil as well as water same for all the experiments. A total of ten different amount of chemical was taken. It was found that for a particular amount, the response was stable with minimum random points. The test results were satisfactory. Figure 12 shows the scatterplot of ten sets of experimental data tested.

Fig. 12
figure 12

Stability of the sensor system

Stability can be proved through the cross-correlation values between various samples listed above. It showed that the value was stable particularly from sample 1 to sample 14 as shown in Fig. 13. Several experiments were carried out in order to establish a trend followed when variable amount of urea was added in known amount of soil. The results showed that with increase in the amount of chemical added, the reflectance decreases. In other words, the absorbance of the soil increases. The above experiments yield a satisfactory result which can be seen from the graphs shown below as shown in Fig. 14.

Fig. 13
figure 13

Stability based on correlation coefficient

Fig. 14
figure 14

Trend observed for urea in soil

The experiment was repeated for various combinations of urea in soil. Every combination from the whole set was repeated several times in order to establish reproducibility of the system. Table 5 and Fig. 15 corresponds to experimental values and response of one set of combination repeated 5 times. Urea was added in the soil sample taken from the turmeric field. For 10 grams of soil, the amount of urea was varied from 1 to 5 g. An aqueous solution was made using 5 mL distilled water and the response was noted. The graph below depicts the repeatability of the system as shown in Fig. 15.

Table 5 Response of the system for variable urea amount in 10 g soil
Fig. 15
figure 15

Repeatability established for urea in soil

The repeatability of the system can be verified from the auto-correlation of the different experiments of the same combination. For example, for variable amount of urea in 10 g soil, the auto-correlation between the experiments of the same combination was found in Table 6.

Table 6 Autocorrelation between samples (repeatability)

Cross-correlation can also be performed to establish the reproducibility of the system. Table 7 represents the cross-correlation between various samples.

Table 7 Cross-correlation between the samples

Seven different combinations of urea in soil were made. One set of combination was repeated several times and the average was taken. The response of the first two values out of the five combination of all the datasets were combined and categorized as low nitrogen content. The next value was combined and categorized as medium and the last two values as high. Based on the ratio of urea in soil, the threshold for low content was between 10 and 20% whereas for medium it was 30% and for high it was 40 and 50% as represented in Fig. 16 and Table 8.

Fig. 16
figure 16

Reflectivity versus percentage of urea

Table 8 Relation between samples

The reproducibility of a system is a useful indicator of the precision of the system. With relevance to this work, it is the degree of agreement between the results of experiments conducted for different sets of combinations. It measures the ability of a system to replicate the measurement for the entire study. Another parameter that aids to the study of sensor systems is the success rate. It describes the percentage of success for a number of attempts carried out in an experiment. It can be represented mathematically by:

$$Success\;rate = \frac{True\;positives}{Total\;number\;of\;attempts}$$

Based on the analyses of the sensor output obtained by repeated experiments, the two algorithms developed were.

Soil reflectivity based algorithm 1 (SRA)

The first algorithm can be stated as:

  • Take a known amount of soil (x)

  • Add unknown amount of chemical or Urea (y)

  • Obtain the reflectance data (z)

  • Initialize the standardized values as low → L, medium → M and high → H

  • If |(L-z)| < |(M-z)| & |(H-z)| then output is low else if |(M-z)| < |(L-z)|& |(H-z)| then is medium else if |(H-z)| < |(M-z) |&|(L-z)|, then its high.

Figure 17 shows the soil reflectivity based algorithm 1.

Fig. 17
figure 17

Soil reflectivity based algorithm 1

Soil–chemical ratio based algorithm 2 (SCR)

In this approach, the raw data in the data base were compared with the values obtained from the standard fitted graph. The algorithm was verified with the 40 g standard graph. Figure 18 shows the soil chemical ratio based algorithm 2.

Fig. 18
figure 18

Soil–chemical ratio based algorithm 2

The second algorithm:

  • Take a known amount of soil (x)

  • Add unknown amount of chemical or Urea (y)

  • Obtain the reflectance data (z)

  • Compare the reflectance data with the values obtained from the standard fitted graph.

  • Obtain the amount of urea from the fitted graph say y1

  • If 0.1 ≤ (y1 ÷ x) ≤ 0.2 then output will be displayed as LOW else if 0.3 ≤ (y1 ÷ x) then it is MEDIUM else if 0.4 ≤ (y1 ÷ x) ≤ 0.5, then output will be displayed as HIGH

Test analysis was carried out in order to check the validity of the algorithms so developed. It yielded a success rate of 95 and 96%. The correlation coefficient became a powerful tool in this work. Another such representation through correlation coefficient is the comparison of the two sources as shown in Fig. 19.

Fig. 19
figure 19

Precision of the developed system

The system was found to be stable when tested with both the sources of nitrogen, i.e., urea as well as ammonium hydroxide. The plot of correlation coefficients shown in Fig. 19 verifies the repeatability of the sensor system with the two sources of nitrogen where the blue line indicates the value for Urea and the red line for Ammonium hydroxide. A similar trend was observed in both cases. Hence, precision of the system was validated.

The predictive model based on regression analysis

Regression analysis was performed and a prediction model was developed. The coefficient of determination between the predicted and the measured value was found to be 0.9828 (Fig. 20).

Fig. 20
figure 20

Relationship between measured and predicted values of absorbance

The maximum absolute error of absorbance was found to be 0.028 as shown in Table 9.

Table 9 Prediction results for absorbance corresponding to nitrogen inputs

Conclusion

Although a lot of research work has been carried out in order to develop on-the-go sensors, real-time implementation for detection/monitoring of a particular type of macronutrient is still a road-block to the developing sensors and existing systems. In the present work, simple experiments were carried out in order to form a base for developing a more compact integrated sensors used for detecting the soil nutrients as well as tailoring of soil pH. In the first experiment, the pH of the soil sample was tailored using a polarizer which gives a base for managing the soil alkalinity and acidity without the use of any chemical agent. Several experiments were carried out with laser as well as near infrared source. Factors such as stability and repeatability of the sensor system was verified through experimentation. It was also found that with increase in the amount of chemical present in soil, the absorbance increases and reflectance decreases. Based on this analysis, two algorithms were developed which yielded a success rate of 95 and 96% respectively. The experimental results and the statistical analysis obtained, validates the satisfactory performance of the developed system.

We further intend to study the effect of temperature and soil pH on nitrogen availability in future work which can be then integrated with the developed nitrogen sensing framework presented in this paper, and thereafter a standard portable instrument can be designed for soil pH tailoring and nitrogen monitoring. Such an instrument would be of great significance to the farmers as well as for the environment as it would aid in application of accurate amount of nitrogen fertilizer to soil thereby reducing the cost of soil fertility maintenance and also protecting pollution of ground and surface waters.