A turbidity sensor development based on NL-PI observers: Experimental application to the control of a Sinaloa’s River Spirulina maxima cultivation

Abstract This article addresses the problem of controlling the growth of microalgae originating in Mexican rivers, especially in the state of Sinaloa, Culiacan River. For this purpose, a robust, high-gain nonlinear observer is proposed to estimate the unknown disturbance in the cultivation of mixotrophic microalgae with the presence of organic nutrients. Once a perturbation function related to the change of ambient light is estimated, an output feedback control for the photobioreactor is proposed, in which through Lyapunov’s convergence functions, the final boundary stability conditions are obtained. Thus, a turbidity sensor was designed for Spirulina platensis, a native microalgae of Culiacan River, which is presented using the MATLAB-Arduino programming environment. This sensor is calibrated using biomass culture and is a low-cost device. Through the numerical study, the feasibility and performance of the control and the observer are evaluated. Finally, real-time experimental evaluations are made based on the literature, studying the use of robust controllers in a photobioreactor with a mixed culture, in the presence of environmental changes in lighting.


Introduction
Currently, microalgae are used as a source of food for humans and animals and as supplies for the pharmaceutical, aquaculture, and other industries. Spirulina platensis is a microalgae that can produce vast amounts of high pharmaceutical value products such as phycocyanin [1]. Microalgae has been recently found to be able to manage organic carbon nutrients (i.e., glucose and acetate) for the mixotrophic growth and production, where it has shown that this type of multimetabolically sourced culture significantly increases biomass production [2]. However, the excess of microalgae growth becomes a problem in rivers, lakes, and basins in general because such excess is an indirect measure of the level of pollution and eutrophication [3]. Cyanobacteria S. platensis is distributed in the rivers of Mexico [4]. For instance, Sinaloa (Mexico state) is an entity with high aquaculture production, in which microalgae is used as the food of high nutritional value for fish species. The latter suggests that the excess of S. platensis can be used beneficially in addition to helping to reduce the source of contamination by microalgae known as eutrophication [5][6][7][8][9]. As regards water quality, algal biomass amount with the turbidity parameter could be estimated, with sufficient exactitude [10]. The construction of biomass sensors to optimize their control in the environment helps to mitigate the pollution problem by eutrophication, and the automation of such cultures can achieve the best possible yield in the production of algae biomass [11][12][13][14][15][16][17][18]. The use of complex algorithms called Observers, typical of the automatic control and systems theory, can help to improve the biomass estimation and other water quality parameter variables [19].
There is limited work on the proposed design of lowcost algal biomass sensors; a notable instance is ref. [10], in which a relatively simple, low-cost, and optimal sensing technique is introduced. The proposed design consists of a noninvasive sensor through which the mixture is pumped from the reactor toward the dispositive; the problem of biomass setting on the walls of glass tubes has been solved through the vertical design and the significantly increasing flow dilution rate.
In this article, we propose a sensor with similar characteristics to that given in ref. [10], with lower costs and design improvements. The main one consists in the embedding of robust high-gain non-linear observers (NL-PI observer, HG-robust observer), to estimate variables such as nutrients, uncertainties or unexpected signals, by improving aim and monitoring water quality in the environment for microalgae presence, and the HG-robust observer was implemented via Arduino-MATLAB-Simulink friendly interface environment. Also, we propose an HG-robust observer to estimate unknown disturbances; this estimation in nonlinear PI control plus compensation (robust PI control) is used to ensure a predefined optimal trajectory. This system is evaluated employing simulations with a nonlinear model and experimental results about S. platensis mixotrophic culture as a function of light intensity and glucose concentration [2,20,21].
Some definitions and key findings from other studies are introduced in Section 2. Section 3 briefly explains the mathematical model of microalgae growth and introduces the approach to the problem. Then, in Section 4, the main result is presented, showing the design of the robust high-gain observer, as well as some extensions to control for the nonlinear system that represents the photobioreactor of our interest. In Section 5, numerical simulations are presented, as well as the experimental results for real-time implementation and the design of a turbidity sensor to measure biomass. Finally, Section 6 presents the conclusions of this study.

Overview
An observer is defined as a dynamic system that has the task of online state estimation, which cannot be measured, either because the measurements are of high cost or because there is no measurement technology [22,23]. An outstanding type of observer is the socalled high-gain observers (HG observers); its structure does not depend primarily on the input, which is widely used to estimate states and uncertainties in nonparameterized nonlinear systems [24]. These observers have shown excellent performance in nonlinear systems with parameters and disturbances with uncertainty, particularly in biological and environmental processes [25,26]. Some interesting works have been studied and published in ref. [27], which presents a type of adaptive observer. This adaptive observer has been used for robust estimation in a particular type of nonlinear systems. Certain types of fixed adaptive observers such as those described in refs. [28,29] perform state estimation and parameters that do not have a linear structure, maintaining conditions such as persistent excitation [30,31]. This condition is not always possible to achieve, especially in systems that model bioprocesses, in which persistent excitation can negatively affect the culture of living organisms. Another type of observer is the integral proportional (IP) observers investigated in refs. [8,32]. IP observers have diverse applications since they are considerably more robust to system input disturbances, compared to the previously cited observers [33]. Other observers such as linear observers with variable parameters (LPV) show excellent results in feedback and output injections in complex systems [34]. HG observers, such as the ones applied in this work, can implicitly include integral action, increasing their degrees of freedom. In previous studies [33,[35][36][37], it has been demonstrated that this type of extensions to high-gain observers show excellent performance, even when the system has disturbances in the system output measurements. In other instances, a control technique successfully used in photobioreactors is the so-called predictive model [38,39]. Although this technique is more stable to changes in state variables and uncertainties in the model, it has difficulties with distortions not contemplated in the model. Although the substrates and biomass estimation in photobioreactors are significant for their optimal operation, few studies consider an online state estimation in photobioreactors; an example of these is presented in ref. [40]. However, few inline and high-cost sensors provide a reading of this information [10,41].
Also, it is known that photobioreactors have very complex dynamics due to the interaction between control loops and the effect of light intensity. Therefore, it is a challenge to control this type of process in real time.

Background of observers applied to environmental problems
Dynamic systems that represent bioprocesses are highly sensitive in their parameters, due there are complex structure and metabolic pathways in the growth dynamics of microorganisms. This sensitivity can sometimes be modeled as unknown terms in the model. Therefore, it is essential to observe these unknown terms through estimation techniques such as state observers.
In this study, we present a type of high-gain observer to estimate and later compensate for these changes or distortions in the systems. The essential elements for a general understanding of these observers are presented subsequently. Consider a finite-dimension nonlinear system described by where ∈ x n is the state vector, ∈ u m is the control input, and ( ) ∈ y t p is the output; ( ) f x , ( ) g x , and ( ) h x are known functions of appropriate dimensions that meet the Lipschitz condition, guaranteeing uniqueness and existence in the solution of (1). Also, we assume that there is a subspace ∈ Ω n . Conversely, for related systems, the right side of (1) has the structure ( Then, it is known that a system is observable in an observation space if, from the knowledge of the output trajectories in a defined time interval, it is possible to determine a unique state trajectory that generates an output [41]. This observation space is defined as follows. ≔ ( ) f f x u , for any constant ∈ u m (this means that for any Hereafter, (1) could be considered as a system of one input and one output (SISO) since our photobioreactor model accomplishes this condition. Then, let us look at the definition of uniform observability required for our analysis.
where L denotes the Lie derivative operator. It follows that in Ω, in the global coordinate system defined by Ψ, an original system called (1) can be rewritten as follows: where ( ) ϕ x can extend from Ω to all n for a ∞ C function globally Lipschitz in n with respect to any norm.
Considering the system of interest (1) is uniformly observable, in this article, it is proposed to work with the following nonlinear system structure disturbed by the input and could be representing a bioprocess: where the disturbance is a bounded function, as well as being Lipschitz in the same sense as described in refs. [41][42][43]. This function ( ) δ t can represent unmodeled system phenomena, an external signal, or even a poor control action. By applying the diffeomorphism (2) on (4), it is possible to obtain a transformed nonlinear system. In such a system, the linear and nonlinear components are separated. To this system, once applied the diffeomorphism (2), a high-gain classical observer is constructed, followed by applying the inverse diffeomorphism of (2) to this observer. In this way, an observer is obtained in original coordinates in the same direction as mentioned in ref. [25]. The observer in original coordinates of the bioprocess allows state estimation asymptotically, as in the transformed case, and for more details, refer to a test presented in ref. [44]. This highgain observer has the following form: 1 with A 0 as the unit triangle matrix due to the (2) transformation. In particular, as we saw earlier, the original system (1) can be rewritten as Eq. (3). From that expression, it can be easily seen that the A 0 array is given by forms an observable pair.

Problem statement
A photobioreactor is a device that carries out the growth of microalgae dependent on variables such as light intensity, pH, and dissolved oxygen, as in rivers or lakes; however, in photobioreactors, it is done in a controlled way, whose primary objective is the guided removal of nutrients [45]. In this sense, the treatment of wastewater employing bioreactors is a potentially useful alternative for the control of water quality parameters since these bioreactors are a subsystem of water sources [46]. For this reason, microalgae are usually produced in photobioreactors in a controlled manner as a way of controlling the contamination of water sources [47,48]. In some types of microalgae, the property of multiform metabolism to be able to obtain energy for the growth of biomass is presented: autotroph and heterotroph; Spirulina maxima is one of these types of organisms. When both are present in a culture, it is well known that we have a mixotroph culture [21], where there is a growth-dependent on photosynthesis (CO 2 + light) and another one on the oxidation of organic matter (glucose, acetate, etc.) [20]. The combination of light conditions and organic nutrients augments the complexity in the culture, denoting a difficult parametric sensitivity [2]. Hence, guaranteeing an excellent performance of a continuous culture is a challenge for the applied control theory, which is explained in more detail in the following, along with the mathematical model described in this article.

Mathematical model
Generally, among the mathematical models that describe the dynamics of a photobioreactor, they are too complex. Therefore, it is difficult to handle it from an analytical point of view of the control theory [49]. Many authors have found that the simple Monod model can represent a very good part of the photobioreactor dynamics with a good approximation, and feed back control can suppress the unmodeled dynamics and help to obtain a stable and robust closed-loop model [50].
The proposed mathematical model is based on the Monod model (as in ref. [51]), which is considered to be a model with a single limiting substrate and where the photobioreactor is thoroughly agitated and in a continuous phase. Therefore, the model includes two mass balances: biomass and nutrients, where the Monod kinetics defines the specific growth rate of the biomass. When a function or a parameter is predefined or calculated offline, it is referred to as nominal in this article.
The model is described by the following equation: where μ is the specific growth rate. Besides, x 1 represents the concentration of algal biomass in g/L; x 2 represents the concentration of nutrients in mg/L; μ is the nominal specific growth rate or speed of microalgae in − h 1 ; â 1 is the maximum specific nominal growth rate in − h 1 ; a 2 is the Monod saturation constant in mg/L; â 3 is the nominal yield coefficient; a 4 is the concentration of substrate in the feeding stage (mg/L); and = y x 1 is the output signal as a result of biomass sensing. To optimize the production of biomass in the literature [51], it has been possible to calculate to optimal dilution rate ( ) = D t D opt as follows: where D represents the optimal dilution nominal rate in − h 1 . It should be noted that D is defined as the quotient between the input flow and the photobioreactor volume.
The effect of the light intensity is extremely complex [49]. It is considered that the light intensity remains constant and controlled, but in case of uncertainty, it is a source of parameter sensitivity, and this is dealt in the following manner.

Parametric variations in photobioreactors
The light intensity effect on the system is known to be complicated, as mentioned in the previous article [49], where it is stated that a change in the Monod parameters reflects this effect. Variations in light intensity in continuous mixotrophic cultures affect the sensitivity of a 1 and a 3 parameters, as shown by remarkable research [2,20]. Thus, in this study, = − a a ã1 1 1 is defined as the error between the offline estimated Monod growth model parameter (nominal) â 1 and the actual real variant parameter a 1 . Therefore, if we substitute = − a a â1 1 1 in Eq. (9), we have x a x â˜, where μ is the actual and real variant-specific growth rate. As the biomass can be measured (sensor proposed in this paper), since = y x 1 biomass is the output signal. Thus, if we derive y concerning time, we see that the controller appears in the first derivative:

Assumption 1
There is a maximum bounded for the ( ) δ t function, such that the following is fulfilled: Eq. (12) demonstrates that it is possible to compensate the ( ) δ t effect on Eq. (11) via the input rate dilution D. It is also shown that the model representing the photobioreactors is bilinear, and this is a reason that allows estimate and compensates internal disturbances or uncertainties ( ) δ t , via new control signal (variant-time dilution rate) ( ) = D t u robust for the design of a robust nonlinear controller.

Main results
This section proposes a solution to the problem formulated earlier, which is about finding a controller for the uniformly observable photobioreactor presented in Eq. (8). Thus, we designed a nonlinear controller based on active disturbance rejection using a robust HG-observer [36]. In the case studied in this article, we propose to estimate the nonmeasurable states (nutrients x 2 ) and the parametric disturbances due to changes in the environmental conditions designed (light intensity). The effect of perturbations ( ) δ t in the original system is compensated by calculating a nonlinear control law ( ) u robust based on the inverse feedback of the perturbation. Therefore, it is based on a tracking control scheme, i.e., plant with ( ) δ t disturbance tracks a nominal dynamics plant (without disturbances), and this is discussed later.

Robust high-gain observer design
High-gain observers implemented in photobioreactors show a performance loss; this is due to the presence of complex structures and metabolic pathways in dynamics growth of microorganisms. To solve this, we propose a state observer robust to input disturbances, which is shown in Figure 1 and is as follows [36]: where ∈ x n is the vector of estimated states; = C [ ⋅⋅⋅ ] ∈ × 10 0 n 1 ; S θ is the solution of (6); and where the values of α i depend on the nature of the system output and ( ) δ t is the disturbance estimate; and the observer's error is defined as = − e x x 1 1 ; and ∈ + k i . Eq. (13) is an asymptotically stable observer in the presence of perturbations in their original coordinates for high gains of > θ 1 and > k 0 i , as studied in the stability test in the Lyapunovian sense in ref. [36]. It is known from the previous study [25] that there is a diffeomorphic mapping Figure 1: Diagram of the controller with the observer (13). Usually, dynamic systems that model photobioreactors are disturbed by an unknown signal, ( ) δ t . Via nonlinear control (18), the aim must be reached that = = Y x x 1 1 , r capable of bringing system to (1) a triangular shape as long as (1) will be uniformly observable. Then, since it is known that (1) is uniformly observable, the operator ( ) e Ψ is bijective and there is its inverse operator, which is used in (13). Therefore, the term ( ) − e Ψ 1 reflects the error in inverse diffeomorphic coordinates of (2).
The following diffeomorphic transformation (2) is proposed for system (8): Subsequently, a positive defined matrix structure S θ is chosen as from (13): Based on previous research (see refs. [25,36]), we applied the inverse diffeomorphism of (14) and obtained a highgain observer in photobioreactor original coordinates. For this, we use the single-substrate continuous phase Monod model as follows: and D opt dilution rate of (10). Then, applying the robust high-gain observer structure proposed in (13) for the photobioreactor (8) where = − e Cx ŷ . The robust HG-observer (17) is proposed as improvement of the classical high-gain observer, since it is injected with a residue estimator ( ) δ t ; in this sense, the robustness estimation is given as the approach discussed in item.

Design to a robust nonlinear control
The nonlinear system control represents a challenge because it is not always possible to minimize the effect of unknown disturbances affecting the system. Hence, the majority of nonlinear control systems require that the disturbances fulfilled the coupling condition. We design a nonlinear output feedback tracking control ( ) u robust based on the compensation or residuals obtained via a robust HG observer, such that a controller does not depend on the full knowledge of the x 1 and x 2 states. In the particular case, bioreactor is a bilinear (8) system where disturbances originating from ( ) μ t via the input channel (dilution rate) can be compensated, and it is shown that where the term ( ) δ t offsets the unknown ( ) δ t disturbances estimated by the high-gain robust observer (17). Thus, u robust is expressed as follows:  Theorem 4.1. Let system (8) be a disturbed photobioreactor with limited ( ) δ t , let (17) be a stable robust HG observer and fulfilled to Assumption 2. It is said that the tracking error between the optimal desired dynamics = − e x x 0 1 , r 1 is ultimately bounded via an output feedback control (19).
Proof. Let the next dynamic be the optimal reference model: ȧˆˆ.  (22) Since it is known by [36], ( ) ≈ δ t δ is asymptotically close, and therefore, for Assumption 2: = ( ) + ( ) δ δ t β t : Controller stability is not affected by the presence of the delta disturbance estimate, but the asymptotic stability is lost, and the practical stability is achieved.

Note 1
From the aforementioned Ball condition, it is possible to calculate the Lipschitz constant l 1 (Assumption 2) for ( ) β t for

Experiments
In this section, the simulations and experiment results are presented. For the former, MATLAB R2019a Simulink software was employed, and for the latter, the MATLAB-Arduino was implemented as the interface for the required control implementation (19) in a photobioreactor represented by (8), together with the use of a biomass turbidity-based sensor ( = ) y x 1 designed and built in laboratory.
Both experiments (numerical and real-time results) [2,20,21] are inspired in mixotrophic metabolism, where light intensity plays a crucial role in S. platensis culture.
Both studies proposed 18 days of continuous mixotrophic microalgae culture in 3 L square photobioreactors. It should be noted that the aforementioned experimental conditions are very similar to those reported in ref. [2]. The photobioreactor model plant parameters (8) for observer design (17) and robust nonlinear control (19) for S. platensis cultivation in the glucose presence are based on the literature ( Table 1).
Based on the parametric sensitivity to changes in light parameters, intensity a 1 and a 3 , we predicted that luminous intensity changes two times in a short time, thus simulating errors or failures with that variable and therefore simulating changes in nominal conditions and variations in nominal parameters. Besides, the optimal dilution calculation rate (10) depends on the nominal value of â 1 , and if this is applied to a disturbed system (8), dynamics would be far from the desired optimal nominal, and this problem is solved with the implementations of a robust controller (19).

Numerical results
On the MATLAB-Simulink platform with a variable step Dorman-Prince ODE-45 and using the parameters presented in Table 2, numerical simulation on model (8) is [20] a 4 Our proposal D opt [53] ( ) x 0 1 [2] ( )  Table 3. Figure 2 shows disturbance dynamics parameters concerning changes in ambient light conditions; also, the respective parameter changes can be obtained in refs. [2,21]

Validation experiments
This section presents the results of experiments carried out in a plant for the growth of microalgae. The experiments consist of estimating the substrate of the plant through the robust high-gain observer presented earlier (19).
Biomass of S. maxima was extracted and isolated on the banks of the Culiacan River in the lower zone. Then, a laboratory experiment was designed with conditions similar to those presented in the literature [2]; the culture medium was the Zarrouk medium enriched with an initial glucose concentration of 1.5 g/L. The illumination was provided by LED lamps (white light) that controlled to allow a luminous intensity of 0-200 µmol m −2 s −1 photons. The culture was inoculated with an initial biomass concentration of 0.15 g/L. The photobioreactor culture was maintained at a room temperature of 25°C; the pH was regulated to 10.3, with continuous aeration (0.5 vvm sterile air). We designed an optical sensor in which we measured the biomass. This sensor is based on visible spectrophotometry as in previous study [10]. Subsequently, using the controller (19), the glucose nonmeasurable signal is estimated in the base to the observer (17). The biomass determination and net nutrients are performed based on standardized experimental methods, such as the 3.5 dinitro salicylic acid method of reducing sugars, to determine nutrients. (6-18 days). Via MATLAB-Simulink-Arduino platform, in conjunction with the use of the biomass sensor, it is possible to obtain the estimated biomass and nutrient data via the control and the observer. Besides, it is possible to send the first-order filtered control signal u robust to the peristaltic pumps to feed 0.8 g/L glucose (a 4 ) dissolved in the Zarrouk solution for S. platensis continuous cultivation.

Design of a biomass turbidity sensor
The wavelength at which the highest adsorption by biomass pigments occurs is λ = 560 nm [52]. Therefore, the designed optical sensor is noninvasive (isolated camera) and able to measure the microalgae biomass flowing inside a borosilicate tube.
The camera is isolated from the outside light to avoid the production of any parametric disturbance. The optical sensor built was calibrated with the experimental data based on the visible spectrophotometry and the dry weight algal biomass analysis; therefore, a voltage-biomass ratio is obtained, and this employs a TEMT6000 sensor and the emitting led in the visible spectrum. Also,   (19) and (17) Parameter unit Nominal value the implemented interface employs an Arduino One-MATLAB communication. With three isolated cameras, the turbidity at a visible light spectrum (560 nm) of the average fluid biomass from the photobioreactor is estimated, and this happens through a peristaltic pump controlled by a servo motor. The specific turbidity (560 nm) is closely related to the concentration of algal biomass, given the high adsorption at this spectrum length (Figure 3).
Since being able to distinguish between living and dead cells is a very difficult task nowadays, fluorescence techniques are currently being used, but these are still far from being able to be used online [53]. A possible limitation of our type of sensor is the absence of difference between dead and living cells, but can be used for online task, and hence, this sensor should be used in microalgae in an exponential growth phase and continuous photobioreactors to guarantee that the concentration of living cells is much higher than the concentration of dead cells. An outline of the prototype is shown in Figure 4.
Another possible problem is the fixing of biomass on the borosilicate glass walls; this problem has already been solved, as shown in the literature [10], and a vertical design and a flow rate > / v 1 L h solve part of the problem. Besides, an automatic maintenance system of  (b) control signal obtained through (19) to minimize the effect of parameter change a 1 and a 3 ; (c) dynamics of the plant biomass with (19), in the absence of the controller and the optimal reference; and (d) estimated nutrient dynamics using observer (16).
sensors connected in parallel could be designed to be able to give service to this monitoring system.
In addition, for future research, we could consider the use of tubes with oleophobic surfaces since it is known that microalgae have a large amount of fatty acids, which could prevent the agglomeration of biomass cells [54,55].

.1 Numerical results
The robust and observer controller has excellent performance and robust performance in rejecting disturbances from a dynamic system. As shown in Figure 2c and d, the system maintains the tracking dynamics in anticipation of parameter changes carried in the biomass sensor.
As shown in Figure 2b, the robust controller has a good performance and fulfills a smooth dynamic. The control signal that achieves this is reflected in the figure

Real-time experiment
The results obtained in biomass measurement and substrate estimation are compared with experimental data; this is shown in Figures 5 and 6. In particular, in     Table 2; besides, Figure 5 shows that the observer converges in the area marked by this linear trend. It is possible to see the analog estimates and signals with a trend toward offline laboratory test results. As the aforementioned results show, it was possible to estimate the algal biomass and nutrients using the turbidity-based sensor and the robust high-gain observer. It is easy to see that the observer follows the trend concerning the experimental tests.

Conclusions
In this study, we investigated the design of high-gain, robust observers for systems that model bioprocesses and water quality variables, in particular. At the same time, a controller capable of compensating perturbations due to parametric variations in a mixotrophic photobioreactor that complies with uniform observability was presented. The effectiveness of this controller was verified employing numerical simulations, as well as experimental tests of a photobioreactor. For the latter, a MATLAB-Arduino system for biomass sensing through real-time turbidity and the use of high-gain observers was designed and built to estimate complex variables. The use of the techniques presented here could be extended to other types of systems that comply with the analytical and practical restrictions outlined in this study. The use of the observer and the sensor could also be extended to the estimation of algal biomass from open basins.