# Design of Intelligent Conductivity Meter Based on MSP430F149

Yaoguang Wei, Jianqing Wang, Daoliang Li, Qisheng Ding

► To cite this version:

Yaoguang Wei, Jianqing Wang, Daoliang Li, Qisheng Ding. Design of Intelligent Conductivity Meter Based on MSP430F149. Third IFIP TC 12 International Conference on Computer and Computing Technologies in Agriculture III (CCTA), Oct 2009, Beijing, China. pp.240-247, 10.1007/978-3-642-12220-0_35. hal-01061736

HAL Id: hal-01061736

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

Submitted on 8 Sep 2014

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>

Distributed under a Creative Commons Attribution 4.0 International License
DESIGN OF INTELLIGENT CONDUCTIVITY
METER BASED ON MSP430F149

Yaoguang Wei, Jianqing Wang, Daoliang Li*, Qisheng Ding

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

*Corresponding Author: Li Daoliang, Professor, The main research fields are agriculture information technology. dliangl@cau.edu.cn

**Abstract:** An intelligent conductivity meter based on MSP430F149 microcontroller was proposed in this paper. The intelligent conductive meter was composed by MSP430F149 microcontroller and its peripheral circuits, bipolar pulse excitation circuit and waveform transform circuit. The MSP430F149 was chosen to control the generation of bipolar pulse excitation signal and take temperature compensation. It adopted bipolar pulse excitation signal to avoid the electrode polarization effects. The measurement error generated by the solution temperature fluctuation could be amended by the temperature compensation. It could self-compensation and self-tuning to fit variance solution.

**Key words:** Bipolar Pulse, Electrical Conduction, MSP430, Temperature Compensation

# 1. INTRODUCTION

In recent years, water quality had become a hot issue in the fields of clean drinking water, distilled water, medicinal and biological water, power boilers, aquaculture and other areas [1,2]. Aquaculture was a fast-expanding mode of food production in the world. Global production of farmed fish and shellfish has more than doubled in the last 10 years. Ninety percent of the world's aquacultures undertaken in Asia, with China producing two thirds of the
world total while Europe, North America and Japan, which produce only 10 %, consume the bulk of the seafood traded internationally. Fish will be the main farmed aquaculture species, but production of more extensive species like stichopus japonicas, bivalves and seaweeds would increase. In the aquaculture, water quality was the key influencing factors. The water quality problem was associated with both physical and chemical factors such as high or low dissolved oxygen, high concentration of nitrogenous compounds (ammonia-N and nitrate-N) and high levels of Electrical conductivity (EC). The water quality in aquaculture fishponds was controlled by a complex interplay of many factors. Air-water Environmental problems have resulted from the conversion of wetland habitats to aquaculture ponds. These include nutrient, sediment and organic waste accumulation leading to deterioration of water quality, one of the important factors that determine the viability of fish farming. The water quality problem was associated with both physical and chemical problems such as too high or too low Electrical conductivity (EC). Electrical conductivity was the measure of total concentration of dissolved salts in water. When salts dissolved in water, they give off electrically charged ions that conduct electricity. The more ions in the water, the greater the electrical conductivity it had. Because there were almost no ions in distilled water, it had almost no electrical conductivity. Hard water contained more salts, and therefore more ions, had a high electrical conductivity. Electrical conductivity was the criterion to measure the conductivity of the solution[3]. It was inherit physical and chemical properties of the solution, and it was the main influencing factors to the water quality.

The researchers had taken great attention on the electrical properties of the solution and lots of methods to measure EC of the solution had been proposed in the last years. The commonly used measurements of EC were electrode conductivity, electromagnetic conductivity and ultrasonic measurements[4,5]. Restricted by the measurement mechanism, the last two methods were usually been used to measure the high-conductivity solution. The electrode conductivity measurement method was based on the principle of electrolytic conductivity. It had the features of simple electrode structure and wide range of measurement which promoted it to be widely used in the measurement of solution EC.

## 2. MEASUREMENT PRINCIPLE OF CONDUCTIVITY ELECTRODE

The conductance pool could be equivalent to the parallel resistor and capacitor circuit which has been shown at figure 1 (A). There, $R_{L1}$, $R_{L2}$ was the electrode lead resistance; $R_b$, $R_2$ was the polarization resistance resulted
in chemical polarization and concentration polarization, also known as Faraday resistance. $C_p$ was the lead capacitor. The simple circuit of the conductance pool was shown at figure 1 (B). There $R_x$ was the resistance of the conductance pool, $C_x$ was the capacitance of the conductance pool.

<figure><img src="image_2.png" /><figcaption>Figure 1 Conductance pool and its Equivalent circuit</figcaption></figure>

Many conductivity electrode measurement methods had been proposed at home and abroad. But there were many shortcomings about the methods to measure the EC through conductivity electrode. Firstly, the measurement results were inevitable influenced by the polarization resistance $R_b, R_2$, especially in the measurement of high concentrations of solution. Secondly, as shown in figure 1(A), the value of $C_x$ was also influenced the measurement result. Thirdly, the temperature of the solution could influence the ionization, solubility, ion migration rate, solution viscosity and expansion of the solution, which could also take effects on the accuracy of the EC measurements[6]. When the temperature increased, the solution viscosity become lower, the ion movement accelerated under the electric field, the conductivity changed. It could be concluded that the EC measurement based on conductivity electrode should avoid the influence of polarization effect, capacitance effect and temperature effect.

<figure><img src="image_3.png" /><figcaption>Figure 2 Bipolar Pulse Signal</figcaption></figure>

To solve these problems, we designed the voltage bipolar pulse method which pulse width could be easily adjusted to measure EC. As shown in figure 2, the excitation signal was bipolar pulse voltage source, which has same amplitude, opposite polarity. The pulse excitation and sampling diagram was shown in figure3. In one measurement circle, the system
sampled the output voltage twice at T moment. It selected the average of the twice sample value as the measured value to eliminate the low-frequency noise which could be generated by the DC excitation system. T moment was at the moment of positive or negative half-cycle which output the 80% of output voltage. It could be considered that the output voltage has reach to stable when the average of the two sampling was less than some value.

<figure><img src="image_4.png" /><figcaption>Figure3 EC Measurement based on Bipolar Pulse Excitation</figcaption></figure>

If the sampling time T was far less than product of Rx and Cx, then the voltage of the Cx should be small enough. At that time, there was no current flowing through Cp because the charging of Cp has finished. At T sampling moment, the relation between the measured transient voltage and solution resistance was shown following:

$$R_x = -\frac{V_t \times R_f}{V_0} \quad (1)$$

It could be concluded from equation (1) that the $R_x$ has no relation with $Cx$, $Cp$. That was to say, the measurement method had eliminated the effects of the capacitance. The effects of polarization resistance was related with the voltage between the two electrodes, voltage duration time and composition of the solution. Therefore, polarization resistance calculation was very difficult, even impossible. Research had found that there would not appear polarization when the voltage was less than a certain value.

### 3. DESIGN OF MEASUREMENT CIRCUIT

As shown in figure 4, the structure of EC measurement circuit was composed by MSP430F149 control circuit and its peripheral circuits, bipolar pulse excitation circuit, range switching and amplifier circuit, waveform transformation circuit and temperature measurement circuit. The function of the circuit was to generate bipolar pulse signal, range switching, converted the measurement signal into digital signal, temperature compensation, data storage and transmission. We adopted the MSP430F149 to capture analog signals of conductivity electrode, convert them to digital values, process measurement data and transmit the data to a host system. The MSP430F149
was microcontroller configurations with two built-in 16-bittimers, a fast 12-bit A/D converter, two universal serial synchronous/asynchronous communication interfaces (USART), and 48 I/O pins. The timers make the configurations ideal for industrial control applications such as ripple counters, digital motor control, EE-meters, hand-held meters, etc. The hardware multiplier enhances the performance and offers a broad code and hardware-compatible family solution.

<figure><img src="image_5.png" /><figcaption>Figure.4 Structure of the Intelligence Electrode Conductivity Meter</figcaption></figure>

The traditional electrical conductivity measurement system adopted sinusoidal excitation signal to avoid electrode polarization. It should to add the complex filter circuit for signal processing. The system has been proposed in this paper adopted the bipolar pulse voltage source as the excitation source. It was equivalent to add a DC power source to the electrode when electrode received excitation. There were no filter circuit and capacitance compensation section which could simplify the structure.

For certain solution, there was no polarization effect when the excitation voltage value less than some special value. The polarization could be negligible when the voltage time was very small. The pulse width was not only restricted to the capacitor charging and discharging time, but also restricted to the polarization time. So the pulse width should be as small as possible to eliminate the polarization. Meanwhile, it should enhance the signal strength in order to separate the signal from noise. The circuit to generate bipolar pulse excitation signal was shown as figure 5.It adopted 78L05, 79L05 series of integrated three terminal voltage regulators as the incentive signal generator. 78L05 was the positive voltage regulator and 79L05 was the negative voltage regulator. The devices had the features of overheating and over-current protection circuit, few external components,
small size and low cost. The switch of the bipolar pulse source was controlled by the SPDT Analog Switches MAX303. The switch closure time was less than 150ns, its disconnect time was less than ns, the resistance less than 22Ω.

<figure><img src="image_6.png" /><figcaption>Figure 5 Bipolar pulse excitation circuit</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>Figure 6 Range Switching and Amplifier Circuit</figcaption></figure>

As shown in figure6, the pulse control signal was produced by the I/O port of MSP430F169. To ensure the drive capability of the signal, the global weak pull-ups was set to inhibit. The output of the port P1.0, P1.1 was set to push-pull mode. The frequency of Control signal was controlled by the internal Timer_A of MSP430F169. It chose appropriate feedback resistor to ensure the measurement accuracy at different measurement range. The range switch was divided into four stalls and adopted feedback resistor of 390Ω, 3900Ω, 39000Ω, 390000Ω separately. It adopted the internal voltage reference of MSP430F139 as its A/D converter voltage reference. The
conversion range was 0V~2.5V. It adopted MAX313 as the gating control
device to choose the feedback resistor. Maxim's MAX313 analog switches
feature low on-resistance (10Ω max) and 1.5Ω on-resistance matching
between channels. These switches conduct equally well in either direction.
They offer low leakage over temperature (2.5nA at +85°C). The MAX313
was quad, single pole/single-throw (SPST) analog switches. The control
signal was generated by the MSP430F149. The I/O ports were configured as
push-pull mode and weak pull-global ban on.

<figure><img src="image_8.png" /><figcaption>Figure 7 Waveform Transformation Circuit</figcaption></figure>

The waveform transformation circuit was shown at figure7. Because the input signal of A/D in MSP430F149 was the positive polarity signal, so it should transform the AC signal into DC signal. It adopted two operational amplifiers and one CD4053 analog switch to construct the waveform conversion circuit. In order to ensure non-waveform distortion, it chose LF356 as operational amplifier. The LF356 had the features of high-speed, high input impedance and low input bias current. The control signal was generated by the MSP430F149. The I/O ports were configured as push-pull mode and Weak pull-global ban on. The frequency of waveform transform control signal and pulse excitation pulse control signal were synchronization. The two amplifiers amplify the positive and negative signal at positive and negative phase respectively and output the positive DC signal.

4. TEMPERATURE COMPENSATION

The temperature of the solution would influence the ionization degree, solubility, ionic migration ratio, viscosity and dilatability of the electrolyte. So the changing of the temperature would affect the accuracy of the EC value. Therefore, temperature compensation of conductivity measurements
had become particularly important, and took temperature compensation could reduce the error and increase the accuracy of the measurement. Research has found that when the temperature was deviate from 25°C, the error of the EC was become larger. To reduce the error and increase the accuracy, it divided the temperature between 1℃ to 30℃ into five intervals. Every temperature interval was set different correction factor by the experiments results. The correction equation was shown as follows:

$$ K_s = \begin{cases} K_t / (0.01t + 1.21), & 1^\circ C \le t \le 10^\circ C \\ K_t / (0.04t + 1.17), & 10^\circ C < t < 20^\circ C \\ K_t / (0.05t + 1.45), & 20^\circ C \le t \le 30^\circ C \end{cases} \quad (2) $$

Where, $K_s$ was the Electrode Conductivity value of the solution at 25°C, $K_t$ was the Electrode Conductivity value of the solution at t°C, t was the solution temperature.

## 5. CONCLUSION

A new seawater electrical conductivity measurement system has been proposed in this paper. It adopted conductivity electrode as the sensor to measure the resistance of the solution. It adopted bipolar pulse excitation signal to avoid effects of electrode polarization. When being powered by the bipolar pulse which excited by the MSP430F149 microcontroller, the circuit generated voltage signal which corresponded to the resistance of the solution. The analog output signal was amplified by the range switching and amplifier circuit. Then it changed the waveform through the waveform transformation circuit and sent the signal to the A/D of MSP430F149. The temperature signal was also being measured to take temperature compensation. The system which has been proposed in this paper had the characteristics of easy to realization, self-compensation and self-tuning.

## ACKNOWLEDGEMENTS

This work was supported by the Key Projects in the National Science & Technology Pillar Program during the Twelve FIVE-YEAR Plan Period (2006BAD10A02-05)
REFERENCE

[1]. Randall E W, Wikinson A J-Cilliers J J et al. Current Pulse Technique for Electrical Resistance Tomography Measurements. Proceedings of the World Congress on Industrial Process Tomography, August 29~31, 2001, Hannover, Germany: 493~501

[2]. Cilliers JJ, Xie W, Neethling S J, et al. Electrical Resistance Tomography Using a Bi-Directional Current Pulse Technique, Meas.Sci.Technol, 2001, 12(8):997~1001

[3]. Liu Teijun, Huang Zhiyao, Wang Baoliang et al. High Speed Electrical Resistance Tomography System Based on Bi-directional Pulse Current Technique. Proceedings of the 4th International Symposium on Measurement Techniques of Multiphase Flows, Sept. 10-12, Hangzhou, China, 2004:192~198

[4]. Huang Haibo, Ji Halfeng, Huang Zhiyao, Li Haiqing. Design of Electrical Resistance Tomography System based on bi-directional pulsed current technique. ICEMI'2003: Proceedings of the sixth international conference on electronic measurement & instruments, Aug18-21, Taiyuan, China, 2003, Vols 1-3:2300~2303

[5]. Chen Xiaoping, Chen Hongxian. Double Frequency Method to Measure Water Conductivity. Chinese Journal of Scientific Instrument. 2006,27(5):520~522

[6]. Zhu Jianping, Wang Baoliang, Huang Zhiyao, Li Haiqing. A New Electrical Conductance Measurement Instrument Based on Bi-directional Pulsed Voltage Technique. Chinese Journal of Scientific Instrument. 2005,26(8):57~58