ASABE Logo

Article Request Page ASABE Journal Article

Evaluation of Low-Cost UV-Vis Spectroscopy for Measuring Nitrate Using Synthetic Water Samples

Joe Barrett Carter1,*, Ashley Sarkees1, A. Singh1, Eban Bean1,**


Published in Journal of the ASABE 66(4): 929-941 (doi: 10.13031/ja.15502). Copyright 2023 American Society of Agricultural and Biological Engineers.


1Agricultural and Biological Engineering, University of Florida, Gainesville, Florida, USA.

Correspondence: *jbarrett.carter@ufl.edu, **ezbean@ufl.edu

The authors have paid for open access for this article. This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License https://creative commons.org/licenses/by-nc-nd/4.0/

Submitted for review on 16 December 2022 as manuscript number ITSC 15502; approved for publication as a Research Article by Associate Editor Dr. Tamie Veith and Community Editor Dr. Seung-Chul Yoon of the Information Technology, Sensors, & Control Systems Community of ASABE on 20 May 2023.

Highlights

Abstract. Water quality data collection is an essential component of water systems management. For instance, the effective management of nutrients in hydroponic systems is necessary for maximizing yields efficiently and sustainably. Additionally, nutrients in natural and engineered waterbodies must be monitored to ensure they are meeting the required chemical characteristics for their ecological and social functions. However, conventional water quality data collection methods place limitations on water systems management due to their high resource requirements. Nitrate (NO3) is a major nutrient in ecological and agricultural systems, which can be reliably measured with ultraviolet-visible (UV-Vis) spectroscopy, a highly established technique for water quality analysis. The goal of this research was to evaluate a novel, low-cost, modular UV-Vis spectroscopy setup (GatorSpec) for the measurement of NO3 concentration in chemically complex solutions. UV-Vis absorbance of synthetic samples was measured using the GatorSpec and a commonly used bench-top laboratory spectroscopy system, the NanoDrop2000C. These data were analyzed using principal component analysis (PCA) to compare the spectral data produced by each system and partial least squares (PLS) regression to compare their ability to predict NO3 concentration. Results showed that data from both measurement systems were similar, indicating that the low-cost GatorSpec provided similar measurement accuracy to that of the laboratory reference system, the NanoDrop2000C. The PLS results revealed that for the diluted samples, the models derived from both systems were very good at predicting NO3 concentration. With these outcomes, it can be concluded that the GatorSpec is effective at measuring NO3 concentration in complex solutions and is comparable in performance to that of the NanoDrop2000C. In the future, this low-cost setup could be used to manage NO3 concentrations more efficiently in various applications such as hydroponic plant production, environmental monitoring, and stormwater treatment, which, in turn, could reduce the economic and environmental costs of these systems.

Keywords. Low-cost, Synthetic samples, Ultraviolet-visible absorption spectroscopy, Water quality.

Water quality in the United States and throughout the world is declining as the human population increases and the demand for food from agriculture increases (United Nations Environment Program, 2021). One of the most significant contributions of water pollution by agriculture is the eutrophication of waters by nutrients exported via agricultural runoff (Chislock et al., 2013). Other sources of water pollution caused by human activities include the release of untreated or insufficiently treated wastewater and urban stormwater runoff, which can take the form of diffuse nonpoint source pollution or point source pollution. The multiple sources and mechanisms by which pollution is introduced into the environment pose challenges to understanding and preventing water pollution.

Various technologies are currently under development that could assist in the prevention of water pollution. For instance, alternative food production systems such as hydroponics could be used to reduce fertilizer and pesticide requirements for food production (Armanda et al., 2019; Swain et al., 2021; Van Ginkel et al., 2017). Hydroponic systems, which grow plants in a highly controlled environment using an engineered nutrient solution, can also be used to study plant nutrient/pollutant uptake and dynamics (Le Bot and Kirkby, 1992; Saber et al., 2018; Zhang et al., 2008). In the field of civil infrastructure, technology and methods are being developed for real-time control of stormwater and wastewater treatment processes, which can be used to optimize the performance of these systems in terms of their effectiveness at reducing water pollution and their efficiency of doing so (Li, 2020; Mullapudi et al., 2017; Vezzaro et al., 2014; Wong and Kerkez, 2018; Wong and Kerkez, 2016).

One of the major challenges for the modernization of pollution prevention through the implementation of advanced technologies is the need for continuous, high-frequency water quality monitoring (Huang et al., 2022). For instance, hydroponics requires continuous monitoring of nutrient concentrations to prevent nutrients from reaching concentrations that are toxic or deficient to the plants (Bamsey et al., 2012; Resh, 2012; Sambo et al., 2019). Further, real-time control schemes in water treatment systems cannot be implemented without the ability to provide water quality feedback to the control algorithm. While some water quality sensors, such as ion-selective electrodes, are readily available for use in water management systems, these sensors are limited in the number of ions (e.g., NO3, ammonium, chloride, etc.) that can be measured and can be problematic due to sensor drift and maintenance requirements (Cho et al., 2017, 2018; Jung et al., 2015). Thus, the development of alternative water quality sensors that can be used for monitoring multiple nutrients simultaneously is needed for the optimization of nutrient management in advanced water systems such as hydroponics, water treatment systems, and environmental monitoring networks.

According to Chatwal and Anand (2009), “spectroscopic techniques form the largest and most important single group of techniques used in chemistry.” Ultraviolet-visible (UV-Vis) spectrophotometers measure electromagnetic radiation (i.e., light) absorbed, reflected, or transmitted by a medium at wavelengths within the UV-visible range (wavelengths of approximately 190 to 700 nanometers; Vitha, 2018). Atoms and molecules absorb light at distinct wavelengths to reach discrete electronic, rotational, and vibrational energy levels. Thus, absorbance for regions of the UV-Vis spectrum is correlated to specific molecular structures, and the magnitude of absorbance is related to chemical concentrations following Beer’s Law (Mayerhöfer et al., 2020; Vitha, 2018). Absorption spectra can therefore be leveraged for the simultaneous quantification of multiple compounds. However, the relationship between UV-Vis absorbance and concentration becomes complicated for highly concentrated and complex samples due to the broadening, blue-shift, and overlap of molecular spectra (Mayerhöfer et al., 2020; Ryska, 2015). In addition, current methods of gathering UV-Vis absorbance data and water quality data are relatively expensive, costing $10,000 to $20,000, and are tedious to conduct, requiring technical expertise (Huebsch et al., 2015). This may explain why UV-Vis absorption spectroscopy remains underutilized in the management of water systems.

In recent years, technological advancements such as modular spectroscopy equipment, open-source programming and computing, and development in machine learning methods have expanded the application of UV-Vis absorption spectroscopic techniques to various settings, including hydroponics, wastewater, surface water, and groundwater (Lepot et al., 2016; Monteiro-Silva et al., 2019; Salivon et al., 2018; Silva et al., 2021). Multiple studies have focused on optimizing calibration models for relating nutrient concentrations to absorption spectra for surface water and wastewater (Avagyan et al., 2014; Etheridge et al., 2014; Lepot et al., 2016; Qin et al., 2012). However, most past studies on this topic tend to use off-the-shelf spectroscopy systems that are limited by cost, the need for technical skills, and reliance on proprietary software. More recently, researchers have begun to develop low-cost alternatives for performing UV-Vis absorption spectroscopy using modular spectroscopy equipment, sometimes coupled with machine learning techniques (Monteiro-Silva et al., 2019; Salivon et al., 2018; Silva et al., 2021). These low-cost spectroscopy systems are built with modular equipment, which allows for a given measurement system to be tailored towards a specific application. Incorporating microcontrollers and microcomputers such as Arduino and Raspberry Pi to control the low-cost measurement systems can also allow for software features to be easily added to the system, such as network connectivity and the implementation of real-time control. However, these studies did not evaluate the performance of low-cost, modular spectroscopy systems compared to standard, laboratory-grade systems to determine the feasibility of using low-cost technologies. Yet, low-cost systems may be inferior to off-the-shelf systems in terms of spectrometric parameters such as spectral resolution and signal-to-noise ratio. Modular spectroscopy components may not be calibrated to the same standards as laboratory-grade equipment. These issues could potentially increase measurement error when the systems are used to estimate water quality parameters. However, the degree to which lower spectral performance impacts measurement performance has not been widely assessed for these low-cost spectroscopy systems.

The objective of this study was to evaluate a modular, low-cost ($2500) spectroscopy system for water quality analysis by comparing its performance for analyzing NO3 concentrations in synthetic aqueous nutrient samples in relation to that of a laboratory-grade spectrophotometer. It was hypothesized that the function of the two systems would not be significantly different based on the variations in their respective absorbance data and the relationships of the variations with the ions in the sample solutions. It was also hypothesized that the sensitivity of absorbance to NO3, specifically, would increase upon sample dilution, and this would improve the precision of concentration estimates. Once validated, alternative spectroscopy systems such as the one used in this study could be used to cost effectively advance the monitoring and management of nutrients in water systems such as hydroponics and water treatment systems.

Materials and Methods

In this study, a low-cost, modular, open-source spectroscopy setup (referred to here as the ‘GatorSpec’) was evaluated in terms of its spectral and water quality measurement performance by comparing it to a laboratory-grade spectrophotometer (a NanoDrop2000C or ‘NanoDrop’, for short). GatorSpec is a low-cost, modular, open-source spectroscopy system at the University of Florida’s Department of Agricultural and Biological Engineering (Carter et al., 2022). The GatorSpec system is shown in figure 1. GatorSpec has a spectral range of 184.2 nm to 663.1 nm, and a nominal spectral resolution of 0.45 nm. The NanoDrop has a spectral range of 190 nm to 840 nm and a resolution of < 1.8 nm.

Figure 1. The GatorSpec benchtop spectroscopy setup. The three main components are labeled with manufacturer and part number.

The GatorSpec and the NanoDrop were compared in two ways. First, the two systems were compared using a principal component analysis (PCA) of the absorbance data, and their accuracy and precision of predicting NO3 concentrations in synthetic samples was compared based on partial least squares (PLS) regression. Due to interferences caused by overlapping absorption spectra of multiple compounds present in the solutions, machine learning (ML) methods were used to reduce the dimensionality of the absorbance data, approximate the complex mathematical relationships between the absorbance measured by the two systems and NO3 concentration, and derive statistics for comparing the two systems.

Synthetic Sample Solutions

The synthetic samples used in this study were designed to be chemically representative of natural samples using a variety of nutrient-containing compounds that are known to supply sufficient nutrition to plants and to absorb light in multiple regions of the UV-visible spectrum. Two different concentration ranges were also used to evaluate the performance of the GatorSpec for two different sample classes: dilute (i.e., surface water and groundwater) and concentrated (i.e., hydroponic nutrient solutions and eutrophic soil pore water). Forty-six synthetic nutrient solutions and their dilutions were created with eleven compounds (10% iron chelate DTPA, calcium nitrate, copper sulfate, magnesium sulfate, manganese sulfate, monopotassium phosphate, potassium nitrate, sodium molybdate, sodium borate, zinc sulfate, and nitric acid; table 1), which are commonly used as mineral fertilizers in commercial hydroponic production systems to provide essential nutrients to plants (Resh, 2012). These additional compounds also emulate the complex concentrations found in a range of water resource samples that may interfere with measuring NO3 concentrations.

The undiluted, high concentrations for each compound were determined based on their chemical composition and optimal concentrations for hydroponic lettuce production reported by multiple authors (Aini et al., 2019; Domingues et al., 2012; Trejo-Tellez and Gomez-Merino, 2012). The concentrations reported from the literature for each macronutrient present in the undiluted synthetic solutions are shown in table 2. To prepare the synthetic solutions, random combinations of the eleven compounds were dissolved in water. The target concentration of each compound in each sample was determined by sampling from a uniform distribution ranging from zero to twice the optimal concentration of the compound.

The solutions were created by dissolving the compounds in 50 mL of tap water. The tap water, which contained variable amounts of calcium and magnesium carbonate, was used to provide a randomized buffering capacity to the solutions and better represent the characteristics of real samples. Any compound added with a mass over 14 mg was weighed using an analytical balance with a precision of 0.1 mg and added directly into the solution. When the mass to be added was under 14 mg, aliquots from stock solutions were pipetted and mixed into the solution. Stock solutions were created by weighing out approximately 100 mg of the compound and dissolving it in 50 mL of water, leaving a concentration of approximately 2000 mg L-1. The stock solutions were then diluted to the appropriate concentrations for the solution. The minimum volume of the pipettes was 10 µL. When the volume needed to be added was below the minimum limit, a dilution of the stock solution was made so that the required mass of compound could be added to the solution using a volume greater than 10 µL. A 1:30 dilution was also created for each sample, as that was the approximate midpoint of the absorbance range by the GatorSpec system for a sample with an ideal NO3 concentration.

Each undiluted and diluted sample was then sent to the UF|IFAS Environmental Water Quality Lab for analysis. The reported concentrations were considered the “true concentrations”. NO3 and ammonium concentrations were determined using colorimetry following EPA methods 353.2 and 350.1, respectively. Electrical conductivity (EC) and pH were measured using their respective sensors following EPA methods 120.1 and 150.1, respectively. All other nutrient concentrations were measured using inductively coupled plasma atomic emission spectrometry following EPA Method 200.7.

Table 1. The compounds used to create the synthetic samples and their nutrient contents (% by mass). Non-zero values are in bold case for clarity.
CompoundNO3-NNH4 -NPhosphorusPotassiumCalciumMagnesiumSulfate
Iron Chelate DTPA0000000
Calcium Nitrate14.41.1001900
Copper Sulfate00000038.08
Magnesium Sulfate000009.6538.4
Manganese Sulfate00000055.6
Potassium Phosphate0022.728.3000
Potassium Nitrate130038.2000
Sodium Molybdate0000000
Sodium Borate0000000
Zinc Sulphate00000052.2
Nitric Acid22000000
CompoundBoronZincManganeseIronCopperMolybdenum
Iron Chelate DTPA0001000
Calcium Nitrate000000
Copper Sulfate000025.190
Magnesium Sulfate000000
Manganese Sulfate0031.8000
Potassium Phosphate000000
Potassium Nitrate000000
Sodium Molybdate0000039
Sodium Borate20.9500000
Zinc Sulphate035.50000
Nitric Acid000000
Table 2. Optimal nutrient concentrations, in mg L-1, for hydroponic plant growth and references.
Hoagland and Arnon (1950)Hewitt
(1966)
Cooper
(1979)
Steiner
(1984)
Aini
et al.
(2019)
Domingues
et al. (2012)
Average
N210168218168190147184
P314160315021.739.1
K234156300273210163.8223
Ca160160177.5180200140170
Mg343650484033.640.3
S64486833611143.4112
Fe2.52.8123.053.54.80
Cu0.020.0640.10.020.50.0140.120
Zn0.050.0650.10.110.180.0350.090
Mn0.50.5420.620.50.350.752
B0.50.540.30.440.260.350.398
Mo0.010.040.2-0.0070.0070.053

Spectrophotometry

The UV-Vis absorbance of diluted and undiluted samples was measured using both the GatorSpec and the NanoDrop. Absorbance values require comparing the intensity of light passing through the sample with that of light passing through a reference sample. The reference used for each analysis was deionized water. Each spectroscopy system measured the intensity of UV-Vis light passing through a 1-cm path of the reference or sample within a quartz cuvette. A 1-cm optical pathlength was chosen based on it being a standard value used in laboratory analysis. Absorbance was calculated from measured intensity with equation 1, where IO is the intensity of light passing through the reference, and I is the intensity of light passing through the sample (Mayerhöfer et al., 2020).

(1)

The samples were analyzed on the GatorSpec using a programmed control system and graphical user interface. Each measurement was collected using an integration time of 23 milliseconds determined by limiting maximum photon counts to 75% of saturation. The absorbance measurements collected by each spectroscopy system and each level of dilution resulted in a data frame with n rows and p columns, where n is equal to the number of samples (in this case, 46) and p is equal to the number of wavelengths measured by the system; the NanoDrop measures absorbance at 651 wavelengths while the GatorSpec measures at 1024 wavelengths.

Data Analysis

The goal of PCA is to reduce the dimensionality of a dataset by transforming a larger set of variables into fewer principal components while preserving as much information as possible. PCA is an unsupervised statistical technique that analyzes a dataset with many correlated variables and captures the most important information from the data to express it in fewer uncorrelated variables called principal components (Abdi and Williams, 2010). This is done by grouping variables that are linearly correlated into principal components, each of which is linearly orthogonal to all others. Further, each principal component captures more of the total variation in the dataset than each successive principal component. Since PCA is an unsupervised analysis, no information about the NO3 concentrations of the samples is used in the dimensional reduction algorithm. PCA results in a new dataset called a loading vector corresponding to each new independent variable (i.e., principal component), which has the same length (i.e., number of samples, n) as the original dataset. PCA is often used for the analysis of absorbance spectra since absorbance at a given wavelength is typically correlated to absorbance at neighboring wavelengths (Brereton, 2018). Thus, PCA was performed on the absorbance datasets produced by both systems, the GatorSpec and NanoDrop, using the scikit-learn library for Python (Pedregosa et al., 2011). PCA was also used to determine the most meaningful dependent variables/features, and in this case, wavelengths, to re-express the data. A linear regression was performed on the loading vectors for the first principal components and nitrate concentration to compare the two spectroscopy systems regarding the relationship between the data they produce and the chemical composition of the samples.

Figure 2. Partial least squares (PLS) model training and comparison procedure.

Multiple compounds in a solution affect spectral absorbance, and it is difficult to parse out the effects of each compound on the absorbance within chemically complex solutions. Further, each compound affects absorbance at multiple wavelengths, and it is difficult to determine which wavelengths are necessary to accurately estimate chemical concentrations. Partial Least Squares (PLS) regression was performed using the scikit-learn library in Python to relate the absorption spectra produced by each spectroscopy system to laboratory-measured NO3 concentrations and subsequently compare the spectroscopy systems’ performances (see fig. 2). PLS is a standard chemometric analysis technique, and is especially useful for over specified models, which contain more variables than observations and when issues of multicollinearity preclude the use of standard least squares techniques. For this analysis, 70% of the absorbance and nitrate concentration data was used as training data for developing the model, while 30% of the data was used to evaluate the model’s ability to predict NO3 concentrations. Five-fold cross validation was used on the training set to determine the optimal number of components for the PLS model in terms of the sum of square errors (SSE). Predicted values for NO3 concentrations in each sample were obtained with the absorbance data of the test set. These values were compared with the laboratory measured NO3 concentrations (i.e., true values) of the test set using linear regression and by calculating performance metrics (r2 and RMSE).

Results and Discussion

Macronutrient Concentrations

As shown in figure 3 and according to laboratory analysis results, the median concentrations of the chemicals added to the synthetic samples were approximately equal to the average concentrations shown in table 2, and the concentrations typically varied between approximately zero and twice the median concentration. For NO3, this resulted in a median concentration of 178 mg L-1, a minimum of 66.8 mg L-1, and a maximum of 258 mg L-1. Chemicals present at concentration levels similar to NO3 were K and Ca.

The synthetic sample recipes were generated with the goal of each nutrient being present at a randomized concentration that is independent of other nutrients to ensure that any relationship between a given nutrient concentration and UV-Vis absorption would be due to the direct effects of the nutrient rather than the effects of a correlated nutrient. The mean correlation coefficient and the mean squared correlation coefficient were 0.057 and 0.067, respectively. Thus, nutrient concentrations were, on average, weakly positively correlated. The presence of generally weak correlations signifies that the nutrient recipes used in the study were effective at producing independent nutrient concentrations. However, there were four nutrient pairs that were significantly more correlated than all others (fig. 4), two of which contained NO3; NO3 had a strong positive correlation with Ca (r = 0.895) and ammonium (r = 0.907). This is undoubtedly due to the same compound, calcium nitrate, being the main source of NO3 in the solutions and the sole source of ammonium and Ca. While this strong correlation between NO3, Ca, and ammonium could artificially strengthen the relationships between Ca, ammonium, and UV-Vis absorbance, it is not likely to significantly impact the relationship between NO3 and UV-Vis absorbance due to the relatively low absorption potential of Ca and ammonium compared to NO3 (Schlager, 1991; Walsh and Warsop, 1961).

Figure 4. Pearson correlation coefficients for chemical nutrient concentrations in the synthetic samples.
Figure 3. Distributions of measured chemical concentrations in the synthetic samples.

Spectrophotometry

As shown in figure 5, the average maximum UV-Vis absorption of diluted samples was measured to be 2.6 by the NanoDrop and 0.19 by the GatorSpec. For undiluted samples, these values were 2.6 and 0.47, respectively. Thus, the peak absorbance of the GatorSpec was an order of magnitude less than that of the NanoDrop. This was likely due to the presence of a baseline offset in the power spectrum of the GatorSpec and because the GatorSpec setup was not calibrated for absorbance. However, this is not expected to affect the ability of the system to be used for estimating chemical concentrations because this is dependent on the covariance of measured absorbance with concentration rather than the absolute accuracy of measured absorbance.

The peak absorbance of the NanoDrop was less sensitive to dilution compared to that of the GatorSpec, suggesting its peak was saturated for both the high and low range of concentrations used. Also, the spectrum produced by the GatorSpec associated with dilute samples showed more variation in the 300 nm region compared to that of the NanoDrop. This suggests that the NanoDrop may be more suitable for concentrations lower than those used in this study compared to the GatorSpec, which appeared to be better suited for the lower concentration range used in this study. However, spectra produced by both systems showed more minor peaks associated with concentrated samples and a relatively stronger second major peak centered around 300 nm. Thus, the spectra produced by the two systems showed similar patterns.

Principal Component Analysis

The first principal component (PC1) in a PCA is the one that explains most of the variability in the data (Ringnér, 2008). PC1s of the spectral datasets were analyzed along with nitrate concentration using linear regression to compare the two spectroscopy systems and their dependence on chemical composition. As shown in figure 6, there was a strong correlation between the first principal absorbance components of the undiluted samples measured by each instrument, and there was a weaker, yet significant (p < 10-9), correlation derived from the first principal components of the diluted samples. As shown in table 3, the PC1s derived from the undiluted samples explained very similar percentages of the variation in the absorbance (81% and 84%). However, this was not the case for diluted samples, for which the first principal component of the GatorSpec data explained a lower percentage of the total absorbance variation (65%) compared to that of the NanoDrop (97%). These two sets of information suggest that the data produced by the two systems are similar, but they are more similar when analyzing solutions with higher nutrient concentrations.

NanoDropGatorSpec
Diluted
Undiluted
Figure 5. Absorbance spectra of the synthetic samples separated by spectroscopy system and dilution. Dark blue lines and light blue shaded regions signify average values and 95% confidence intervals determined by bootstrapping, respectively.

As indicated by the shading in figure 6 and shown more clearly in figure 7, there was a strong correlation between the first principal components and NO3 concentration for the diluted samples analyzed by both systems. However, the relationship between the first principal component and NO3 appears to be slightly different for the two systems, with that of the NanoDrop (fig. 7a) being less linear than that of the GatorSpec (fig. 7b). Furthermore, the errors associated with the NanoDrop were more biased but less variable compared to those of the GatorSpec. There was also no significant relationship (p = 0.24 and p = 0.65 for data produced by the NanoDrop and GatorSpec, respectively) between the first principal absorbance components and NO3 concentrations produced by the analysis of undiluted samples by both systems. While the data produced by the two systems is more similar for concentrated solutions, the lack of a significant trend between the principal components and NO3 concentration indicates the variation in these data are not dependent on NO3 concentration. Conversely, the differences in the absorbances measured by the two systems for diluted samples (fig. 6) appear to be due to differing sensitivities to NO3 based on the significant, yet distinct, relationships between the first principal absorbance components and NO3 concentration (figs. 7c and 7d).

Diluted
(A)
Undiluted
(B)
Figure 6. Principal Component 1 (PC1) comparison for (A) diluted samples and (B) undiluted samples. Concentrations are in mg L-1.
Table 3. The wavelengths and predominance of the first two principal absorbance components for each spectroscopy system and level of dilution.
Sample
Type
Principal
Component
WavelengthExplained
Variance
(%)
GatorSpec DilutedPC1229.465.47
PC2228.924.58
NanoDrop DilutedPC121997.37
PC21941.11
GatorSpec UndilutedPC1261.383.70
PC2242.67.81
NanoDrop UndilutedPC124481.45
PC22406.79

It was also determined by PCA which wavelengths contributed the most to the variance of the absorbance data (see table 3). NO3 absorbs light with wavelengths of 210-220 nm, but absorbance in this range can also be affected by other solutes present in complex natural solutions such as dissolved organic matter, phosphate, and ammonium (Armstrong, 1963; Halmann and Platzner, 1965; Walsh and Warsop, 1961). For the diluted samples used in this analysis, the wavelengths that contributed the most to each principal component were near the range attributed to NO3. However, the principal wavelengths for the GatorSpec were slightly above this range. This could be due to the lack of calibration of the GatorSpec spectrophotometer or the low sensitivity of the GatorSpec to the wavelengths corresponding to peak NO3 absorption. The principal wavelengths for the undiluted samples were well above the range of peak absorption by NO3, which means the wavelengths corresponding to NO3 absorption had a relatively low variance despite there being a high variance in NO3 concentration. This suggests that the effects of NO3 on absorbance are reduced at higher concentrations, and the variability in the absorbance data for undiluted samples was likely due to variations in the concentration of other chemical constituents in the samples. This is in agreement with the principals outlined by Mayerhöfer et al. (2020), who explained that the absorbance-concentration relationship becomes concave at high concentrations. Also, other chemical constituents such as phosphate, sulfate, and chelated iron, were present at sufficient concentrations to have a significant effect on absorbance. Thus, the two systems gave similar PCA results regarding the regions of the spectra with the highest observed variability for diluted and undiluted samples, and both were consistent with the chemical composition of the samples and established physical theories.

Partial Least Squares Regression

Partial least squares regression models were utilized to compare how accurately the NO3 concentrations in the samples could be predicted by the absorbance data produced by each spectroscopy system. As shown in figure 8, the correlation between the true and predicted concentrations for the held-out test set was strong for each model, with r2 values ranging from 0.82 to 0.98 and RMSE values ranging from 10.5 mg-N L-1 to 23.1 mg-N L-1 for undiluted samples and 0.266 mg-N L-1 to 0.475 mg-N L-1 for diluted samples. Additionally, the model derived from the analysis of diluted samples by the GatorSpec had the best performance, and the performance of the GatorSpec was greatly improved by sample dilution. Interestingly, the performance (r2) of the NanoDrop model decreased slightly by diluting the samples, despite the first principal component of the NanoDrop data derived from undiluted samples being uncorrelated to NO3 (fig. 7a).

According to the PCA results, the variance was more evenly distributed between the first two principal components for the absorbance of diluted samples analyzed by the GatorSpec compared to that of the NanoDrop. Thus, the dataset corresponding to the analysis of diluted samples by GatorSpec could have resulted in a better predictive model due to this division of variance, allowing for more independent variables to be used in the regression model. It is interesting that the NanoDrop produced a better model in terms of r2 and RMSE from undiluted samples despite the close similarity between the two systems, as indicated by the PCA results. In this case, the signal-to-noise ratio and the sensitivity of the spectrophotometer could have large effects on the performance of the PLS model because the noise in the absorbance data may overwhelm minor components that are correlated to the analyte. Finally, it should be noted that the errors associated with the PLS model derived from the analysis of undiluted samples by GatorSpec do not appear to be random. This suggests that a more flexible machine learning model such as neural networks or gradient boosted regression trees could produce a more accurate model, as was done by Silva et al. (2021), which may be needed for applications where very precise monitoring and control of chemical concentrations would be beneficial, such as hydroponics and water treatment. Overall, the models based on the absorbance values measured by both systems were able to accurately predict NO3 concentrations with normalized RMSE values ranging from 5% to 19% of the average concentration, but dilution or more advanced regression are required if NO3 concentrations are to be measured by the GatorSpec with very high accuracy (e.g., normalized RMSE < 5%).

NanoDropGatorSpec

    Diluted

    Undiluted

Figure 7. Target nitrate concentrations versus the first principal components produced by the UV-Vis analysis of (A) diluted samples by the NanoDrop, (B) diluted samples by the GatorSpec, (C) undiluted samples by the NanoDrop, and (D) undiluted samples by the GatorSpec.

These results compliment those found in previous studies. For instance, multiple studies have evaluated the performance of UV-Vis absorption spectroscopy on a variety of aqueous matrices, including surface water (Etheridge et al., 2014; Vaughan et al., 2017), wastewater (Lepot et al., 2016), groundwater (Huebsch et al., 2015), and hydroponic nutrient

solutions (Monteiro-Silva et al., 2019; Silva et al., 2021), all typically reporting estimates with high correlations to laboratory results (r2 > 0.99). However, while many of the previous studies focused on comparing algorithms for producing water quality estimates from spectral data, essentially none of these previous studies focused on comparing instrumental setups except for Huebsch et al. (2015), who compared two off-the-shelf in situ spectrophotometers. Also, previous studies typically involved the use of natural samples for calibration, which could result in model bias due to correlations between chemical constituents in the samples and ununiform distribution of concentrations in the observed ranges used for calibration. The only previous studies that used synthetic samples were also focused on hydroponics, but these studies used factorial and orthogonal experimental designs, rather than a randomized design, which can produce concentration distributions more similar to those found in nature while also assuring uniformity. The few previous studies focused on hydroponics also only used high-concentration solutions and a patented artificial intelligence algorithm (Martins, 2017). To our knowledge, the current study is the first to evaluate a low-cost, benchtop UV-Vis absorption spectroscopy setup for chemical analysis of complex samples by comparing it to a standard laboratory instrument.

Conclusions

Several conclusions can be drawn from this analysis regarding the overall performance of the low-cost, modular spectroscopy system in relation to the analysis of synthetic nutrient solutions and in comparison to analysis by a laboratory-grade spectroscopy system. PCA results indicated that the absorbance data from both spectroscopy systems provided similar information in terms of the covariance between wavelengths and NO3 concentration. However, the absorbance data produced by the two systems was less similar for more dilute samples, the variation of which was more correlated with NO3 concentrations. This suggests that the two spectroscopy systems have differing sensitivities to the effects of NO3 on absorbance.

NanoDropGatorSpec

    Diluted

    Undiluted

Figure 8. PLS results for predicting nitrate concentrations based on the absorbance of (A) diluted samples analyzed by the NanoDrop, (B) diluted samples analyzed by the GatorSpec, (C) undiluted samples analyzed by the NanoDrop, and (D) undiluted samples analyzed by the GatorSpec.

PLS results showed that models created from the absorbance data produced by both systems can accurately predict NO3 concentrations in both diluted and undiluted samples, and the errors associated with the NO3 models were similar to those found in previous studies involving hydroponic nutrient solutions (Monteiro-Silva et al., 2019; Silva et al., 2021) and surface water samples (Avagyan et al., 2014; Blaen et al., 2016; Etheridge et al., 2014; Vaughan et al., 2017), despite the key differences between the methods used in this study and previous studies in terms of experimental design, instrumental setup, and data analysis. However, while the PLS regression model with the lowest RMSE was produced by the analysis of diluted samples by the GatorSpec, more advanced regression or a more precise spectrophotometer may be needed to produce a model with uncertainties less than 5% for concentrated NO3 using the GatorSpec.

While the results of this study verified the ability of the low-cost spectroscopy system to accurately estimate nitrate concentrations in diluted synthetic nutrient solutions, this study also revealed multiple opportunities for improvement of the low-cost spectroscopy system and its evaluation. First, a larger variety of concentration ranges could be used to better characterize the strength of the relationship between UV-Vis absorption and NO3 for the low-cost system. Furthermore, a larger variety of chemical constituents, including naturally occurring organic compounds and suspended particles (i.e., turbidity), could be used to create samples more representative of specific types of natural water samples such as wastewater and stormwater runoff and expand upon studies that have already applied spectroscopy in these fields using off-the-shelf equipment (Etheridge et al., 2014; Houle et al., 2022; Huebsch et al., 2015; Vaughan et al., 2018).

It is well-known that organic compounds and turbidity affect the attenuation of light in water samples, which would complicate the relationship between spectral absorbance and nitrate concentration. Thus, further analysis could be performed using more advanced nonparametric multivariate regression algorithms (i.e., artificial intelligence/machine learning) for predicting other key nutrients such as phosphorus, potassium, calcium, and sulfate. The applicability of models developed using synthetic samples to natural samples should also be evaluated before the models can reliably be applied in real-world settings. In the future, the predictive models should be validated in real water systems, such as commercial hydroponic systems, stormwater ponds, and streams, rather than synthetic samples made in a laboratory setting. It is likely that, to accurately predict nitrate concentration in natural systems, GatorSpec calibration models will need to be developed using samples derived from those specific systems. Also, the physical parameters of the low-cost spectroscopy system (e.g., optical pathlength, light intensity, and integration time) could be adjusted and optimized for specific applications. For instance, while a standard 1-cm optical pathlength was used in this study, previous studies have used pathlengths ranging from 2-15 mm depending on sample type and associated expected chemical concentrations (Avagyan et al., 2014; Drolc and Vrtovšek, 2010; Etheridge et al., 2014; Vaughan et al., 2017). Thus, it is possible that the performance of the low-cost spectroscopy system could be improved by further optimizing for optical pathlength.

If successful, low-cost, modular spectroscopy equipment such as the GatorSpec could eventually be used to optimize the management of water systems through automated, nutrient-specific monitoring and control, which is practically impossible to accomplish using a benchtop spectrophotometer such as the NanoDrop. For instance, the Python program that is used to operate the spectroscopy system could be augmented to include the operation of automatic sampling equipment to generate continuous water quality datasets, which are essential to modern water systems management (Huang et al., 2022). Further, the functionality of the control program could be expanded to include the operation of actuators to automate the management of water systems. Examples of this would be the control of nutrient dosing in hydroponic systems (Cho et al., 2017, 2018; Jung et al., 2015) and the control of outlet structures in stormwater systems (Mullapudi et al., 2017; Wong and Kerkez, 2018; Wong and Kerkez, 2016). However, there are still challenges and limitations to implementing low-cost spectroscopy systems such as GatorSpec in this way. The main limitation is that the estimates made by a low-cost system are typically not as accurate as those made by standard laboratory methods, and the uncertainty of the estimates must be incorporated into any downstream use of the data produced for management decisions. Further, data and system security must be strongly considered when an electronic system is incorporated into system management. This includes the use of cybersecurity measures such as encryption, data backups, and verified user input requirements for system operation. These features must be incorporated into the framework of the low-cost measurement system while also retaining the modular, open-source characteristics in order to ensure the technology remains accessible and applicable to a large variety of users and tasks.

Acknowledgments

Funding for this research was provided by the Department of Agricultural and Biological Engineering at the University of Florida through the Pathfinder Fellowship and the Undergraduate Research Award.

References

Abdi, H., & Williams, L. J. (2010). Principal component analysis. WIREs Comput. Stat., 2(4), 433-459. https://doi.org/10.1002/wics.101

Aini, N., Yamika, W. S., & Ulum, B. (2019). Effect of nutrient concentration, PGPR and AMF on plant growth, yield and nutrient uptake of hydroponic lettuce. Int. J. Agric. Biol., 21(1), 175-183. https://doi.org/10.37855/jah.2019.v21i02.20

Armanda, D. T., Guinée, J. B., & Tukker, A. (2019). The second green revolution: Innovative urban agriculture’s contribution to food security and sustainability – A review. Glob. Food Sec., 22, 13-24. https://doi.org/10.1016/j.gfs.2019.08.002

Armstrong, F. A. J. (1963). Determination of nitrate in water ultraviolet spectrophotometry. Anal. Chem., 35(9), 1292-1294. https://doi.org/10.1021/ac60202a036

Avagyan, A., Runkle, B. R. K., & Kutzbach, L. (2014). Application of high-resolution spectral absorbance measurements to determine dissolved organic carbon concentration in remote areas. J. Hydrol., 517, 435-446. https://doi.org/10.1016/j.jhydrol.2014.05.060

Bamsey, M., Graham, T., Thompson, C., Berinstain, A., Scott, A., & Dixon, M. (2012). Ion-specific nutrient management in closed systems: The necessity for ion-selective sensors in terrestrial and space-based agriculture and water management systems. Sensors, 12(10), 13349-13392. https://doi.org/10.3390/s121013349

Blaen, P. J., Khamis, K., Lloyd, C. E., Bradley, C., Hannah, D., & Krause, S. (2016). Real-time monitoring of nutrients and dissolved organic matter in rivers: Capturing event dynamics, technological opportunities and future directions. Sci. Total Environ., 569-570, 647-660. https://doi.org/10.1016/j.scitotenv.2016.06.116

Brereton, R. G. (2018). Chemometrics: Data driven extraction for science (2nd ed.). Hoboken, NJ: John Wiley & Sons. https://doi.org/10.1002/9781118904695

Carter, J. B., Bean, E., & Singh, A. (2022). GatorSpec: An open-source UV-Vis absorption spectroscopy platform with applications in water quality analysis. Proc. Institute of Biological Engineering Annual Conf.

Chatwal, G. R., & Anand, S. K. (2009). Concepts in spectroscopy. In M. Arora, & A. Anand (Eds.), Spectroscopy (p. 1.1). Himalaya Publishing House.

Chislock, M. F., Doster, E., Zitomer, R., & Wilson, A. E. (2013). Eutrophication: Causes, consequences, and controls in aquatic ecosystems. Nat. Educ. Knowl., 4(4), 10.

Cho, W. J., Kim, H. J., Jung, D. H., Kang, C. I., Choi, G. L., & Son, J. E. (2017). An embedded system for automated hydroponic nutrient solution management. Trans. ASABE, 60(4), 1083-1096. https://doi.org/10.13031/trans.12163

Cho, W. J., Kim, H. J., Jung, D. H., Kim, D. W., Ahn, T. I., & Son, J. E. (2018). On-site ion monitoring system for precision hydroponic nutrient management. Comput. Electron. Agric., 146, 51-58. https://doi.org/10.1016/j.compag.2018.01.019

Cooper, A. (1979). The ABC of NFT. Nutrient film technique. London, UK: Grower Books.

Domingues, D. S., Takahashi, H. W., Camara, C. A., & Nixdorf, S. L. (2012). Automated system developed to control pH and concentration of nutrient solution evaluated in hydroponic lettuce production. Comput. Electron. Agric., 84, 53-61. https://doi.org/10.1016/j.compag.2012.02.006

Drolc, A., & Vrtovšek, J. (2010). Nitrate and nitrite nitrogen determination in waste water using on-line UV spectrometric method. Bioresour. Technol., 101(11), 4228-4233. https://doi.org/10.1016/j.biortech.2010.01.015

Etheridge, J. R., Birgand, F., Osborne, J. A., Osburn, C. L., Burchell II, M. R., & Irving, J. (2014). Using in situ ultraviolet-visual spectroscopy to measure nitrogen, carbon, phosphorus, and suspended solids concentrations at a high frequency in a brackish tidal marsh. Limnol. Oceanogr. Methods, 12(1), 10-22. https://doi.org/10.4319/lom.2014.12.10

Halmann, M., & Platzner, I. (1965). 254. The photochemistry of phosphorus compounds. Part II. Far-ultraviolet absorption spectra of some phosphorus oxyanions in aqueous solution. J. Chem. Soc., 1440-1449. https://doi.org/10.1039/JR9650001440

Hewitt, E. J. (1966). Sand and water culture methods used in the study of plant nutrition (2nd ed.). Farnham Royal: Commonwealth Agricultural Bureaux.

Hoagland, D. R., & Arnon, D. I. (1950). The water-culture method for growing plants without soil. The College of Agriculture, University of California. Retrieved from https://archive.org/details/watercultureme3450hoag/mode/2up?ref=ol&view=theater

Houle, J. J., Macadam, D. R., Ballestero, T. P., & Puls, T. A. (2022). Utilizing in situ ultraviolet-visual spectroscopy to measure nutrients and sediment concentrations in stormwater runoff. J. Sustain. Water Built Environ., 8(4), 04022012. https://doi.org/10.1061/JSWBAY.0000994

Huang, Y., Wang, X., Xiang, W., Wang, T., Otis, C., Sarge, L.,... Li, B. (2022). Forward-looking roadmaps for long-term continuous water quality monitoring: Bottlenecks, innovations, and prospects in a critical review. Environ. Sci. Technol., 56(9), 5334-5354. https://doi.org/10.1021/acs.est.1c07857

Huebsch, M., Grimmeisen, F., Zemann, M., Fenton, O., Richards, K. G., Jordan, P.,... Goldscheider, N. (2015). Technical Note: Field experiences using UV/VIS sensors for high-resolution monitoring of nitrate in groundwater. Hydrol. Earth Syst. Sci., 19(4), 1589-1598. https://doi.org/10.5194/hess-19-1589-2015

Jung, D. H., Kim, H.-J., Choi, G. L., Ahn, T.-I., Son, J.-E., & Sudduth, K. A. (2015). Automated lettuce nutrient solution management using an array of ion-selective electrodes. Trans. ASABE, 58(5), 1309-1319. https://doi.org/10.13031/trans.58.11228

Le Bot, J., & Kirkby, E. A. (1992). Diurnal uptake of nitrate and potassium during the vegetative growth of tomato plants. J. Plant Nutr., 15(2), 247-264. https://doi.org/10.1080/01904169209364316

Lepot, M., Torres, A., Hofer, T., Caradot, N., Gruber, G., Aubin, J.-B., & Bertrand-Krajewski, J.-L. (2016). Calibration of UV/Vis spectrophotometers: A review and comparison of different methods to estimate TSS and total and dissolved COD concentrations in sewers, WWTPs and rivers. Water Res., 101, 519-534. https://doi.org/10.1016/j.watres.2016.05.070

Li, J. (2020). A data-driven improved fuzzy logic control optimization-simulation tool for reducing flooding volume at downstream urban drainage systems. Sci. Total Environ., 732, 138931. https://doi.org/10.1016/j.scitotenv.2020.138931

Martins, R. C. (2017). Big data self-learning methodology for the accurate quantification and classification of spectral information under complex variability and multi-scale interference (Patent No. WO 2018/060967 A1). World Intellectual Property Organization.

Mayerhöfer, T. G., Pahlow, S., & Popp, J. (2020). The Bouguer-Beer-Lambert law: Shining light on the obscure. ChemPhysChem, 21(18), 2029-2046. https://doi.org/10.1002/cphc.202000464

Monteiro-Silva, F., Jorge, P. A., & Martins, R. C. (2019). Optical sensing of nitrogen, phosphorus and potassium: A spectrophotometrical approach toward smart nutrient deployment. Chemosensors, 7(4), 51. https://doi.org/10.3390/chemosensors7040051

Mullapudi, A., Wong, B. P., & Kerkez, B. (2017). Emerging investigators series: Building a theory for smart stormwater systems. Environ. Sci. Water Res. Technol., 3(1), 66-77. https://doi.org/10.1039/C6EW00211K

Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O.,... Duchesnay, E. (2011). Scikit-learn: Machine learning in Python. J. Mach. Learn. Res., 12, 2825-2830.

Qin, X., Gao, F., & Chen, G. (2012). Wastewater quality monitoring system using sensor fusion and machine learning techniques. Water Res., 46(4), 1133-1144. https://doi.org/10.1016/j.watres.2011.12.005

Resh, H. M. (2012). Plant nutrition. In Hydroponic food production: A definitive guidebook for the advanced home gardener and the commercial hydroponic grower (7th ed., pp. 9-29). Boca Raton, FL: CRC Press.

Ringnér, M. (2008). What is principal component analysis? Nat. Biotechnol., 26(3), 303-304. https://doi.org/10.1038/nbt0308-303

Ryska, M. (2015). How to deal with the “matrix effect” as an unavoidable phenomenon. Eur. J. Mass Spectrom., 21(3), 423-432. https://doi.org/10.1255/ejms.1355

Saber, A., Tafazzoli, M., Mortazavian, S., & James, D. E. (2018). Investigation of kinetics and absorption isotherm models for hydroponic phytoremediation of waters contaminated with sulfate. J. Environ. Manag., 207, 276-291. https://doi.org/10.1016/j.jenvman.2017.11.039

Salivon, O., Zubchuk, V., Antonova-Rafi, J., Khudetskyy, I., & Taranov, V. (2018). A device for rapid measurement of nitrate levels in aqueous solutions based on spectrophotometric method. Proc. 2018 IEEE 38th Int. Conf. on Electronics and Nanotechnology (ELNANO), (pp. 379-382). https://doi.org/10.1109/ELNANO.2018.8477550

Sambo, P., Nicoletto, C., Giro, A., Pii, Y., Valentinuzzi, F., Mimmo, T.,... Cesco, S. (2019). Hydroponic solutions for soilless production systems: Issues and opportunities in a smart agriculture perspective. Front. Plant Sci., 10. https://doi.org/10.3389/fpls.2019.00923

Schlager, K. J. (1991). On-line monitoring of water quality and plant nutrients in space applications based on photodiode array spectrometry. SAE Technical Paper 911361. Proc. Int. Conf. on Environmental Systems. SAE International. https://doi.org/10.4271/911361

Silva, A. F., Löfkvist, K., Gilbertsson, M., Van Os, E., Franken, G., Balendonck, J.,... Martins, R. C. (2021). Hydroponics monitoring through UV-Vis spectroscopy and artificial intelligence: Quantification of nitrogen, phosphorous and potassium. Chem. Proc., 5(1), 88. https://doi.org/10.3390/CSAC2021-10448

Steiner, A. A. (1984). The universal nutrient solution. Proc. 6th Int. Congress on Soilless Culture.

Swain, A., Chatterjee, S., Vishwanath, M., Roy, A., & Biswas, A. (2021). Hydroponics in vegetable crops: A review. Pharma Innov. J., 10(6), 629-634.

Trejo-Téllez, L. I., & Gómez-Merino, F. C. (2012). Nutrient solutions for hydroponic systems. In T. Asao (Ed.), Hydroponics - A standard methodology for plant biological researches. Rijeke, Croatia: IntechOpen. https://doi.org/10.5772/37578

United Nations Environment Programme. (2021). Progress on ambient water quality: Tracking SDG 6 series - Global Indicator 6.3.2 updates and acceleration needs. Retrieved from https://wedocs.unep.org/20.500.11822/36689

Van Ginkel, S. W., Igou, T., & Chen, Y. (2017). Energy, water and nutrient impacts of California-grown vegetables compared to controlled environmental agriculture systems in Atlanta, GA. Resour. Conserv. Recycl., 122, 319-325. https://doi.org/10.1016/j.resconrec.2017.03.003

Vaughan, M. C. H., Bowden, W. B., Shanley, J. B., Vermilyea, A., Sleeper, R., Gold, A. J.,... Schroth, A. W. (2017). High-frequency dissolved organic carbon and nitrate measurements reveal differences in storm hysteresis and loading in relation to land cover and seasonality. Water Resour. Res., 53(7), 5345-5363. https://doi.org/10.1002/2017WR020491

Vaughan, M. C., Bowden, W. B., Shanley, J. B., Vermilyea, A., Wemple, B., & Schroth, A. W. (2018). Using in situ UV-Visible spectrophotometer sensors to quantify riverine phosphorus partitioning and concentration at a high frequency. Limnol. Oceanogr. Methods, 16(12), 840-855. https://doi.org/10.1002/lom3.10287

Vezzaro, L., Christensen, M. L., Thirsing, C., Grum, M., & Mikkelsen, P. S. (2014). Water quality-based real time control of integrated urban drainage systems: A preliminary study from Copenhagen, Denmark. Procedia Eng., 70, 1707-1716. https://doi.org/10.1016/j.proeng.2014.02.188

Vitha, M. F. (2018). Fundamentals of spectroscopy. In Spectroscopy: Principles and instrumentation. Hoboken, NJ: John Wiley & Sons, Inc.

Walsh, A. D., & Warsop, P. A. (1961). The ultra-violet absorption spectrum of ammonia. Trans. Faraday Soc., 57, 345-358. https://doi.org/10.1039/TF9615700345

Wong, B. P., & Kerkez, B. (2016). Real-time environmental sensor data: An application to water quality using web services. Environ. Model. Softw., 84, 505-517. https://doi.org/10.1016/j.envsoft.2016.07.020

Wong, B. P., & Kerkez, B. (2018). Real-time control of urban headwater catchments through linear feedback: Performance, analysis, and site selection. Water Resour. Res., 54(10), 7309-7330. https://doi.org/10.1029/2018WR022657

Zhang, K., Burns, I. G., & Turner, M. K. (2008). Derivation of a dynamic model of the kinetics of nitrogen uptake throughout the growth of lettuce: Calibration and validation. J. Plant Nutr., 31(8), 1440-1460. https://doi.org/10.1080/01904160802208345