# A Simple Temperature Compensation Method for Turbidity Sensor

Haijiang Tai, Daoliang Li, Yaoguang Wei, Daokun Ma, Qisheng Ding

► To cite this version:

Haijiang Tai, Daoliang Li, Yaoguang Wei, Daokun Ma, Qisheng Ding. A Simple Temperature Compensation Method for Turbidity Sensor. 4th Conference on Computer and Computing Technologies in Agriculture (CCTA), Oct 2010, Nanchang, China. pp.650-658, 10.1007/978-3-642-18369-0_78 . hal-01564895

HAL Id: hal-01564895

https://inria.hal.science/hal-01564895

Submitted on 19 Jul 2017

**HAL** is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# A Simple Temperature Compensation Method for Turbidity Sensor

Haijiang Tai¹, Daoliang Li¹,*, Yaoguang Wei¹, Daokun Ma¹, Qisheng Ding¹,²

¹College of Information and Electrical Engineering, China Agricultural University, Beijing
100083, P. R. China

²Xuzhou Normal University, Xuzhou, Jiangsu, P. R. China

**Abstract.** Turbidity sensor for water treatment applications are based on scattered light measurement. The electrooptical characteristic of light emitter and detector has a close relationship with the environmental temperature. Fluctuations in water temperature can potentially affect electronic components and cause output signal errors in turbidity sensor. Decrease or eliminate temperature error is necessary. With this background we have taken the temperature experiment of turbidity sensor developed by us. 11 different concentrations were measured, ranging from 0 to 100NTU. Each solution was cooled to 1°C, and then gradually heated to 40℃. The output signal of sensor increased according to the rise of temperature found from the experiment. In order to compensate the temperature errors, we developed a novel method to take temperature compensation by using software. The method carried by MCU which is used to compensate the measurement errors by soft programming is simple and effective; it can improve the error compensation precision on sensors greatly.

**Key words:** Turbidity Sensor; Temperature compensation; software compensation

## 1. Introduction

Along with the development of society, the effect of water is strengthening in people's live and industrial production day after day. Turbidity is regarded as a key technical parameter in the water quality measurement. As an instrument measuring turbidity, turbidity sensor is widely used in water analysis and treatment processes (e.g., Gong Dian-ting et al., 2008; Brasington, J. et al., 2000; Gippel, C.J., 1995; Jack Lewis, 1996). Turbidity sensor for water treatment applications are based on scattered light measurement. When a light beam from the light emitter (for example, light emitting diodes(LED)) passed through a water sample, particles in the light path change the direction of the light and scatter it, scattered light received by the detector (for example, photodiode, phototriode and photoresistance ). But the electrooptical characteristic of light emitter and detector has a close relationship with the

<footnote>* Corresponding author, Email: dliangl@cau.edu.cn</footnote>
temperature. Fluctuations in water temperature can potentially affect electronic components and cause output signal errors in turbidity sensor (Lawler and Brown, 1992).

In the practical work, due to the sensor's environment temperature changed greatly, more heat output caused by variation in temperature can bring about a big measurement error, static characteristic of the sensor will also be influenced. Consequently, temperature compensation must be adopted. Temperature compensation technologies include (1) parallel temperature compensation; (2) zero point temperature compensation; (3) temperature compensation based on software (Du Yong-ping and He Xiao-ying, 2009; J.A. Siqueira Dias et al., 2008). In theory it can be compensated completely by using parallel temperature compensation, but in practical it is only proximate compensation; zero point temperature compensation have high accuracy, but it is difficult to find the material; it is a simple, effective method to take temperature compensation by using software, and an approach to increase the accuracy of sensor measurement (Xu Jun, 2002; Matej Možek et al., 2008). As long as the mathematical model of measuring temperature error is established accurately, temperature compensation of sensor can realize well.

In this work, the ambient-temperature influence on a turbidity sensor, which was maintained with a constant temperature difference from that of the solution, was analyzed and a simple temperature compensation method proposed.

## 2. Temperature effect mechanism

The sensor is consist of many parts, electronic components (such as resistor, capacitor) of signal conditioning circuit are not effected by temperature change. But the electrooptical characteristic of light emitter and detector has a close relationship with the temperature.

### 2.1 Temperature influence on LED

LED will suffer high power dissipation and self-heating at work, and its luminous intensity has a close relationship with the environmental temperature. Along with the increase in environmental temperature, there is a decrease in radiation intensity of LED, and the peak wavelength shifts to longer wavelength (B.P.J. de Lacy Costello et al., 2008). Radiation intensity was proportional to the logarithm of environmental temperature. Compared with the environmental temperature at 25 °C, When the environmental temperature at 40℃, relative light output will decreased to 70%~80%, the accuracy of turbidity sensor will be influenced directly (Sheng Qiang and He Xiao-gang, 2007).

Under the constant input current, output optical power of LED decreased according to the rise of temperature, as Fig. 1 shows. Fig. 2 shows the peak wavelength shifts and relative light output of each color LED according to the rise of temperature shown in Fig. 3.
<figure><img src="image_2.png" /><figcaption>Fig. 1. Temperature characteristic of LED (T2>T1)</figcaption></figure>

<figure><img src="image_3.png" /><figcaption>Fig. 2. Peak wavelength under different temperature</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>Fig. 3. Relative light output of LED according to temperature change</figcaption></figure>
## 2.2 Temperature influence on silicon photoelectric generator

Take the silicon photoelectric generator as detector. Along with the increase in environmental temperature, there is a rapid decrease in open-circuit voltage, and an increase in short-circuit current. Moreover, open-circuit voltage and short-circuit current both have a linear relation with temperature(Zhang Wei, et al., 2009). Fig.4 shows the temperature characteristic of silicon photoelectric generator.

<figure><img src="image_5.png" /><figcaption>Fig. 4. Temperature characteristic of silicon photoelectric generator</figcaption></figure>

# 3. Materials and methods

## 3.1 Chemical and equipment

All solutions were prepared with filtered water and analytical grade chemicals. A 400NTU Formazin stock suspension was prepared by mixing equal volumes of 100mg/mL hexamethylenetetramine; $(CH_2)_6N_4$ and 10mg/mL hydrazine sulfate solution $N_2H_4H_2SO_4$, after that, the mixture was let to stand for 24 h at 25±2°C in a topaz bottle before the measurements. Filtered water was used as a carrier.

In this work, measuring cylinder and Bunsen beaker were used to dilute Formazin standard solutions, and prepared the water samples. A fridge to cool the water samples, and a constant water bath was used to change the temperature of water samples.

## 3.2 Turbidity sensor

The turbidity sensor used in this work was developed by us. The sensor mainly contained signal conditioning model, power source model, optical measurement system, constant-current source, temperature sensor, RS485 field bus, microprocessor and Transducers Electronic Data Sheets (TEDS), Hardware structure of the turbidimeter is shown in Fig. 5.
<figure><img src="image_6.png" /><figcaption>Fig. 5. Hardware structure of the turbidimeter</figcaption></figure>

The sensor is based on a high-power infrared light emitting diode (LED). The reason for select IR LED as following: (1) Turbidity measurement affected by organic substance in water samples, the light wavelength below 500nm can be absorbed seriously; (2) According to ISO 7027 using light with λ >800 nm can minimize interferences caused by the presence of dissolved light-absorbing substances (Dag Hongve and Gunvor Åkesson, 1998); (3) Water samples colour absorbs light of certain wavelength, and affect measurement precision, near infrared light can minimize interferences caused by water samples colour. Consequently, the LED used in this work is designed for maximum emittance at 940 nm.

The detector is a matching, high sensitivity Silicon Photoelectric Generator with peak sensitivity also at 940 nm. Both the emitter and detector provide a narrow and closely matched spectrum.

The electric circuit used to drive the sensor and to treat the signal is shown in Fig. 6. Conversion of the Silicon Photoelectric Generator current and amplification of the voltage is achieved by using one wide range of input offset, low offset voltage drift, high input impedance, extremely low power, and high gain quad operational amplifiers (TLC27L4). Power requirements for the sensor are +3.3V for the operational amplifiers.

<figure><img src="image_7.png" /><figcaption>Fig. 6. Electric circuit for the Turbidity sensor signal treatment.</figcaption></figure>
### 3.3 Methods

To measure the response of the sensor to different temperature, Turbidity standard solutions of Formazin were adjusted with filtered water into water samples of 0-100NTU. 11 different concentrations were measured, ranging from 0 to 100NTU. Take Bunsen beaker filled with Formazin standard solution and cooling to 1°C, then immerse the sensor in the solution. The Bunsen beaker and sensor were then placed in a water bath at room temperature. Solution in the Bunsen beaker was gradually heated to 40°C and the output recorded at 5s intervals.

## 4. Results and discussion

### 4.1 Calibration of sensor

Tab.1 shows the relationship between the turbidity of water samples prepared by diluting turbidity standard solutions of Formazin and the values measured by the sensor under environment temperature 20°C. As can be seen, the solutions measured gave nearly linear relations between the concentration of the standard solutions and the measured turbidity. Calibration equation of the sensor fitted according to the principle of least square is $y = 1.0003x - 0.0181$, and the correlation coefficient is $R^2 = 0.9993$.

<table><caption>Tab.1. Relationship of measured turbidity and concentration of turbidity standard</caption><thead><tr><th>Water samples /NTU</th><th>measured values /NTU</th><th>correlation coefficient R<sup>2</sup></th></tr></thead><tbody><tr><td>5</td><td>5.50</td><td rowspan="10">0.9993</td></tr><tr><td>10</td><td>10.55</td></tr><tr><td>20</td><td>19.42</td></tr><tr><td>30</td><td>29.39</td></tr><tr><td>40</td><td>39.37</td></tr><tr><td>50</td><td>49.35</td></tr><tr><td>60</td><td>59.88</td></tr><tr><td>70</td><td>71.52</td></tr><tr><td>80</td><td>80.38</td></tr><tr><td>90</td><td>90.92</td></tr><tr><td>100</td><td>98.68</td></tr></tbody></table>
## 4.2 Temperature effect

Fig. 7 shows the relationship between temperature and the output signal of sensor. As the figure shows, the experimental curves seem to be similar in shape to each other, but had larger values as solution concentrations increased. The output signal of sensor increased according to the rise of temperature found from the experiment. But the output signal of sensor decreased according to the rise of temperature found from the experiment at initial stage, this result probably arose from the temperature between the sensor and solution failed to come up to equilibrium, the temperature of sensor is higher then solution.

<figure><img src="image_8.png" /><figcaption>Fig. 7. Relationship of temperature and output signal of sensor</figcaption></figure>

## 5. Temperature compensation

As Fig. 7 shows, when the temperature was in the range of 1~40°C, the relationship between the output signal of sensor and temperature can be given by

$$y = mx^2 + nx + p \quad (1)$$

Where y, is the output signal of turbidimeter, x is temperature, m, n and p is coefficient. Consequently, a general curve can be obtained as Fig. 8 shows.
<figure><img src="image_9.png" /><figcaption>Fig. 8. General curve of the relationship between temperature and output signal of sensor</figcaption></figure>

Three points A(x₀, y₀), B(x₁, y₁) and C(x₂, y₂) on the curve in Fig.8 can be used to solve the quadratic equation (1). But it is difficult to solve the quadratic equation (1) directly. Another form of the quadratic equation (1) as follow can be used.

$$y = a(x - x_0)(x - x_1) + b(x - x_2) + c \quad (2)$$

Where a, b and c is coefficient.

Substitute the quantitative data of A(x₀, y₀), B(x₁, y₁) and C(x₂, y₂) into equation (2), the three coefficients can be obtained, and the results as follow:

$$a = \frac{\frac{y_2 - y_0}{x_2 - x_0} - \frac{y_1 - y_0}{x_1 - x_0}}{x_2 - x_1} = \frac{\frac{y_2 - y_0}{x_2 - x_0} - b}{x_2 - x_1}$$

$$b = \frac{y_1 - y_0}{x_1 - x_0}$$

$$c = y_0 + (x_2 - x_0) \frac{y_1 - y_0}{x_1 - x_0} = y_0 + (x_2 - x_0)b$$

When the temperature is 20°C, output signal of sensor is given by

$$y = a(20 - x_0)(20 - x_1) + b(20 - x_2) + c \quad (3)$$

Then substitute the equation (3) into calibration equation of the sensor which obtained at temperature of 20°C. Reference value of the solution can be acquired finally.

The above-mentioned method is designed to program, and be carried by MCU which is used to compensate the measurement errors by soft programming.
## 6. Conclusion

In the detection system, the high measurement accuracy is required, and decrease or eliminate temperature error is very important. By the experiment, the following results were obtained:

1. The output signal of sensor increased according to the rise of temperature found from the experiment, and a quadratic equation give the best fit.

2. The method carried by MCU which is used to compensate the measurement errors by soft programming is simple and effective; it can improve the error compensation precision on sensors greatly.

**Acknowledgements.** This work was supported by 863 programs “Research and Application of Digital Integrated System for Intensive Aquaculture” (2007AA10Z238), 948 Project of China Agriculture Ministry (2010-Z13). And the programs “Development and Applications of sensor network applied to monitor bloom of blue-green algae in Taihu Lake” (2010ZX03006-006)

## References

1. Gong Dian-ting, Li Feng-hua, Fan Zhan-guo, Jiang Tao, Liu Su-lan.: Measurement of CL⁻ and SO₄²⁻ in boric acid by turbidimeter. J. Inorganic Chemicals Industry. 40, 56--58 (2008), (in Chinese)

2. Brasington, J., Richards, K.: Turbidity and suspended sediment dynamics in small catchments in the Nepal Middle Hills. Hydrol. Process. 14, 2559--2574 (2000)

3. Gippel, C.J.: Potential of turbidity monitoring for measuring the transport of suspended solids in streams. Hydrol. Process. 9, 83--97 (1995)

4. Jack Lewis.: Turbidity-controlled suspended sediment sampling for runoff-event load estimation. J. Water Resource. 32, 2299--2310 (1996)

5. Lawler, D.M., Brown, R.M.: A simple and inexpensive turbidity meter for the estimation of suspended sediment concentrations. Hydrol. Process. 6, 159--168 (1992)

6. B.P.J. de Lacy Costello, R.J. Ewen, N.M. Ratcliffe, M. Richards.: Highly sensitive room temperature sensors based on the UV-LED activation of zinc oxide nanoparticles. J. Sensors and Actuators B: Chemical. 134, 945--952 (2008)

7. Sheng Qiang, HE Xiao-gang.: The Far-infrared LED and the Detection of Water's Turbidity. J. Sci-Tech Information Development & Economy. 17, 274--275 (2007), (in Chinese)

8. Zhang Wei, Yang Jing-fa, Yan Qi-geng.: Experiment research on the property of silicon solar cell. J. Experimental Technology and Management. 26, 42--46 (2009), (in Chinese)

9. J.A. Siqueira Dias, R.L. Leite, E.C. Ferreira.: Electronic technique for temperature compensation of fibre Bragg gratings sensors. J. AEU - International Journal of Electronics and Communications. 62, 72--76 (2008)

10. DU Yong-ping, HE Xiao-ying.: Brief discussion on temperature compensation technology of sensor. J. Electronic Design Engineering. 17, 63--64 (2009), (in Chinese)

11. XU Jun.: Using S-C Processor Software to Achieve the Sensor's Temperature Error Compensation. J. Modern Electronic Technique. 10, 97--99 (2002), (in Chinese)

12. Matej Možek, Danilo Vrtačnik, Drago Resnik, Uroš Aljančič, Samo Penič, Slavko Amon. Digital Self-Learning Calibration System for Smart Sensors. J. Sensors and Actuators A: Physical. 141, 101--108(2008)
13. Dag Hongve, Gunvor Åkesson.: Comparison of nephelometric turbidity measurements using wavelengths 400–600 and 860 nm. J. Water Research. 32, 3143–3145(1998)