<<

sensors

Article Spectroscopy Transmittance by LED Calibration

Daniel Carreres-Prieto 1,* , Juan T. García 1,* , Fernando Cerdán-Cartagena 2 and Juan Suardiaz-Muro 3

1 Department of Mining and Civil Engineering, Technical University of Cartagena, 30202 Cartagena, Spain 2 Department of Information and Communications Technologies, Technical University of Cartagena, 30202 Cartagena, Spain 3 Department of Electronic Technology, Technical University of Cartagena, 30202 Cartagena, Spain * Correspondence: [email protected] (D.C.-P.); [email protected] (J.T.G.)

 Received: 30 May 2019; Accepted: 2 July 2019; Published: 4 July 2019 

Abstract: Local administrations demand real-time and continuous pollution monitoring in sewer networks. Spectroscopy is a non-destructive technique that can be used to continuously monitor quality in sewers. Covering a wide range of wavelengths can be useful for improving pollution characterization in wastewater. Cost-effective and in-sewer spectrophotometers would contribute to accomplishing discharge requirements. Nevertheless, most available spectrometers are based on incandescent lamps, which makes it unfeasible to place them in a sewerage network for real-time monitoring. This research work shows an innovative calibration procedure that allows (-Emitting Diode) LED technology to be used as a replacement for traditional incandescent lamps in the development of equipment. This involves firstly obtaining transmittance values similar to those provided by incandescent lamps, without using any optical components. Secondly, this calibration process enables an increase in the range of wavelengths available (working range) through a better use of the LED’s spectral width, resulting in a significant reduction in the number of LEDs required. Thirdly, this method allows important reductions in costs, dimensions and consumptions to be achieved, making its implementation in a wide variety of environments possible.

Keywords: LED spectrophotometer; LEDs; water pollutants

1. Introduction Continuous and on-line quality monitoring of wastewater and stormwater is nowadays a primal objective to comply with the Urban Wastewater Treatment Directive (UWWTD 91/271/EEC), Bathing Water Directive (BWD, 2006/7/EC) and the Environmental Quality Standards Directive (EQS, 2008/105/EC). Variable wavelength spectroscopy is a non-destructive technique without the addition of chemicals reagents to wastewater that can be used for the quality monitoring and real-time control of sewers [1,2]. Several authors have proposed partial least squares calibration models for the indirect monitoring of chemical oxygen demand (COD) or total suspended solids (TSS) through Ultraviolet-Visible (UV–VIS) and Visible (VIS) spectroscopy for wastewater and stormwater combined sewer overflows (CSOs) [3–5]. Continuous and consistent data collection in sewers are presented. Spectrometer calibration experiments for total-COD in Reference [6] resulted in an absolute error in the range of 30–300 mg COD/L and a corresponding relative error in the range of 8–60%, where validation experiences led to underestimating high concentrations during daily peaks and in overestimating low concentrations during night periods [6,7]. Dissolved organic matter (DOM) was described by ratios of UV at 254 nm and 365 nm [8]. Different researchers have studied the absorbance at different wavelengths and its

Sensors 2019, 19, 2951; doi:10.3390/s19132951 www.mdpi.com/journal/sensors Sensors 2019, 19, 2951 2 of 23 relation between different wavelength-absorbance as an indicator of the COD [8–10]. UV–Vis and VIS spectroscopy was performed in the wavelength range of 200–400 nm, where it was found that the ratio of absorbance at 250 and 365 nm was a good measurement for the COD correlation [10]. Ultraviolet-visible absorption spectra in two distinct spectral slope regions (275–295 nm and 350–400 nm) within log-transformed absorption spectra were used to compare DOM concentrations from contrasting water types [11]. Pollutants track-down during CSOs through cost-effective methods is demanded by municipalities to comply with legal requirements [12,13]. In the same way, industrial wastewater discharge control throughout the sewer systems is of great interest for administrations nowadays. Therefore, a large number of sensors are required for the real-time control of the CSOs and industrial discharges in the sewer systems during rainfall events and dry periods. To achieve this real-time monitoring of pollution in sewers, a robust, portable and cost-effective device is needed to continuously monitor quality in sewers. LED have been selected as a replacement for traditional incandescent lamps, due to their low consumption, cost and the fact that they reach their operating regime almost immediately, which reduces downtime. The specific objective of this research is the development of a precision spectrophotometer, based on LED technology, and which is cost-effective, portable and with consumptions much lower than those provided by incandescent lamps [14], to enable them to be located in sewers systems massively. For the validation and acceptance of results obtained with LEDs, the first steps of the present work were dedicated to reproducing and comparing them to commercial equipment. The advantage of reproducing the footprint of a commercial spectrometer is the validation of the transmittance values with LED technology according to the configuration proposed in the present work, which avoids the use of an optical lens covering a wide range of wavelengths. Therefore, the present research includes a calibration process that can be useful for the design of an innovative LED spectrophotometer capable of operating at a wide range of wavelengths. This availability of a greater working range (far beyond that of a turbidimeter that operates under a single wavelength, typically 860 nm) is expected to enable a more exhaustive analysis of a sample’s properties. Depending on the composition and concentration of wastewater and stormwater, variations in transmittance and absorbance values will be detected in certain regions of the working spectrum, which could enable a greater number of indirectly contaminating parameters to be determined. Different types of LED based on light sources could be used in a spectrophotometer [15], but in practice not all are adequate for this purpose. In general, we can divide the types of LEDs into three categories: White light LED, RGB LED, and limited-bandwidth LED (Common LED). In spectrophotometry, the use of white light for generating the working spectrum is a common practice. White light requires the use of optical elements, such as monochromators [16]. This supposes an increase in the cost of the equipment and in its dimensions, while making them more sensitive to mismatch as a result of impacts or vibrations, and thus not being suitable for all types of environments. There are studies [17] that raise the feasibility of using LED technology for the generation of white light, however, it must be pointed out that this type of LED semiconductor has a different emission spectrum than monochromatic white light. These are based on blue LEDs that are coated with a layer of phosphorus, which react with short wavelengths (blue), emitting low energy yellow light. Therefore, this type of LED is currently not the best solution for the generation of white light for spectrophotometry operations. RGB LEDs were used to generate different wavelengths in the visible spectrum and through the combination of the three primary colors (Red, Green and Blue) with different levels of emission intensity [18]. An RGB LED is composed of three individual LEDs, that is, a red, green and blue LED that emit at specific wavelengths. However, in order to clarify the explanations, we shall refer to this type of light source as “RGB LED”, as these three LEDs are inside the same housing. The idea of generating all the wavelengths that make up the visible spectrum using an RGB LED was shown to be unfeasible. It is based on an incorrect understanding of the human eye to affirm Sensors 2019, 19, 2951 3 of 23 that certain wavelengths are being emitted [19], when in fact the primary colors are being emitted separately at different intensity levels, giving rise to an optical effect known as “rendering of color” [20]; television monitors are based on this. Although empirical equations exist between the values of λ and RGB, such as the Fortran code [21,22], which is one of the most used color generation systems in LED screens, this “color matching” cannot be used for the development of spectrophotometric equipment by only emitting the wavelengths corresponding to red: 625 nm; green: 525 nm; and blue: 460 nm [19]. Common LEDs represent the best option for the development of portable and cost-effective equipment. LED diodes are designed to emit in a limited range of wavelengths simultaneously (spectral width), so they are suitable for describing specific regions of the visible spectrum. Herein, in the present work we will refer to this type of LED. The contributions of this work as follows: First, an innovative calibration process of the transmittance values for these LEDs without the use of optical elements such as lenses and diffraction matrix; thus reducing costs, dimensions and complexity. Second, increasing the valid range of wavelengths of each LED, in addition to its own peak wavelength. This allows the number of LEDs to be significantly reduced. The rest of the article is organized as follows: In Section2, all the materials and methods used in this research work are explained. The section details the samples analyzed, the type of sensor used, as well as the commercial equipment based on incandescent lamps used as a reference during the calibration process. Likewise, the assembly carried out during the experiment is described, in order to provide a detailed guide to reproduce the results. Section3 focuses on the study of the use of LEDs as a viable alternative to incandescent lamps, detailing the limitations and problems associated with them. The need for a specific calibration process is evident to match the results obtained with reference commercial equipment based on incandescent lamps. The results obtained after the calibration process are also presented. Finally, Section4 discusses the considerations reached at the end of the research work.

2. Materials and Methods

2.1.Sensors Analyzed 2019, 19, Samplesx FOR PEER REVIEW 4 of 24 In order to enable different values of transmittance to be compared, 21 different samples were M19 Sea water 100% prepared of different naturesM20 and concentrations, asTea shown in Figure1. Moreover,80% Table1 describes the different substances employedM21 in each sampleFabric and softener their dissolution. 40%

Figure 1. View of the 21 samples used in the present analysis.

It should be noted that samples M11 and M12 were discarded from the present study due to the fact that all the incidentincident lightlight waswas absorbed,absorbed, makingmaking thethe transmittancetransmittance valuevalue null.null. All these samples were storedstored inin standardstandard 1212 × 12 × 50 mm plastic test tubes specially designed × × for spectrophotometry.

2.2. Sensors Individual photodiodes were used in the present work rather than Charge-Coupled Device (CCD) sensors [23]. The individual photodiode is designed to capture a single beam of incident light [24,25]. These are sensitive to a wide range of wavelengths. This enables the dimensions and costs of the equipment to be reduced [26]. A single sensor usually collects a larger area in proportion to that of the photodiodes of the CCD. The individual photodiodes have a different spectral response depending on the incident wavelength. This is the sensor sensitivity. To study the effect of sensitivity in the measurements of transmittance, values at different wavelengths and two types of photodiodes with different sensitivities have been used to determine the most appropriate. These are S1223-01 [27] and OSD15- E [28], the spectral responses of which are shown in Figure 2.

S1223–01 OSD15-E (A) (B)

Figure 2. Sensitivity curves of the photodiodes (A) S1223–01 and (B) OSD15-E.

Sensors 2019, 19, 2951 4 of 23

Table 1. Analyzed samples. Sensors 2019, 19, x FOR PEER REVIEW 4 of 24 Designation Substance Dissolution M19 Sea water 100% M0 Distilled water 100% M1M20 Red foodTea coloring 4080% 50% M2M21 BlueFabric food softener coloring 40% 50% M3 Yellow food coloring 40% M4 Washing machine detergent 50% M5 Red food coloring 40 75% M6 Red food coloring 40 55% M7 Washing machine detergent 65% M8 Washing machine detergent 75% M9 Kitchen oil 100% M10 Vinegar 90% M11 Milk 100% M12 Milk 50% M13 Soluble coffee 75% M14 Soluble coffee 50% FigureM15 1. View of the 21 samples Red wine used in the present analysis. 100% M16 Red wine 50% It should be noted thatM17 samples M11 Blue andandYellow M12 were food discarded coloring from 20–80% the present study due to the fact that all the incident lightM18 was absorbed, Blue making food coloring the transmittance value 30% null. M19 Sea water 100% All these samples were stored in standard 12 × 12 × 50 mm plastic test tubes specially designed M20 Tea 80% for spectrophotometry. M21 Fabric softener 40%

2.2. Sensors 2.2. Sensors Individual photodiodes were used in the present work rather than Charge-Coupled Device Individual photodiodes were used in the present work rather than Charge-Coupled Device (CCD) (CCD) sensors [23]. The individual photodiode is designed to capture a single beam of incident light sensors [23]. The individual photodiode is designed to capture a single beam of incident light [24,25]. [24,25]. These are sensitive to a wide range of wavelengths. This enables the dimensions and costs of These are sensitive to a wide range of wavelengths. This enables the dimensions and costs of the the equipment to be reduced [26]. A single sensor usually collects a larger area in proportion to that equipment to be reduced [26]. A single sensor usually collects a larger area in proportion to that of the of the photodiodes of the CCD. photodiodes of the CCD. The individual photodiodes have a different spectral response depending on the incident The individual photodiodes have a different spectral response depending on the incident wavelength. This is the sensor sensitivity. To study the effect of sensitivity in the measurements of wavelength. This is the sensor sensitivity. To study the effect of sensitivity in the measurements of transmittance, values at different wavelengths and two types of photodiodes with different transmittance, values at different wavelengths and two types of photodiodes with different sensitivities sensitivities have been used to determine the most appropriate. These are S1223-01 [27] and OSD15- have been used to determine the most appropriate. These are S1223-01 [27] and OSD15-E [28], E [28], the spectral responses of which are shown in Figure 2. the spectral responses of which are shown in Figure2.

S1223–01 OSD15-E (A) (B)

FigureFigure 2. 2. SensitivitySensitivity curves curves of of the the photodiodes photodiodes ( (AA)) S1223–01 S1223–01 and and ( (BB)) OSD15-E.

Sensors 2019, 19, x FOR PEER REVIEW 5 of 24

2.3. Light Emitting Diode (LED)

SensorsAs 2019 the, 19 , sourcex FOR PEER of light,REVIEW traditional incandescent lamps were replaced by LEDs of 5 mm5 of 24in Sensorsdiameter,2019 ,which19, 2951 emit a fixed range of wavelengths determined by their manufacturing process. These5 of 23 2.3.are Lightlow energy Emitting consumers, Diode (LED) cost-effective and are commercially available in a wide variety of peak wavelengths. This type of LED is designed to emit a narrow range of wavelengths simultaneously As the source of light, traditional incandescent lamps were replaced by LEDs of 5 mm in 2.3.[29] Lightand according Emitting Diode to a normal (LED) distribution curve shape (Figure 3). The spectral width of an LED is diameter, which emit a fixed range of wavelengths determined by their manufacturing process. These defined by those wavelengths that have an emission intensity equal to or greater than 50%, as shown are lowAs theenergy source consumers, of light, traditional cost-effective incandescent and are commercially lamps were replaced available by in LEDs a wide of 5 mmvariety in diameter, of peak in Figure 3. wavelengths.which emit a fixedThis type range of of LED wavelengths is designed determined to emit a bynarrow their manufacturingrange of wavelengths process. simultaneously These are low For instance, the VAOL-5EUV8T4 LED shown in Figure 3 [30], emits at 385 nm at its maximum [29]energy and consumers, according cost-eto a normalffective distribution and are commercially curve shape available (Figure in 3). a wideThe spectral variety of width peak of wavelengths. an LED is intensity level (peak wavelength) and at 400 nm at the upper limit of the spectral width of the LED, definedThis type by of those LED wavelengths is designed to that emit have a narrow an emission range of intensity wavelengths equal simultaneously to or greater than [29 ]50%, and accordingas shown also known as “center wavelength”, λ0.5m, which is defined as the wavelength halfway between the into Figure a normal 3. distribution curve shape (Figure3). The spectral width of an LED is defined by those two points with a spectral density of 50% of the peak. wavelengthsFor instance, that havethe VAOL-5EUV8T4 an emission intensity LED shown equal toin or Figure greater 3 [30], than emits 50%, asat 385 shown nm inat Figureits maximum3. intensity level (peak wavelength) and at 400 nm at the upper limit of the spectral width of the LED, also known as “center wavelength”, λ0.5m, which is defined as the wavelength halfway between the two points with a spectral density of 50% of the peak.

Figure 3. EmissionEmission spectrum of 385 nm LED (VAOL-5EUV8T4) [[30].30].

For instance, the VAOL-5EUV8T4 LED shown in Figure3[ 30], emits at 385 nm at its maximum The whole range of wavelengths are emitted simultaneously. This results in higher values of intensitytransmittance level than (peak those wavelength) provided and by a at spectropho 400 nm attometer the upper based limit on of incandescent the spectral widthlamps. of As the shown LED, Figure 3. Emission spectrumλ of 385 nm LED (VAOL-5EUV8T4) [30]. alsoin Figure known 4 in as the “center case of wavelength”, the 385 nm wavelength,0.5m, which the is definedresults provided as the wavelength by the LED halfway reach deviations between the in twothe range points of with 14–20% a spectral with densityrespect ofto 50% the ofvalues the peak. obtained by means of the commercial equipment. The whole range of wavelengths are emitted simultaneously. This results in higher values of Therefore,The whole a calibration range of process wavelengths to compensate are emitted for th simultaneously.is deviation is required. This results Brightness in higher selection values will of transmittance than those provided by a spectrophotometer based on incandescent lamps. As shown transmittancealso be discussed than in those the present provided work. by a spectrophotometer based on incandescent lamps. As shown inin Figure Figure 4 in the case case of of the the 385 385 nm nm wavelength, wavelength, the the results results provided provided by by the the LED LED reach reach deviations deviations in thein the range range of of14–20% 14–20% with with respect respect to tothe the values values obtained obtained by by means means of of the the commercial commercial equipment. equipment. 100% Therefore, a calibration process to compensate for th thisis deviation is required. Brightness Brightness selection selection will will alsoalso be be discussed in the present work. 80% Transmittance Commercial Equipment 100% 60% Brightness 120

80% Transmittance Commercial

Transmittance 40% EquipmentBrightness 350

60% Brightness 120 20%

Transmittance 40% Brightness 350 0%

20% Analyzed samples 0% Figure 4. Transmittance comparison at 385 nm between commercial equipment and LED VAOL- 5EUV8T4 [30] with two different brightnesses. Analyzed samples

FigureFigure 4. TransmittanceTransmittance comparison comparison at 385 at nm385 between nm be commercialtween commercial equipment equipment and LED VAOL-5EUV8T4 and LED VAOL- [30] 5EUV8T4with two di[30]fferent with brightnesses. two different brightnesses. Sensors 2019, 19, x FOR PEER REVIEW 6 of 24

Sensors 2019, 19, 2951 6 of 23 To characterize the transmittance between 380 and 700 nm in a first attempt 59 LEDs were needed. At the end of this research work, through the optimization of the wavelength calibration and selectionTo characterizeprocess we had the transmittancereduced this number between to 380 34 andLEDs. 700 These nm in 34 a firstLEDs attempt are listed 59 LEDsin the were Appendix needed. AAt (Table the end A1). of this research work, through the optimization of the wavelength calibration and selection process we had reduced this number to 34 LEDs. These 34 LEDs are listed in the AppendixA (Table A1). 2.4. Hardware 2.4. Hardware In order to reduce the dimensions of the equipment and thus improve its portability, in the presentIn research order to reducework it the was dimensions decided to of theeliminate equipment the use and of thus any improve optical itselements portability, such in as the lenses, present diffractionresearch workmatrix it or was monochromators. decided to eliminate the use of any optical elements such as lenses, diffraction matrixThe orproposed monochromators. assembly is shown in Figure 5, constructed entirely in black thermoplastic PolylacticThe Acid proposed (PLA) assembly by a 3D is printer. shown in The Figure tests5, carried constructed out revealed entirely inthat black the thermoplastic most accurate Polylactic results wereAcid obtained (PLA) by when a 3D printer.the sensor The tests(Figure carried 5 right) out revealed was as thatclose the as most possible accurate to the results sample were without obtained touchingwhen the it, sensorand the (Figure light source5 right) (Figure was as 5 closeleft) was as possible at a distance to the of sample about 20 without mm with touching reference it, and to the the testlight tube. source (Figure5 left) was at a distance of about 20 mm with reference to the test tube.

FigureFigure 5. 5.ViewView of ofexperiment experiment assembly. assembly.

ToTo minimize minimize the dispersiondispersion ofof the the LED LED light light beam, beam, it was it was necessary necessary to have to ahave cone-shaped a cone-shaped entrance entrancearea to capturearea to capture a greater a amountgreater am of light,ount of as light, can be as seen can be in Figureseen in5 .Figure Additionally, 5. Additionally, a channel a directingchannel directingthe beam the to beam the center to the of center the sample of the sample was needed. was needed. This channel This channel needed needed to have to a have diameter a diameter slightly slightlygreater greater than the than diameter the diameter of the LEDof the so LED as not so toas obstructnot to obstruct the passage the passage of light. of light.

2.5.2.5. Reference Reference Equipment Equipment InIn the the present present work, work, all all the the results results have have been been contrasted contrasted with with the the commercial commercial equipment equipment V-5000 V-5000 VISVIS [31]. [31 ].This This has has a aworking working spectrum spectrum between between 325 325 and and 1000 1000 nm, nm, with with a abandwidth bandwidth of of 4 4nm, nm, which which compliescomplies with with the the following following standards: standards:

• ISOISO 22891: 22891: 2013: 2013: Determination Determination of of transmi transmittancettance by by diffuse diffuse reflectance measurement. measurement. • • ISOISO 10110-9: 10110-9: 2016: 2016: Preparation Preparation of of drawings drawings for for optical optical elements elements and and systems—Part systems—Part 9: 9: Surface Surface • treatmenttreatment and and coating. coating. • ISOISO 7887:2011: 7887:2011: Water Water Quality—Examination Quality—Examination and and determination determination of of color. color. • • ISOISO 9001 9001 7.6 7.6 Control Control of of monitoring monitoring and and measuring measuring equipment. equipment. • 2.6.2.6. Brightness Brightness Level Level Definition Definition TheThe definition definition of of the the brightness brightness level level of of the the LEDs LEDs is isa key a key aspect aspect of ofthe the entire entire calibration calibration process. process. HigherHigher values values will will cause cause sensor sensor saturation, saturation, while while low low values values may may not not allow allow the the light light to to pass pass through through thethe sample. sample. To Toenable enable the the brightness brightness level level to be to varied, be varied, a driver a driver [32] [with32] witha resolution a resolution of 16 ofbits 16 has bits beenhas used, been used,capable capable of providing of providing a maximum a maximum of 40 ofmA 40 mAto each to each LED. LED. The Theuse useof 16 of bits 16bits provides provides a SensorsSensors 20192019,, 1919,, 2951x FOR PEER REVIEW 7 of 2324

range of brightness levels between 0 and 4095 [33,34], the value at which the maximum level of a range of brightness levels between 0 and 4095 [33,34], the value at which the maximum level of illumination is reached (40 mA). Based on this, a brightness level of 100 corresponds to a current of illumination is reached (40 mA). Based on this, a brightness level of 100 corresponds to a current of 0.977 mA. Continuing with this example, the level of brightness 100 has been designated with the 0.977 mA. Continuing with this example, the level of brightness 100 has been designated with the nomenclature T B100, used throughout this article. Low brightness levels are typically used when nomenclature T B100, used throughout this article. Low brightness levels are typically used when using high luminescence LEDs located a short distance from the sensor. using high luminescence LEDs located a short distance from the sensor. In this way, we consider that the amount of light detected (with a test tube of distilled water) In this way, we consider that the amount of light detected (with a test tube of distilled water) corresponds to that emitted by the LED, ignoring the possible losses produced by the dispersion of corresponds to that emitted by the LED, ignoring the possible losses produced by the dispersion of the the beam at the entrance of the channel (LED viewing angle). beam at the entrance of the channel (LED viewing angle).

2.7. Methodology To carrycarry outout thethe calibrationcalibration processprocess thatthat allowsallows LEDLED technologytechnology toto produceproduce resultsresults comparablecomparable toto thosethose obtainedobtained with incandescent lamps, it is necessary to carry out an adequate data collection. ToTo dodo this, this, the the transmittance transmittance values values obtained obtained by using by using LEDs LEDs of diff erentof different peak wavelengths peak wavelengths on different on samplesdifferent mustsamples be recordedmust be recorded (Table1), (Table so that 1), they so that can they be contrasted can be contrasted with the with transmittance the transmittance values obtainedvalues obtained by means by ofmeans the commercial of the commercial equipment equipment [31]. [31]. The methodologymethodology and and procedure procedure followed followed (with the(with help the of softwarehelp of andsoftware electronic and components) electronic tocomponents) obtain the data to obtain used the for data the measurement used for the measurement and calibration and process calibration are shown process in Figureare shown6. This in figureFigure also6. This shows figure the also duration shows of the the dura transmittancetion of the transmittance tests. tests.

Figure 6. Scheme of the work methodology. Sensors 2019, 19, 2951 8 of 23 Sensors 2019, 19, x FOR PEER REVIEW 8 of 24

3. Result and Discussion 3. Result and Discussion

3.1. Preliminary Preliminary Tests Tests As seen in Figure 7, when performing an analysis through 59 LEDs with 𝜆 between 385 and As seen in Figure7, when performing an analysis through 59 LEDs with λpeak between 385 and 700 nm, discrepancies in the transmittance values in comparison comparison with the the reference reference equipment based on incandescent lamps are observed. In In this this figu figure,re, each each of of the the LEDs LEDs used used has been denoted by a vertical line. Each Each LED LED operates operates at at a a wide wide range range of wavelengths when when it is traversing the sample (Figure3 3),), resultingresulting inin higherhigher thanthan expected expected transmittance transmittance values. values.

Sample M2 100%

90%

80%

70%

60% Transmittance Incandescent lamp 50% Transmittance Raw LED 40% Transmittance

30%

20%

10%

0% 385 400 430 468 475 505 522 558 568 583 591 602 609 627 632 639 655 697 λ(nm)

Figure 7. Comparison of the transmittance values obtained by a 5 mm LEDs spectral and those obtained Figure 7. Comparison of the transmittance values obtained by a 5 mm LEDs spectral and those by means of the commercial equipment. obtained by means of the commercial equipment. Moreover, the emission intensity of the LED plays a fundamental role in determining the Moreover, the emission intensity of the LED plays a fundamental role in determining the transmittance values. Values which are too low could make the not pass correctly through a transmittance values. Values which are too low could make the photons not pass correctly through a water sample with a certain turbidity. In contrast, too high a value would cause the saturation of the water sample with a certain turbidity. In contrast, too high a value would cause the saturation of the sensor, making the reading impossible. In conclusion, all these questions require the definition of a sensor, making the reading impossible. In conclusion, all these questions require the definition of a calibration process that compensates for this deviation in results. calibration process that compensates for this deviation in results. 3.2. LED Calibration 3.2. LED Calibration 3.2.1. Brightness Level Selection 3.2.1. Brightness Level Selection When working with LEDs with different properties and from several manufacturers, it is not alwaysWhen possible working to use with a commonLEDs with brightness different levelproperties for all and of them. from Eachseveral LED manufacturers, has different lightingit is not alwayscapacities possible (Luminous to use Intensity)a common determined brightness bylevel its fo manufacturingr all of them. process,Each LED in has such different a way thatlighting two capacitiesdifferent LEDs, (Luminous powered Intensity) by the determined same voltage by and its manufacturing current can emit process, different in brightnesssuch a way intensities. that two differentTherefore, LEDs, if we powered change this by current,the same we voltage can also and obtain current diff erentcan emit brightness different levels. brightness intensities. Therefore,If we if take we achange known this sample current, (M1), we atca din alsofferent obtain brightness different levels brightness with an levels. LED of a certain peak wavelengthIf we take (e.g., a 385known nm), sample in Figure (M1),8 we observeat different that brightness the transmittance levels valueswith an remain LED constantof a certain between peak wavelength68% and 70%, (e.g., which 385 corresponds nm), in Figure to the 8 brightnesswe observ levele that obtained the transmittance through a currentvalues fromremain 0.073 constant mA to between2.051 mA. 68% With and high 70%, luminescence which corresponds LEDs, at to low the currents, brightness we level achieve obtained an enough through brightness a current level from to 0.073carry outmA theto analysis2.051 mA. of theWith samples. high luminescence In this range LEDs, of values, at low the currents, transmittance we achieve values experimentan enough brightnesslittle variation. level As to commented,carry out the the analysis transmittance of the samples. value is In higher this range than the of referencevalues, the value transmittance of 54.35%, valuesmeasured experiment with the little commercial variation. equipment As commented, [31]. the transmittance value is higher than the reference value of 54.35%, measured with the commercial equipment [31]. Sensors 2019, 19, 2951 9 of 23 Sensors 2019, 19, x FOR PEER REVIEW 9 of 24

100%

90%

80%

70%

60%

50%

40% Transmittance 30%

20%

10%

0% T B4 T B8 T B30 T B70 T B100 T B180 T B220 T B280 T B350 (0.039 mA) (0.078 mA) (0.293 mA) (0.683 mA) (0.977 mA) (1.758 mA) (2.149 mA) (2.735 mA) (3.412 mA) Brightness levels (Current levels)

Sample M1 Transmittance commercial equipment

FigureFigure 8. 8. EffectsEffects of of the brightness level inin thethe transmittancetransmittance measurement, measurement, using using a 385a 385 nm nm LED LED [30 [30]] on onSample Sample M1. M1. Each LED is able to emit at a maximum brightness level, determined by the manufacturer using Each LED is able to emit at a maximum brightness level, determined by the manufacturer using the “Luminous Intensity” parameter, which is usually expressed in mcd (millicandelas) or lumens. the “Luminous Intensity” parameter, which is usually expressed in mcd (millicandelas) or lumens. In the case of the 385 nm LED used [30], its maximum luminous intensity is 100 mcd. Measuring the In the case of the 385 nm LED used [30], its maximum luminous intensity is 100 mcd. Measuring the brightness level of the LED would require the use of expensive and complex equipment such as lux brightness level of the LED would require the use of expensive and complex equipment such as lux meters. Therefore, we have associated the brightness level with the current applied to the LED, which meters. Therefore, we have associated the brightness level with the current applied to the LED, which is a parameter that can be easily measured without having to use any additional equipment. is a parameter that can be easily measured without having to use any additional equipment. The current level selected must be within a certain range to achieve a stable transmittance The current level selected must be within a certain range to achieve a stable transmittance value, value, even if it is greater than the expected one. As shown in Figure3, the intensity at which the even if it is greater than the expected one. As shown in Figure 3, the intensity at which the different different wavelengths emit follows a normal distribution. The further away the wavelength is from wavelengths emit follows a normal distribution. The further away the wavelength is from the peak the peak value, the lower its emission intensity. At low brightness values (low current), the effect of value, the lower its emission intensity. At low brightness values (low current), the effect of wavelengths is negligible. This can be seen in the transmittance value corresponding to brightness wavelengths is negligible. This can be seen in the transmittance value corresponding to brightness level 4 (T B4). We are using a 16-bit driver (a number between 0 and 4095) to control the current up level 4 (T B4). We are using a 16-bit driver (a number between 0 and 4095) to control the current up 40 mA, so that, the brightness level designed as “T B4”, is obtained by applying a current of 0.039 mA 40 4 mA,40 mAso that, the brightness level designed as “T B4”, is obtained by applying a current of 0.039 mA ×× = 0.039 mA . 4095 = 0.039 mA. The transmittance value was 54%, fairly close to the expected one of 54.35%. However, although the resultsThe transmittance are close, such value a lowwas level54%, offairly brightness close to isthe unsuitable expected one for spectrophotometryof 54.35%. However, operations. although theIf the results sample are hadclose, a highersuch a turbidity,low level photonsof brightness could is not unsuitable pass through for spectrophotometry it. Therefore, the use operations. of a current If thelevel sample within had the a stabilized higher turbidity, values of photons transmittance could no ist the pass best through and most it. Therefore, suitable option. the use of a current level withinAlthough the itstabilized is possible values to select of transmi any currentttance levelis the lower best and than most which suitable causes option. the saturation of the sensorAlthough [35], it isit highlyis possible recommended to select any to selectcurrent one leve whichl lower provides than which a response causes between the saturation 50–70% of of the the sensorresolution [35], ofit is the highly sensor recommended (with the distilled to select water one sample). which provides In our case, a response we are usingbetween a 16-bit 50–70% resolution of the resolution of the sensor (with the distilled water sample). In our case, we are using a 16-bit resolution (or a number between 0 and 4095), that is, an I0 value between 511 and 716 (i.e., 2.5 and 3.5 V). This is (orthe a criterion number between followed 0 here. and 4095), In Figure that8 is, it wouldan I0 value correspond between to 511 brightness and 716 (i.e., levels 2.5 between and 3.5 V). TB30 This and is theTB280, criterion i.e., 0.293 followed mA andhere. 2.735 In Figure mA. 8 it would correspond to brightness levels between TB30 and TB280, i.e., 0.293 mA and 2.735 mA. 3.2.2. Sensor Selection 3.2.2. Sensor Selection We observe from Figure2 that photodiode OSD15-E (Figure2B) presents, for example, at 470 nm, a referenceWe observe value fromI0, (measured Figure 2 that with photodiode a test-tube ofOSD1 distilled5-E (Figure water), 2B) higher presents, than S1223-01 for example, (Figure at 2470A), nm,since a reference OSD15-E hasvalue a sensitivity𝐼, (measured greater with than a test-tube 50%, while of distilled S1223 barely water), manages higher than to reach S1223-01 25%. (Figure 2A), sinceHowever, OSD15-E the sensitivityhas a sensitivity of the greater sensor than is not 50%, a critical while parameter.S1223 barely If manages the reference to reach value 25%.(I0 ) is greater,However, the light the intensity sensitivity crossing of the the sensor sample is to not be analyzeda critical( parameter.I), will increase If the proportionally. reference value Therefore, (𝐼) is greater, the light intensity crossing the sample to be analyzed (𝐼), will increase proportionally. Sensors 2019, 19, x FOR PEER REVIEW 10 of 24

Sensors 2019, 19, 2951 10 of 23 Sensors 2019, 19, x FOR PEER REVIEW 10 of 24 Therefore, the transmittance value 𝑇 = will remain constant regardless of the type of sensor used. BasedTherefore, on the the tests transmittance carried out, value we can𝑇 say = that will this remain statement constant is regardlesstrue provided of the that type the of sensor sensor has used. a the transmittance value T = I will remain constant regardless of the type of sensor used. Based on sensitivity of at least 5% for theI0 wavelength to be analyzed. Finally, the selected photodiode was theBased tests on carried the tests out, carried we can out, say we that can this say statement that this is statement true provided is true that provided the sensor that has the a sensitivity sensor has of a S1223-01, with a monetary cost three times lower than OSD15-E. atsensitivity least 5% forof at the least wavelength 5% for the to bewavelength analyzed. to Finally, be analyzed. the selected Finally, photodiode the selected was S1223-01,photodiode with was a S1223-01, with a monetary cost three times lower than OSD15-E. 3.2.3.monetary Peak costValue three Calibration times lower than OSD15-E. 3.2.3.3.2.3.In PeakPeak preliminary ValueValue CalibrationCalibration tests, each LED was only used to obtain the transmittance for a unique value of wavelength, its peak wavelength. A linear relation is observed between the transmittance values InIn preliminarypreliminary tests,tests, eacheach LEDLED waswas onlyonly usedused toto obtainobtain thethe transmittancetransmittance forfor aa uniqueunique valuevalue ofof registered with the LED and those corresponding to its 𝜆 from the reference equipment, as shown wavelength,wavelength, itsits peakpeak wavelength.wavelength. A linearlinear relationrelation isis observedobserved betweenbetween thethe transmittancetransmittance valuesvalues in Figure 9. The calibration of the peak value of the LED𝜆 always produces a better fit, above 98%, as registeredregistered withwith thethe LEDLED andand thosethose correspondingcorresponding toto its λpeak from from the the reference reference equipment, equipment, as as shownshown it is the highest wavelength intensity emitted by LED. inin FigureFigure9 .9. The The calibration calibration of of the the peak peak value value of of the the LED LED always always produces produces a better a better fit, fit, above above 98%, 98%, as itas isit theis the highest highest wavelength wavelength intensity intensity emitted emitted by by LED. LED. 100%

100% Transmittance = 0.8517*Transmittance_LED + 0.0018 80% R² = 0.9919 Transmittance = 0.8517*Transmittance_LED + 0.0018 80% R² = 0.9919 60%

60% 40%

40% 20%

20% 0% Transmittance Commercial Equipment 0% 20% 40% 60% 80% 100% 0%

Transmittance Commercial Equipment Transmittance LED (Brightness 40) 0% 20% 40% 60% 80% 100% Transmittance LED (Brightness 40) Figure 9. Scatter diagram between reference transmittance value and the most suitable brightness Figure 9. Scatter diagram between reference transmittance value and the most suitable brightness level (T40). levelFigure (T40). 9. Scatter diagram between reference transmittance value and the most suitable brightness level (T40). After the fit, fit, in Figure 10 we can observe goodgood agreement between the reference values of transmittanceAfter the obtained fit, in Figure by the 10commercial commercial we can observe equipmen equipment goodt and agreement those those measured measured between with with the a a limited-bandwidthreference limited-bandwidth values of LEDtransmittance after after the the calibration obtained calibration by process. process.the commercial To Tomake make equipmen it easier it easier fort and forthe those thereader reader measured to follow, to follow, with the a samples limited-bandwidth the samples have havebeen orderedbeenLED after ordered in thean increasingcalibration in an increasing way, process. according way, To make according to theit easier transmittance to for the the transmittance reader values to obtainedfollow, values the with obtainedsamples the commercial have with been the equipment.commercialordered in an equipment. increasing way, according to the transmittance values obtained with the commercial equipment. T Reference T Estimated

100% T Reference T Estimated 100%90%

80%90%

70%80%

60%70%

50%60% Transmittance 40%50% Transmittance 30%40%

20%30%

10%20%

10%0%

0% Analyzed samples

Analyzed samples Figure 10. ComparisonComparison of of calibration calibration equations equations for 470 nm wavelength and brightness level 40. Figure 10. Comparison of calibration equations for 470 nm wavelength and brightness level 40. Sensors 2019, 19, 2951 11 of 23 Sensors 2019, 19, x FOR PEER REVIEW 11 of 24

3.2.4.3.2.4. Extension Extension of of the the Working Working Range Range InIn this this section, section, we we show show how how it itis ispossible possible to to use use the the spectral spectral width width of of an an LED LED to to model model the the transmittancetransmittance of of other other wavelengths wavelengths in in addition addition to to that that of of the the peak peak value. value. TheThe tests tests carried carried out out showed showed that that the the portion portion of of the the spectrum spectrum that that can can be be used used to to extend extend the the workingworking range range of of a a spectrophotometer spectrophotometer is defined defined byby thosethose wavelengthswavelengths between between 10 10 and and 20 20 nm nm over over the thepeak peak value value in in the the upper upper limit limit and andthe the lowerlower spectralspectral width limit (LSWL). (LSWL). The The LSWL LSWL is is a aparameter parameter defineddefined by by the the manufacturer manufacturer (Table (Table A1). A1 ).These These limi limitsts have have been been shown shown in in Figure Figure 11, 11 using, using the the LED LED withwith a a470 470 nm nm peak peak wavelength, wavelength, as as an an example example only. only.

FigureFigure 11. 11. RepresentationRepresentation of ofthe the useful useful working working rang rangee of ofthe the 470 470 nm nm peak peak wavelength wavelength LED LED [36]. [36 ].

AsAs shown shown in in Equation (1),(1), despitedespite being being able able to useto use the lowerthe lower limit limit of the of spectral the spectral width towidth calibrate to calibratethe wavelengths, the wavelengths, with a fitwith above a fit 96%,above from 96%, tests from carried tests carried out we out recommend we recommend working working about about 10 nm 10above nm above this lower this lower limit, limit, in order in order to achieve to achieve a fit above a fit above 98%. 98%. ( 𝜆 <𝜆 < 𝜆 + 10~20𝑛𝑚, 0.962 <𝑅 <0.99 λLSWL < λpeak < λpeak + 10 20nm, 0.96 < R < 0.99 ∼ (1) (1) 𝜆λ + 10𝑛𝑚+ 10nm <𝜆 λ < 𝜆< λ + 10~20𝑛𝑚,+ 10 20nm, 0.98 0.98< R2 <𝑅 <<0.990.99 LSWL peak peak ∼ To illustrate this expression (1), we used an LED with a peak of 470 nm and a spectral width To illustrate this expression (1), we used an LED with a peak of 470 nm and a spectral width between 450 and 500 nm [36] to determine its spectrum working range. We start calibration at 450 between 450 and 500 nm [36] to determine its spectrum working range. We start calibration at 450 nm nm wavelength, which represents the lower limit of the spectral width of the 470 nm LED, and wavelength, which represents the lower limit of the spectral width of the 470 nm LED, and represents represents the most unfavorable situation. the most unfavorable situation. As seen in Figure 12, the trend is similar in both graphs [37]. Although some irregularities are As seen in Figure 12, the trend is similar in both graphs [37]. Although some irregularities are presented in the scatter diagram of Figure 13, the goodness of the resulting fit is greater than 97%, presented in the scatter diagram of Figure 13, the goodness of the resulting fit is greater than 97%, showing that it is possible to use the portion of the spectrum included between the peak value of the showing that it is possible to use the portion of the spectrum included between the peak value of the LED and the lower limit of the spectral width. Extending this lower limit beyond that point will mean LED and the lower limit of the spectral width. Extending this lower limit beyond that point will mean that the quality of the correlations will also be affected. If we take into account that the purpose of that the quality of the correlations will also be affected. If we take into account that the purpose of this this calibration process is the development of spectrophotometric equipment with a comparable calibration process is the development of spectrophotometric equipment with a comparable quality to quality to the commercial one, a fit of lower than 97% is not desirable. Therefore, a wavelength placed the commercial one, a fit of lower than 97% is not desirable. Therefore, a wavelength placed 10 nm 10 nm above the LWSL is recommended as being the lower transmittance capable that can be above the LWSL is recommended as being the lower transmittance capable that can be accurately accurately reproduced by its corresponding 𝜆 LED. reproduced by its corresponding λpeak LED. Sensors 2019, 19, x FOR PEER REVIEW 12 of 24 Sensors 2019, 19, 2951 12 of 23 Sensors 2019, 19, x FOR PEER REVIEW 12 of 24

100% 100% Transmittance Commercial Equipment 80% Transmittance Commercial Equipment 80% Transmittance LED Transmittance LED 60% 60%

40% 40% Transmittance Transmittance 450nm

Transmittance Transmittance 450nm 20% 20%

0% 0%

Analyzed samples Analyzed samples

Figure 12. Comparison of transmittance obtained at 450 nm with the commercial equipment and the FigureFigureprototype 12. 12. Comparison Comparisondeveloped based of of transmittance transmittance on an LED ofobtained obtained dominant at at 450 450wavelength nm nm with with theof the 470 commercial commercial nm. equipment equipment and and the the prototypeprototype developed developed based on an LED of dominant wavelength of 470 nm.

100% 100% Transmittance = 0.8693*Transmittance_LED - 0.039 R² = 0.9729 80% Transmittance = 0.8693*Transmittance_LED - 0.039 R² = 0.9729 80% 60% 60% 40% 40% 20% 20%

Transmittance Commercial Transmittance Equipment Commercial 0% 0% 20% 40% 60% 80% 100% Transmittance Commercial Transmittance Equipment Commercial 0% 0% 20%Transmittance 40% LED 60% (Brightness 40) 80% 100% Transmittance LED (Brightness 40) Figure 13. Scatter diagram between transmittance reference value at 450 nm and the most suitable Figure 13. Scatter diagram between transmittance reference value at 450 nm and the most suitable brightness level (T40). Figurebrightness 13. Scatter level (T40). diagram between transmittance reference value at 450 nm and the most suitable brightnessFigure 14 level compares (T40). the transmittance values measured by LED after being correlated by the linearFigure regression 14 compares presented the in transmittance Figure 13, and values the transmittance measured by values LED after obtained being with correlated the reference by the Figure 14 compares the transmittance values measured by LED after being correlated by the equipment,linear regression where presented quite good in agreement Figure 13, isand observed. the transmittance If we graphically values representobtained with the transmittance the reference linear regression presented in Figure 13, and the transmittance values obtained with the reference valuesequipment, calculated where by quite this model,good agreement for very small is observed values. (IfT we< graphically0.0448), negative represent values the transmittance are obtained, equipment, where quite good agreement is observed. If weB40 graphically represent the transmittance whichvalues makes calculated no sense by this from model, the physical for very point small of view.values Therefore, (𝑇 < 0.0448) this has, negative been adopted values as are a criterion obtained, to values calculated by this model, for very small values (𝑇 < 0.0448), negative values are obtained, considerwhich makes any negative no sense result from as the zero. physical This is point adequate of view if we. Therefore, consider thatthis thehas sample been adopted M14 had as a a reference criterion which makes no sense from the physical point of view. Therefore, this has been adopted as a criterion transmittanceto consider any value negative of 0.005. result To make as zero. it easier This foris adequate the reader if towe follow, consider the samplesthat the havesample been M14 ordered had a to consider any negative result as zero. This is adequate if we consider that the sample M14 had a inreference an increasing transmittance way, according value of to 0.005. the transmittance To make it easier values for obtained the reader with to the follow, commercial the samples equipment. have reference transmittance value of 0.005. To make it easier for the reader to follow, the samples have beenIt isordered also clear in thatan wavelengthsincreasing way, between according this lower to limitthe oftransmittance the spectral widthvalues (450 obtained nm) and with the peak the been ordered in an increasing way, according to the transmittance values obtained with the valuecommercial can also equipment. be calibrated using the 470 nm LED, achieving an improvement in the goodness-of-fit as commercial equipment. we approach the peak wavelength. A certain λ can be calibrated through different LEDs, as long as it is included within its spectral width. Table2 shows the case for the wavelength of 445 nm obtained with LEDs with di fferent λpeak. Sensors 2019, 19, 2951 13 of 23 Sensors 2019, 19, x FOR PEER REVIEW 13 of 24

T Reference T Estimated

100% 90% 80% 70% 60% 50% 40%

Transmittance 30% 20% 10% 0%

Analyzed samples

Figure 14. ComparisonComparison of calibration equa equationstions for 450 nm wavelength. Table 2. 445 nm fit quality comparison using different LEDs. It is also clear that wavelengths between this lower limit of the spectral width (450 nm) and the 2 peak value can also be calibratedλ usingλpeak theLED 470 nmR LED, achievingCalibration an Equation improvement in the goodness- of-fit as we approach the peak wavelength.428 nm 0.9924 y = 0.891x 0.0286 − A certain λ can be calibrated through430 nm different 0.9927 LEDs, y as= 0.8868xlong as it0.0298 is included within its spectral − 435 nm 0.9939 y = 0.8862x 0.0305 width. Table 2 shows the case for the wavelength of 445 nm obtained− with LEDs with different 𝜆. 445 nm 438 nm 0.9971 y = 0.8853x 0.0304 As expected, the best fit is achieved for the 440 nm LED; however,− the 438 nm LED provides a 440 nm 0.9978 y = 0.8852x 0.0301 − very similar fit. 458 nm 0.9803 y = 0.8847x 0.0314 − 461 nm 0.9714 y = 0.8832x 0.0323 − Table 2. 445 nm fit quality comparison using different LEDs.

𝟐 As expected, the bestλ fit is achieved𝝀𝒑𝒆𝒂𝒌 LED for the𝑹 440 nmCalibration LED; however, Equation the 438 nm LED provides a very similar fit. 428 nm 0.9924 y = 0.891x − 0.0286 This raises the need to decide430 between nm 0.9927calibrating y = a 0.8868x wavelength − 0.0298 using an LED whose peak wavelength is the same (or very close)435 tonm that we 0.9939 seek to y calibrate = 0.8862x or − using 0.0305 another LED that contains that wavelength in its spectral445 nm width.438 nm This is 0.9971 critical in y order= 0.8853x to be − 0.0304 able to determine the effective working range of each diode. To illustrate440 nm this situation, 0.9978 we y = shall 0.8852x consider − 0.0301 the calibration of an extreme case, the wavelength of 500 nm, which458 isnm the upper 0.9803 limit y of = the0.8847x spectral − 0.0314 width of the 470 nm LED [36]. The study was also carried out with461 LED nm SSL-LX5093UEGC 0.9714 y = 0.8832x [38], with − 0.0323 a peak wavelength of 500 nm. The results are presented in Figure 15. This figure shows the comparison of the transmittance values obtainedThis atraises 500 nmthe withneed LEDsto decide of 470 between nm and calibrating 500 nm of peaka wavelength wavelength, using before an LED (Figure whose 15A) peak and wavelengthafter (Figure is15 theB) thesame calibration (or very process.close) to Asthat can we be seek seen, to thecalibrate results or provided using another by the LED 500 nmthat LED contains are a thatcloser wavelength fit to the reference in its spectral values width. than those This provided is critical with in order the 470 to nmbe able LED. to The determine first provides the effective a fit of working98.97%, compared range of toeach 74.68% diode. obtained To illustrate with the this 470 situation, nm, which we represents shall consider a worsening the calibration of 24%. Thisof an is extremebecause 500case, nm the is wavelength located at the of upper500 nm, limit which of the is th spectrale upper width limit ofof thethe 470spectral nm LED, width i.e., of 30 the nm 470 away, nm LEDand is[36]. therefore The study expected was also to provide carried a out worse with response LED SSL-LX5093UEGC than an LED with [38], a peak with wavelength a peak wavelength closer to of500 500 nm. nm. The results are presented in Figure 15. This figure shows the comparison of the transmittanceThis result values proves obtained that we at cannot 500 nm use with an LEDs LED whoseof 470 nm peak and wavelength 500 nm of ispeak more wavelength, than 30 nm before from (Figurethe one we15A) seek and to after calibrate. (Figure 15B) the calibration process. As can be seen, the results provided by the 500Nevertheless, nm LED areas a closer shown fit in to Table the reference2, if the wavelengthvalues than those to be provided calibrated with is at the 20 470 nm nm or lessLED. with The firstrespect provides to the peaka fit of value 98.97%, of the compared LED (in the to example74.68% obtained from Table with2, 445the nm)470 itnm, is possiblewhich represents to obtain aa worseninghigh goodness-of-fit. of 24%. This Proof is because of that is500 the nm LED is located with a peak at the wavelength upper limit of of 428 the nm, spectral which width can explain of the 470 the nm445 LED, nm with i.e., an30 accuracynm away, of and 99%. is therefore expected to provide a worse response than an LED with a peak wavelength closer to 500 nm. Sensors 2019, 19, 2951 14 of 23

This shows that there is a limited capacity in terms of the wavelengths at which an LED can Sensorsprovide 2019 its, 19 spectral, x FOR PEER width. REVIEW This process of verifying the useful spectral width of each LED has led14 usof 24 to the expressions shown in Equation (1).

100%

90% T Reference 80% T LED 470nm (Raw) 70% T LED 500nm (Raw) 60%

50%

40%

30% Trasnmittance (500nm)

20%

10%

0%

Analyzed samples

A 100%

90% T Reference 80% T LED 470 (Calibrated) 70% T LED 500 (Calibrated) 60%

50%

40%

30% Trasnmittance (500nm)

20%

10%

0%

Analyzed samples

B

FigureFigure 15. 15. ComparisonComparison of of the the transmittance transmittance obtained obtained at at 500 500 nm nm with with the the commercial commercial equipment equipment and and thethe prototype prototype developed developed based based on on an an LED LED with with a a peak peak wavelength wavelength of of 470 470 nm nm and and 500 500 nm. nm. ( (AA)) Before Before thethe calibration calibration process. process. ( (BB)) After After the the calibration calibration process. process.

3.2.5.This General result Calibration proves that Equation we cannot use an LED whose peak wavelength is more than 30 nm from the oneThe we need seek to to calculate calibrate. the calibration lines for each of the wavelengths that we wish to add to our ownNevertheless, equipment can as resultshown in in a tediousTable 2, and if the ine wavelengthfficient task. to Any be calibrated extension ofis theat 20 working nm or less spectrum with respectwould requireto the peak the acquisition value of the of newLED data(in the and example their comparison from Table with 2, 445 the expectednm) it is transmittancepossible to obtain values. a high goodness-of-fit.Nevertheless, it Proof is possible of that to is find the aLED generic with expression a peak wavelength that allows of us428 to nm, fit eachwhich of can the explain desired thewavelengths, 445 nm with independently an accuracy of of 99%. the LED used, as long as it includes that wavelength within its spectralThis width.shows that there is a limited capacity in terms of the wavelengths at which an LED can provideTo illustrateits spectral the width. procedure This process followed of toverifyin obtaing genericthe useful calibration spectral equations,width of each all calibrationLED has led lines us tocalculated the expressions using the shown procedure in Equation described (1). in the previous sections have been represented in Figure 16.

3.2.5. General Calibration Equation The need to calculate the calibration lines for each of the wavelengths that we wish to add to our own equipment can result in a tedious and inefficient task. Any extension of the working spectrum Sensors 2019, 19, x FOR PEER REVIEW 15 of 24

would require the acquisition of new data and their comparison with the expected transmittance values. Nevertheless, it is possible to find a generic expression that allows us to fit each of the desired wavelengths, independently of the LED used, as long as it includes that wavelength within its spectral width. To illustrate the procedure followed to obtain generic calibration equations, all calibration lines

Sensorscalculated2019, 19 using, 2951 the procedure described in the previous sections have been represented in 15Figure of 23 16. In the present work, only wavelengths between 380 and 700 nm have been calibrated at 5 nm intervals, although it is possible to extend this range and reduce the bandwidth to 1 nm. In theFor present a better work, understanding, only wavelengths each betweenof the calibratio 380 andn 700 lines nm has have been been represented calibrated atwith 5 nm the intervals, color of althoughits wavelength. it is possible to extend this range and reduce the bandwidth to 1 nm.

FigureFigure 16.16. CalibrationCalibration lineslines betweenbetween 380380 andand 700700 nm.nm.

ForThe a calibration better understanding, lines have a eachslope of that the changes calibration depending lines has on been the represented wavelength. with In the the enlarged color of itsview wavelength. of Figure 16, it can be observed that these are distributed in a very close way to how the visible spectrumThe calibration does it [39]. lines However, have a slopethe way that the changes slope dependingevolves changes on the depending wavelength. on Inthe the wavelength enlarged viewrange of being Figure analyzed. 16, it can be observed that these are distributed in a very close way to how the visible spectrumTo understand does it [39]. the However, behavior the wayof the the calibration slope evolves lines changes (Figure depending 16), Figure on the17 wavelengthshows the rangetransmittance being analyzed. values that would be obtained just at the tipping point of most graphs. In other words, the pointTo understand where all thethe behavior LEDs would of the provide calibration a transm lines (Figureittance value16), Figure (before 17 showscalibration) the transmittance of 50% for a valuescertain that sample. would At be this obtained point, just the at behavior the tipping ofpoint the calibration of most graphs. lines Inof other Figure words, 16 are the most point clearly where allobserved. the LEDs would provide a transmittance value (before calibration) of 50% for a certain sample. At this point, the behavior of the calibration lines of Figure 16 are most clearly observed. As we can see in Figure 17, the graph forms groups. If we look at the wavelengths that delimit each group, we observe that these correspond to the different color groups that make up the visible light spectrum [40], the spectral limits of which are shown in Figure 18. Based on these groups, we have determined the expressions that link the calibration line of Figure 16 to the wavelength. In the following we show only the procedure for determining the corresponding generic calibration equation for the “Blue” color group (427–476 nm), by means of an example. Table3 shows the calibration lines calculated for the wavelengths corresponding to the color blue, that is to say, between 427 and 480 nm, at intervals of 5 nm. When we work with a linear model (Figures9, 13 and 16), the only parameters we need to estimate as a function of the wavelength are the slope m and the ordinate at the origin n. Through a scatter plot, it is possible to obtain the trend line that relates both parameters with respect to the value of λ. The results are shown in Figure 19. Both the slope m and the ordinate at the origin n can be defined as a line whose slope depends on the wavelength we seek to calculate (Figure 19A,B). As shown in Figure 19C,D, the values of m0 and n0 calculated using this model are very close to the values obtained empirically using the manual calibration procedure, described in the previous sections. Sensors 2019, 19, x FOR PEER REVIEW 16 of 24

46% 380nm 385nm 390nm 380nm395nm 400nm 405nm 45% 385nm410nm 415nm 420nm Sensors 2019, 19, 2951 390nm425nm 428nm 16430nm of 23 Sensors 2019, 19, x FOR PEER REVIEW 395nm435nm 440nm 16445nm of 24 44% 400nm450nm 455nm 460nm 405nm461nm 464nm 465nm 46% 410nm468nm 470nm 475nm 43% 380nm 385nm 390nm 380nm415nm395nm480nm 400nm485nm 405nm490nm 495nm 500nm 505nm 45% 385nm420nm410nm 415nm 420nm 42% 390nm425nm425nm510nm 428nm515nm 430nm520nm 521nm 522nm 530nm 395nm428nm435nm 440nm 445nm 44% 532nm 550nm 555nm 400nm430nm450nm 455nm 460nm 41% 557nm 558nm 560nm 405nm435nm461nm 464nm 465nm 565nm 570nm 574nm 410nm440nm468nm 470nm 475nm 43% 575nm 580nm 583nm 40% 415nm445nm480nm 485nm 490nm 495nm585nm 500nm586nm 505nm590nm 420nm450nm 591nm 594nm 595nm

Calibrated Transmittance 510nm 515nm 520nm 42% 425nm455nm 39% 521nm600nm 522nm602nm 530nm605nm 428nm460nm 532nm607nm 550nm609nm 555nm610nm 430nm461nm 41% 557nm615nm 558nm620nm 560nm622nm 435nm464nm 38% 565nm624nm 570nm625nm 574nm627nm 440nm 465nm575nm630nm 580nm631nm 583nm632nm 40% 445nm 468nm585nm635nm 586nm636nm 590nm639nm 37% 450nm 470nm591nm640nm 594nm642nm 595nm645nm Calibrated Transmittance 455nm475nm650nm 655nm 656nm 39% 600nm 602nm 605nm 36% 460nm500nm607nm660nm 609nm697nm 610nm700nm λ(nm) 461nm615nm 620nm 622nm 38% 464nm624nm 625nm 627nm Figure 17. Transmittance values calculated at the tipping point of the calibration 465nmlines630nm of Figure631nm 16.632nm 468nm635nm 636nm 639nm 37% Transmittance LED 50%. 470nm640nm 642nm 645nm 475nm650nm 655nm 656nm 500nm660nm 697nm 700nm 36%As we can see in Figure 17, the graph forms groups. If we look at the wavelengths that delimit λ(nm) each group, we observe that these correspond to the different color groups that make up the visible lightFigure Figurespectrum 17. 17. Transmittance Transmittance[40], the spectral values values limits calculated calculated of which at at the theare tipping tipping shown pointpoint in Figure of of the the 18.calibration calibration lines lines of of Figure Figure 16. 16 . TransmittanceTransmittance LED 50%.

As we can see in Figure 17, the graph forms groups. If we look at the wavelengths that delimit each group, we observe that these correspond to the different color groups that make up the visible light spectrum [40], the spectral limits of which are shown in Figure 18.

Figure 18. VisibleVisible light color spectrum.

Table 3. Calibration straight lines between 427 and 480 nm (Blue). Based on these groups, we have determined the expressions that link the calibration line of Figure 16 to the wavelength. In the following we show only the procedure2 for determining the λ Calibration Equation m n R corresponding generic428 calibration y = equation0.9004x 0.0418for the “Blue” 0.9004 color group0.0418 (427–476 0.9892 nm), by means of an Figure 18. −Visible light color spectrum.− example. 430 y = 0.8985x 0.0399 0.8985 0.0399 0.9906 − − Table 3 shows the435 calibration y = lines0.9x calculated0.0391 for the 0.9 wavelengths0.0391 corresponding 0.9911 to the color − − Based on these groups,440 we y =have0.8973x determined0.0342 the 0.8973expressions0.0342 that link 0.9917 the calibration line of blue, that is to say, between 427 and 480 nm,− at intervals of 5 nm. −When we work with a linear model Figure 16 to the wavelength.445 In y =the0.891x following0.0286 we show 0.891 only the0.0286 procedure 0.9924 for determining the (Figures 9, 13, and 16), the only parameters− we need to estimate −as a function of the wavelength are corresponding generic450 calibration y = equation0.8728x for0.0214 the “Blue” 0.8728 color group0.0214 (427–476 0.9918 nm), by means of an − − the slope m and the ordinate455 at the y = 0.879xorigin n.0.0214 0.879 0.0214 0.9941 example. − − 460 y = 0.8738x 0.0115 0.8738 0.0115 0.9973 Table 3 shows the calibration lines calculated− for the wavelengths− corresponding to the color Table461 3. Calibration y = 0.8665x straight0.0039 lines between 0.8665 427 and0.0039 480 nm (Blue). 0.9986 − − blue, that is to say, between464 427 yand= 0.8621x 480 nm,+ 0.0034 at intervals 0.8621 of 5 nm. When 0.0034 we work 0.9981 with a linear model 𝝀 Calibration Equation 𝒎 𝒏 𝑹𝟐 (Figures 9, 13, and 16),465 the only y parameters= 0.8747x 0.0117we need to 0.8747estimate as0.0117 a function 0.9972 of the wavelength are − − the slope m and the ordinate428468 at y ythe= =0.9004x 0.8753xorigin − n.0.0418 0.0002 0.9004 0.8753 −0.04180.0002 0.9892 0.9978 − − 430470 y y= =0.8985x0.8685x − +0.03990.0092 0.8985 0.8685 −0.0399 0.0092 0.9906 0.9953 Table435475 3. Calibration y = 0.9x0.864x straight− 0.0391+ 0.0169 lines between0.864 0.9 427 and−0.0391 0.0169 480 nm (Blue).0.9911 0.9875 440480 y y= =0.8973x0.8537x − +0.03420.0265 0.8973 0.8537 −0.0342 0.0265 0.9917 0.9628 445𝝀 Calibration y = 0.891x Equation− 0.0286 0.891𝒎 −0.0286𝒏 0.9924𝑹𝟐 428450 y y == 0.9004x0.8728x −− 0.04180.0214 0.9004 0.8728 −−0.04180.0214 0.98920.9918 From these data,430 it is possible y = 0.8985x to − determine0.0399 the 0.8985 expression −0.0399 that 0.9906 allows us to correlate the transmittance results435 obtained by y = the 0.9x commercial − 0.0391 equipment 0.9 with−0.0391 respect to0.9911 the values obtained by an LED, according to the440 wavelength. y = 0.8973x − 0.0342 0.8973 −0.0342 0.9917 445 y = 0.891x − 0.0286 0.891 −0.0286 0.9924 450 y = 0.8728x − 0.0214 0.8728 −0.0214 0.9918 Sensors 2019, 19, x FOR PEER REVIEW 17 of 24

455 y = 0.879x − 0.0214 0.879 −0.0214 0.9941 460 y = 0.8738x − 0.0115 0.8738 −0.0115 0.9973 461 y = 0.8665x − 0.0039 0.8665 −0.0039 0.9986 464 y = 0.8621x + 0.0034 0.8621 0.0034 0.9981 465 y = 0.8747x − 0.0117 0.8747 −0.0117 0.9972 468 y = 0.8753x − 0.0002 0.8753 −0.0002 0.9978 470 y = 0.8685x + 0.0092 0.8685 0.0092 0.9953 475 y = 0.864x + 0.0169 0.864 0.0169 0.9875 480 y = 0.8537x + 0.0265 0.8537 0.0265 0.9628

Through a scatter plot, it is possible to obtain the trend line that relates both parameters with Sensors 2019, 19, 2951 17 of 23 respect to the value of λ. The results are shown in Figure 19.

Calibration line m Calibration line n 0.91 0.04 0.9 m = -0.0009𝜆 + 1.2853 0.02 n = 0.0013𝜆 – 0.5929 R² = 0.9832 R² = 0.9849 0.89 0 0.88 -0.02

Slope (m) Slope (m) 0.87 0.86 -0.04 0.85 -0.06 420 430 440 450 460 470 480 490 Ordinate atthe origin (n) 420 430 440 450 460 470 480 490 𝜆(nm) 𝜆(nm)

(A) (B) Calculated m (m') Calculated n (n') 0.91 0.04 0.9 0.89 0.02 0.88 0 0.87 0.86 -0.02 Slope (m) 0.85 0.84 -0.04

0.83 Ordinate at the origin (n) 0.82 -0.06 𝜆(nm) 𝜆(nm)

(C) (D)

FigureFigure 19. 19. CalculationCalculation of of the the trend trend lines lines of of the the slope slope m mand and the the ordinate ordinate at origin at origin n according n according to λ. to λ. (A(A,B,B)) are are the the scatterscatter graphsgraphs used to to enable enable the the regression regression line line (model) (model) for for the the slope slope m andm and the theordinate ordinate atat origin originn nto to bebe calculated.calculated. ( (CC,,DD)) show show the the mm andand n nvaluesvalues calculated calculated through through that that model. model.

InBoth Equation the slope (2), m the and generic the ordinate calibration at the equations origin n arecan shownbe defined for eachas a line of the whose color slope groups depends shown in Figureon the 18 wavelength. It is important we seek to emphasizeto calculate that (Figure although 19A,B). the As red shown color in is upFigure to 780 19C,D, nm, wethe havevalues only of m made′ theand calibration n′ calculated up using to 700 this nm, model since are we very do not close have to the LEDs values that obtained emit at thoseempirically wavelengths. using the manual calibration procedure, described in the previous sections.

From these data, it is possibley380 427to nmdetermine= (0.0013 theλ expression+ 0.2941) thatT allows us to correlate the transmittance results obtained by the− commercial equipment with respect∗ to the values obtained by y427 480nm = ( 0.0009 λ + 1.2853) T + (0.0013 λ 0.5929) an LED, according to the− wavelength.− ∗ ∗ ∗ − y480 497nm = ( 0.00001 λ + 0.9198) T + (0.0043 λ 2.1638) In Equation (2), the− generic calibration− equation∗ s are ∗shown for each∗ of− the color groups shown y497 570nm = ( 0.0004 λ + 1.1273) T + (0.0002 λ 0.1245) (2) in Figure 18. It is important− to emphasize− that∗ although the∗ red color is∗ up− to 780 nm, we have only y570 581nm = (0.0578 λ 32.296) T + (0.0221 λ + 12.652) made the calibration up− to 700 nm, since we∗ do− not have∗ LEDs that emit∗ at those wavelengths. y581 618nm = ( 0.018 λ + 11.677) T + ( 0.0032 λ + 1.8929) − − ∗ ∗ − ∗ y618 700nm =𝑦(0.0006 λ=+ (0.0013𝜆0.5462) T ++ 0.2941( 0.0001) ∗𝑇 λ + 0.0277) − ∗ ∗ − ∗ (2) 𝑦 = (−0.0009 ∗ 𝜆 + 1.2853) ∗𝑇+(0.0013 ∗ 𝜆 − 0.5929) 3.3. Results Using the calibration procedure described above, it is possible to achieve results very close to those obtained by using commercial equipment based on incandescent lamps. This section shows the measured transmittance values for samples of different types and concentrations, along with the values provided by the commercial equipment. As can be seen in Figure 20, there is good agreement between the two charts. Furthermore, each of the comparative graphs has been accompanied by the transmittance values obtained before the calibration process, in order to show the deviation in the results. This demonstrates that the calibration process described in the previous sections can produce results comparable to those obtained with incandescent lamps. Sensors 2019, 19, x FOR PEER REVIEW 18 of 24

𝑦 = (−0.00001 ∗ 𝜆 + 0.9198) ∗𝑇+(0.0043 ∗ 𝜆 − 2.1638)

𝑦 = (−0.0004 ∗ 𝜆 + 1.1273) ∗𝑇+(0.0002 ∗ 𝜆 − 0.1245)

𝑦 = (0.0578 ∗ 𝜆 − 32.296) ∗𝑇+(0.0221 ∗ 𝜆 + 12.652)

𝑦 = (−0.018 ∗ 𝜆 + 11.677) ∗𝑇+(−0.0032 ∗ 𝜆 + 1.8929)

𝑦 = (0.0006 ∗ 𝜆 + 0.5462) ∗𝑇+(−0.0001 ∗ 𝜆 + 0.0277)

3.3. Results Using the calibration procedure described above, it is possible to achieve results very close to those obtained by using commercial equipment based on incandescent lamps. This section shows the measured transmittance values for samples of different types and concentrations, along with the values provided by the commercial equipment. As can be seen in Figure 20, there is good agreement between the two charts. Furthermore, each of the comparative graphs has been accompanied by the transmittance values obtained before the calibration process, in order to show the deviation in the results. This demonstrates that the calibration process described in the previous sections can produce results comparable to those obtained with incandescent lamps. If we pay attention to Figure 20B–E, we observe that for wavelengths between 510 and 550 nm (which correspond to the green color spectrum) there are certain irregularities. Such irregularity is due to the fact that after the calibration process, the fit was 96%, while the rest of the wavelengths obtained values above 98%. This problem is probably due to the fact that the LEDs used to explain this region of the spectrum do not have the peak wavelength indicated by the manufacturer, since this problem has only been observed in the LEDs used for that wavelength range, whose peak wavelengths according to the manufacturer are 515, 531, 532, and 550 nm, respectively. In each of the results graphs, the wavelength range explained by each of the 34 LEDs used after Sensorsthe calibration2019, 19, 2951 process has been delimited by vertical lines. Each vertical line presents an LED with 18a of 23 different peak wavelength.

Sample M2 Sample M3 100% 100%

90% 90%

80% 80%

70% 70%

60% 60%

50% 50%

40% 40% Transmittance Transmittance 30% 30%

20% 20%

10% 10%

0% 0% 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 λ (nm) λ (nm)

Transmittance Incandescent lamp Transmittance estimated Transmittance Incandescent lamp Transmittance estimated Transmittance without calibration Transmittance without calibration Sensors 2019, 19, x FOR PEER REVIEW 19 of 24 (A) (B)

Sample M5 Sample M8 100% 100%

90% 90%

80% 80%

70% 70%

60% 60%

50% 50%

40% 40% Transmittance Transmittance 30% 30%

20% 20%

10% 10%

0% 0% 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 λ (nm) λ (nm)

Transmittance Incandescent lamp Transmittance estimated Transmittance Incandescent lamp Transmittance estimated Transmittance without calibration Transmittance without calibration (C) (D) Sample M9 Sample M10 100% 100%

90% 90%

80% 80%

70% 70%

60% 60%

50% 50%

40% 40% Transmittance Transmittance 30% 30%

20% 20%

10% 10%

0% 0% 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 λ (nm) λ (nm)

Transmittance Incandescent lamp Transmittance estimated Transmittance Incandescent lamp Transmittance estimated Transmittance without calibration Transmittance without calibration (E) (F) Sample M13 Sample M19 100% 100%

90% 90%

80% 80%

70% 70%

60% 60%

50% 50%

40% 40% Transmittance Transmittance 30% 30%

20% 20%

10% 10%

0% 0% 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 λ (nm) λ (nm)

Transmittance Incandescent lamp Transmittance estimated Transmittance Incandescent lamp Transmittance estimated Transmittance without calibration Transmittance without calibration (G) (H)

FigureFigure 20. 20.Comparative Comparative results results of theof the transmittance transmittance values, values, before before (green) (green) and afterand (red)after the(red) calibration the processcalibration forthe process following for the samples: following (samples:A) M2, (B(A)) M3,M2, ((CB) M3, M5, ( (CD) )M5, M8, (D (E) )M8, M9, (E ()F M9,) M10, (F) M10, (G) M13 (G) and (HM13) M19. and (H) M19.

The samples used to carry out the calibration process are representative of the transmittance values that can be presented by samples of wastewater from sewage networks. The wastewater samples can have transmittance values between 20–90% [41]. To show the adequacy of the calibration system, Figure 21 includes the results of the analysis performed with a sample of wastewater obtained from a treatment plant, which does not belong to the list of samples (Table 1) used during the calibration process. Sensors 2019, 19, 2951 19 of 23

If we pay attention to Figure 20B–E, we observe that for wavelengths between 510 and 550 nm (which correspond to the green color spectrum) there are certain irregularities. Such irregularity is due to the fact that after the calibration process, the fit was 96%, while the rest of the wavelengths obtained values above 98%. This problem is probably due to the fact that the LEDs used to explain this region of the spectrum do not have the peak wavelength indicated by the manufacturer, since this problem has only been observed in the LEDs used for that wavelength range, whose peak wavelengths according to the manufacturer are 515, 531, 532, and 550 nm, respectively. In each of the results graphs, the wavelength range explained by each of the 34 LEDs used after the calibration process has been delimited by vertical lines. Each vertical line presents an LED with a different peak wavelength. The samples used to carry out the calibration process are representative of the transmittance values that can be presented by samples of wastewater from sewage networks. The wastewater samples can have transmittance values between 20–90% [41]. To show the adequacy of the calibration system, Figure 21 includes the results of the analysis performed with a sample of wastewater obtained from a treatment plant, which does not belong to the list of samples (Table1) used during the Sensorscalibration 2019, 19 process., x FOR PEER REVIEW 20 of 24

Wastewater sample (D10062019) 100%

90%

80%

70%

60%

50%

40% Transmittance 30%

20%

10%

0% 380 405 428 450 465 485 510 530 558 575 590 602 615 627 636 650 700 λ (nm)

Transmittance Incandescent lamp Transmittance estimated

Figure 21. Figure 21. WastewaterWastewater sample analysis (D10062019). In view of the results, it is possible to obtain a response comparable to that obtained by expensive In view of the results, it is possible to obtain a response comparable to that obtained by expensive commercial equipment based on incandescent lamps, through the use of LED technology, after a commercial equipment based on incandescent lamps, through the use of LED technology, after a calibration process. calibration process. Several statistical indicators have been calculated to enable an analysis of how well the calibration Several statistical indicators have been calculated to enable an analysis of how well the process works. The quadratic mean error (RMSD) [42], and the error index, Er, are calculated according calibration process works. The quadratic mean error (RMSD) [42], and the error index, Er, are to Equations (3) and (4). These were calculated in the wavelength range of 380 to 700 nm, as seen calculated according to Equations (3) and (4). These were calculated in the wavelength range of 380 previously in Figure 20. to 700 nm, as seen previously in Figurer 20. 1 Xn 2 RMSD = (Tmeasured_i Tcalculated_i) (3) 1 n i − 𝑅𝑀𝑆𝐷 = Pn𝑇_ −𝑇_ (3) 𝑛 (T T ) i measured_i calculated_i Er(%) = P − 100 (4) n T ∗ ∑𝑇 i measured−𝑇 _i 𝐸𝑟(%) = _ _ ∗ 100 Er n (4) where is the error index (%); is the number∑ 𝑇 of wavelength_ (in our case, it takes the value of 81); Tmeasured and Tcalculated are the values of transmittance obtained through the commercial equipment [31] where Er is the error index (%); n is the number of wavelength (in our case, it takes the value of 81); and own design based on LED technology (Figure5), respectively. 𝑇 and 𝑇 are the values of transmittance obtained through the commercial equipment [31] and own design based on LED technology (Figure 5), respectively. As we can see in Table 4, we obtained an RMSD very close to zero for all the samples. This shows that the transmittance values obtained through commercial equipment and those obtained through the calibration process described in this research work are very close to each other. Proof of this lies in the error values, Er. For all the samples, the error has always been lower than 5%, and in almost all cases was less than 1%. That is an error index comparable to that the equipment based on incandescent lamps.

Table 4. RMSD and Error index.

Sample RMSD Er (%) M2 0.02062086 1.451423749 M3 0.028591905 0.962997523 M5 0.024032501 0.990803799 M8 0.027103038 2.135421037 M9 0.023634811 1.473856032 M10 0.019272554 1.426693178 M13 0.017883052 4.921374084 M19 0.013081104 0.986143228 D10062019 0.020993826 –1.152994953 Sensors 2019, 19, 2951 20 of 23

As we can see in Table4, we obtained an RMSD very close to zero for all the samples. This shows that the transmittance values obtained through commercial equipment and those obtained through the calibration process described in this research work are very close to each other.

Table 4. RMSD and Error index.

Sample RMSD Er (%) M2 0.02062086 1.451423749 M3 0.028591905 0.962997523 M5 0.024032501 0.990803799 M8 0.027103038 2.135421037 M9 0.023634811 1.473856032 M10 0.019272554 1.426693178 M13 0.017883052 4.921374084 M19 0.013081104 0.986143228 D10062019 0.020993826 1.152994953 −

Proof of this lies in the error values, Er. For all the samples, the error has always been lower than 5%, and in almost all cases was less than 1%. That is an error index comparable to that the equipment based on incandescent lamps. It should be noted that not all the LEDs used have taken full advantage of their useful spectral width. Although the range of the spectral width shown in Equation (1) ensures us a goodness-of-fit above 97%, it has been chosen not to take all the range of the diodes, using more LEDs in order to achieve a fit close to 99%. This has resulted in a total of 34 LEDs to calibrate 81 wavelengths.

4. Conclusions In this paper, we have shown that it is possible to use LED technology as a replacement for traditional incandescent lamps, for the development of spectrophotometers. To achieve this, it is necessary to carry out a calibration process the compensate for the effect produced by the multiple wavelengths that the LEDs emits at the same time (spectral width). Therefore, we can conclude that the calibration procedure described enables us to achieve results comparable to those obtained by incandescent lamps. Proof of that lies in the fact that the error obtained has been less than 5%, and was around 1% in most cases analyzed (Table4). The methodology proposed allows us to:

(i) Obtain results comparable to those provided by commercial equipment based on incandescent lamps, without using any type of optical elements such as lenses or diffraction matrix that would make the equipment more expensive; (ii) Extend the working range of each LED, covering the whole visible spectrum using a smaller number of LEDs; (iii) Reduce the dimensions, costs and sampling times of the equipment, which are vital aspects for the development of low-cost autonomous systems designed to measure in any type of environment.

This calibration procedure allows anyone to develop their own spectrophotometry equipment. This means that everyone can have access to this type of equipment at a small fraction of the cost of commercial equipment. This procedure has enabled us to achieve a working range between 380 and 700 nm by using just 34 LEDs that cover different areas of the visible spectrum, with a resolution of 5 nm. That opens the door to the development of new systems based on this technology, lowering the cost of equipment while reducing its size and consumption, enabling the creation of autonomous equipment that can run on batteries in any environment. Sensors 2019, 19, 2951 21 of 23

This type of systems can be very useful for the detection of unauthorized discharges, as the system can be placed in any environment, monitoring 24 h a day. It is therefore a tool against fraud and can contribute to environmental protection. All this research work will allow us to have real-time control of water quality in sewer systems during rainfall events and dry weather periods, through a portable and cost-effective device to analyze the contaminant load present in wastewater.

Author Contributions: Investigation, D.C.-P. and J.T.G.; Data curation, D.C.-P.; Formal analysis, D.C.-P., J.T.G., F.C.-C. and J.S.-M.; Funding acquisition, D.C.-P., J.T.G. and J.S.-M.; Methodology, D.C.-P., J.T.G., F.C.-C. and J.S.-M; Software, D.C.-P. and F.C.-C.; Supervision, D.C.-P., J.T.G., F.C.-C. and J.S.-M; Validation, J.T.G., F.C.-C. and J.S.-M; Writing—original draft, D.C.-P. and J.T.G. Funding: This research was funded by Seneca Foundation of the Región de Murcia (Spain) and “Hidrogea, Gestión Integral de Aguas de Murcia S.A”. Acknowledgments: Authors wish to thank the financial support received from the Seneca Foundation of the Región de Murcia (Spain) through the program devoted for training of novel researchers in areas of specific interest for the industry and with a high capacity to transfer the results of the research generate entitled: “Subprograma Regional de Contratos de Formación de Personal Investigador en Universidades y OPIs” (Mod. B, Ref. 20320/FPI/17). Conflicts of Interest: The authors declare no conflict of interest.

Appendix A

Table A1. LEDs used.

Spectral Width ID λPeak (nm) Reference Datasheet Lower Limit (nm) Upper Limit (nm) 1 385 360 400 VAOL-5EUV8T4 www.mouser.es 2 390 388 392 UV5TZ-390-15 www.mouser.es 3 395 393 398 UV5TZ-395-15 www.mouser.es 4 400 398 400 UV5TZ-400-15 www.mouser.es 5 405 395 415 VAOL-5EUV0T4 www.mouser.es 6 428 400 440 4304H6 www.mouser.es 7 461 440 480 151053BS04500 www.mouser.es 8 468 456 480 LTL2P3TBK5 www.mouser.es 9 500 475 520 SSL-LX5093UEGC www.mouser.es 10 505 487 518 LTL2V3TCYK2 www.mouser.es 11 515 497 531 WP7113ZGCK www.eu.mouser.com 12 521 505 536 HLMP-HM74-34CDD www.broadcom.com 13 532 506 544 LTL2P3TGZ2KS www.mouser.es 14 557 543 575 WP7113PGC www.eu.mouser.com 15 558 500 570 HLMP-C615-G0001 www.broadcom.com 16 574 585 602 TLCYG5100 www.mouser.es 17 583 550 610 521-9466F www.mouser.es 18 586 565 615 521-9271F www.uy.mouser.com 19 594 587 600 HLMP-EL1A-Z1KDD www.broadcom.com 20 605 590 620 SLI-580DT3F www.mouser.es 21 607 581 623 WP7113NC www.kingbrightusa.com 22 609 600 618 HLMP-EJ15-SV000 www.mouser.es 23 622 612 632 TLCR5200 www.mouser.es 24 624 597 648 C503B-RBN-CX0Y0AA1 www.mouser.es 25 627 600 650 WP57EYW www.mouser.es 26 631 623 645 151053RS03000 www.mouser.es 27 636 625 648 SSL-LX5093SIC www.eu.mouser.com 28 639 630 650 LTL2H3KRK www.mouser.es 29 650 635 663 HLMP-4101 www.mouser.mx 30 655 650 675 WP7113SRC/DU www.mouser.es 31 656 645 665 VAOL-5GAE4 www.eu.mouser.com 32 660 648 675 LTL-4268-H3 www.mouser.es 33 697 650 743 LTL-4213 www.digikey.com 34 700 655 730 SSL-LX5093HD-TR www.lumex.com Sensors 2019, 19, 2951 22 of 23

References

1. Thomas, O.; Burgess, C. (Eds.) UV-Visible Spectrophotometry of Water and Wastewater; Elsevier: Amsterdam, The Netherlands, 2017. 2. Bourgeois, W.; Burgess, J.E.; Stuetz, R.M. On-line monitoring of wastewater quality: A review. J. Chem. Technol. Biotechnol. Int. Res. Process Environ. Clean Technol. 2001, 76, 337–348. [CrossRef] 3. Chen, B.; Wu, H.; Li, S.F.Y. Development of variable pathlength UV-Vis spectroscopy combined with partial-least-squares regression for wastewater chemical oxygen demand (COD) monitoring. Talanta 2014, 120, 325–330. [CrossRef][PubMed] 4. Brito, R.S.; Pinheiro, H.M.; Ferreira, F.; Matos, J.S.; Lourenço, N.D. In situ UV-Vis spectroscopy to estimate COD and TSS in wastewater drainage systems. Urban Water J. 2014, 11, 2612–2673. [CrossRef] 5. Hochedlinger, M.; Kainz, H.; Rauch, W. Assessment of CSO loads–based on UV/VIS-spectroscopy by means of different regression methods. Water Sci. Technol. 2006, 54, 239–246. [CrossRef][PubMed] 6. Gruber, G.; Winkler, S.; Pressl, A. Quantification of pollution loads from CSOs into surface water bodies by means of online techniques. Water Sci. Technol. 2004, 50, 73–80. [CrossRef][PubMed] 7. Gruber, G.; Bertrand-Krajewski, J.L.; Beneditis, J.D.; Hochedlinger, M.; Lettl, W. Practical aspects, experiences and strategies by using UV/VIS sensors for long-term sewer monitoring. Water Pract. Technol. 2006, 1, 1. [CrossRef] 8. Yuan, D.H.; He, J.W.; Li, C.W.; Guo, X.J.; Xiong, Y.; Yan, C.L. Insights into the pollutant-removal performance and DOM characteristics of stormwater runoff during grassy-swales treatment. Environ. Technol. 2019, 40, 441–450. [CrossRef] 9. Weishaar, J.L.; Aiken, G.R.; Bergamaschi, B.A.; Fram, M.S.; Fujii, R.; Mopper, K. Evaluation of specific ultraviolet absorbance as an indicator of the chemical composition and reactivity of dissolved organic carbon. Environ. Sci. Technol. 2003, 37, 4702–4708. [CrossRef] 10. He, X.; Xi, B.; Wei, Z.; Guo, X.; Li, M.; An, D.; Liu, H. Spectroscopic characterization of water extractable organic matter during composting of municipal solid waste. Chemosphere 2011, 82, 541–548. [CrossRef] 11. Helms, J.R.; Stubbins, A.; Ritchie, J.D.; Minor, E.C.; Kieber, D.J.; Mopper, K. Absorption spectral slopes and slope ratios as indicators of molecular weight, source, and photobleaching of chromophoric dissolved organic matter. Limnol. Oceanogr. 2008, 53, 559–569. [CrossRef] 12. Irvine, K.; Rossi, M.C.; Vermette, S.; Bakert, J.; Kleinfelder, K. Illicit discharge detection and elimination: Low cost options for source identification and trackdown in stormwater systems. Urban Water J. 2011, 8, 379–395. [CrossRef] 13. Panasiuk, O.; Hedström, A.; Marsalek, J.; Ashley, R.M.; Viklander, M. Contamination of stormwater by wastewater: A review of detection methods. J. Environ. Manag. 2015, 152, 241–250. [CrossRef][PubMed] 14. Jones, K.P.New lamps for old—Recent progress in UV sources for absorption detectors in liquid. TRAC: Trends Anal. Chem. 2016, 9, 195. [CrossRef] 15. O’Toole, M.; Diamond, D. Absorbance based light emitting diode optical sensors and sensing devices. Sensors 2008, 8, 2453–2479. [CrossRef][PubMed] 16. Visconti, P.; Primiceri, P.; de Fazio, R.; Ekuakille, A.L. A solar-powered white led-based uv-vis spectrophotometric system managed by pc for air pollution detection in faraway and unfriendly locations. Int. J. Smart Sens. Intell. Syst. 2017, 10, 1. [CrossRef] 17. Piasecki, T.; Breadmore, M.C.; Macka, M. White LEDs as broad spectrum light sources for spectrophotometry: Demonstration in the visible spectrum range in a diode-array spectrophotometric detector. Electrophoresis 2010, 31, 3737–3744. [CrossRef][PubMed] 18. Kim, J.S.; Kim, A.H.; Oh, H.B.; Goh, B.J.; Lee, E.S.; Kim, J.S.; Jun, J.H. Simple LED spectrophotometer for analysis of color information. Bio-Med. Mater. Eng. 2015, 26, S1773–S1780. [CrossRef] 19. Gómez-Polo, C.; Gómez-Polo, M.; Celemin-Vinuela, A.; De Parga, J.A.M.V. Differences between the human eye and the spectrophotometer in the shade matching of tooth colour. J. Dent. 2014, 42, 742–745. [CrossRef] 20. Francis, F.J. Color measurement and interpretation. In Instrumental Methods for Quality Assurance in Foods; Routledge: Abingdon, UK, 2017; pp. 199–220. 21. Djouadi, A.; Kneur, J.L.; Moultaka, G. SuSpect: A FORTRAN code for the supersymmetric and Higgs particle spectrum in the MSSM. Comput. Phys. Commun. 2007, 176, 426–455. [CrossRef] Sensors 2019, 19, 2951 23 of 23

22. Spectra FORTRAN Code. Available online: http://www.physics.sfasu.edu/astro/color/spectra.html (accessed on 24 May 2019). 23. Stephenson, D. A portable diode array spectrophotometer. Appl. Spectrosc. 2016, 70, 874–878. [CrossRef] 24. Jansen-van Vuuren, R.D.; Armin, A.; Pandey, A.K.; Burn, P.L.; Meredith, P. Organic photodiodes: The future of full color detection and image sensing. Adv. Mater. 2016, 28, 4766–4802. [CrossRef][PubMed] 25. Nie, X.; Ryckeboer, E.; Roelkens, G.; Baets, R. CMOS-compatible broadband co-propagative stationary Fourier transform spectrometer integrated on a silicon nitride photonics platform. Opt. Express 2017, 25, A409–A418. [CrossRef][PubMed] 26. Cekon,ˇ M.; Slávik, R.; Juras, P. Obtainable method of measuring the solar radiant flux based on silicone photodiode element. Appl. Mech. Mater. 2016, 824, 477–484. [CrossRef] 27. Photodiode S12230–1, Sensitive to the Visible and Infrared Spectrum. Available online: http://cort.as/-Hgkl (accessed on 24 May 2019). 28. Photodiode OSD15-E, Sensitive to the Visible Spectrum. Available online: http://cort.as/-Hgkq (accessed on 24 May 2019). 29. Chun, H.; Rajbhandari, S.; Faulkner, G.; Tsonev, D.; Xie, E.; McKendry, J.J.D.; Haas, H. LED based wavelength division multiplexed 10 Gb/s visible light communications. J. Lightwave Technol. 2016, 34, 3047–3052. [CrossRef] 30. LED VAOL-5EUV8T4 385 nm Wavelength Peak. Available online: http://cort.as/-Hbwt (accessed on 24 May 2019). 31. Spectrophotometer V-5000 VIS. Available online: http://cort.as/-HglF (accessed on 24 May 2019). 32. Min, Y.K.; Clauberg, B.; Hontelé, B.J. LED Driver Circuit with PWM Output. U.S. Patent 6,586,890, 5 June 2003. 33. Hu, Y.; Jovanovic, M.M. LED driver with self-adaptive drive voltage. IEEE Trans. Power Electron. 2008, 23, 3116–3125. [CrossRef] 34. Dasgupta, P.K.; Eom, I.Y.; Morris, K.J.; Li, J. Light emitting diode-based detectors: Absorbance, fluorescence and spectroelectrochemical measurements in a planar flow-through cell. Anal. Chim. Acta 2003, 500, 337–364. [CrossRef] 35. Li, L.; Wang, Z.; Pei, F.; Wang, X. Improved illumination for vision-based defect inspection of highly reflective metal surface. Chin. Opt. Lett. 2013, 11, 021102. 36. LED C503B-BCN-CW0Y04520–30. 470 nm Wavelength Peak. Available online: http://cort.as/-Hbju (accessed on 24 May 2019). 37. Komiyama, R.; Kageyama, T.; Miura, M.; Miyashita, H.; Lee, S.S. Turbidity Monitoring of Lake Water by Transmittance Measuresment with a Simple Optical Setup. In Proceedings of the 2015 IEEE SENSORS, Busan, Korea, 1–4 November 2015. 38. LED SSL-LX5093UEGC. 500 nm Wavelength Peak. Available online: http://cort.as/-HdZE (accessed on 24 May 2019). 39. Lüders, K.; Pohl, R.O. Diffraction. In Pohl’s Introduction to Physics; Springer: Cham, Switzerland, 2018; pp. 413–442. 40. Stone, M. A Field Guide to Digital Color; AK Peters/CRC Press: New York, NY, USA, 2016. 41. Aydın, C.; Mansour, S.A.; Alahmed, Z.A.; Yakuphanoglu, F. Structural and optical characterization of sol–gel derived boron doped Fe 2 O 3 nanostructured films. J Sol-Gel Sci. Technol. 2012, 62, 397–403. [CrossRef] 42. Coutsias, E.A.; Seok, C.; Dill, K.A. Using quaternions to calculate RMSD. J. Comput. Chem. 2004, 25, 1849–1857. [CrossRef]

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).