Design of marine small temperature salinity meter based on ARM

： This design aims to solve the current problem that the ocean temperature salinity meter in marine research has high accuracy, but the cost is high, and it is not easy to combine with other modules. This design is a small temperature salinity meter with STM32F103 as the MCU using the temperature-conductivity integrated sensor and depth sensor. The accuracy mainly depends on the sensor. Users can replace the sensor to convert accuracy and control cost. The single-cell lithium battery is used as the power supply. It can be charged via USB, and can run for more than two hours. Communicated with USB, the upper computer can take the data from the lower computer to draw a curve and display the data at a fixed point on the computer screen, which is convenient for the user to analyze the data. The data is stored as a text file, and the user can place the data in other software such as Matlab for data analysis. This design provides a multifunctional and miniaturized instrument for the demands of the booming development of seafloor in-situ observation systems to conveniently measure salinity ， temperature and depth of seawater and sediment.


Introduction
The advancement of science and technology has also promoted the continuous development of marine scientific research, making the practical application of marine scientific research more widely. The booming development of seafloor in-situ observation systems requires all kinds of multifunctional and miniaturized instruments to conveniently measure salinity ， temperature and depth of seawater and sediment [1] . Although the CTD (Conductivity, Temperature, and Depth) instrument is popular and accurate at present, it is expensive and large in size, and they are not easy to combine with other modules. Therefore, this article has designed a miniaturized marine temperature salinometer.

Measuring Principle
According to the 1978 Practical International Salt Standard, the practical salinity can be calculated by the following expression [2] : where a x , b x is the known constant. t is the temperature, using the 1968 international temperature scale, R t is the relative conductivity.
In (1), temperature and relative conductivity need to be obtained.
According to the definition of the relative conductivity, the relative conductivity can be calculated by the following expression: (2) where x t is the actual conductivity, x n-t is the conductivity of international standard seawater with a salinity of 35‰ at different temperatures.
In (2), the actual conductivity and the conductivity of international standard seawater with a salinity of 35 at different temperatures need to be obtained.
According to the Baoren Wu and Guohua Chen's research [3] , the conductivity of international standard seawater with a salinity of 35 at different temperatures can be calculated from the following expression: x n·t =29.0470 +0.861281t +0.463505*10 -2 t 2 -0.266256*10 -4 t 3 +0.185453*10 -7 t 4 According to the hydraulic pressure expression, the ocean depth can be calculated from the following expression: where h is the depth of the pure water.
In (4), the depth of the pure water and the density of sea water need to be obtained.

Program Design
The whole system is powered independently by a 3.7V lithium battery. The ARM module receives the data collected by the sensor and calculates the measurement data, and saves the measurement data to the SD card. Through the USB interface, the upper computer reads the data from the lower computer and draw graphs on upper computer's screen.

Hardware Design
The hardware design of the lower computer is integrated, modular, small portable.

RS485 drive module
Receive: When there is no data, the TXD terminal is high level, the transistor Q1 is turned on, the RE/DE low level, the RE low level is enabled, and the MAX485 is turned into the receiving state.
Send: When STM32F103 sends data "0", TXD terminal is low level, transistor Q1 is turned off, RE/DE is high level, DE high level is enabled, MAX485 is turned into transmitting state, DI is grounded, and data is "0". When STM32F103 sends data "1", TXD terminal is low level, transistor Q1 is turned on, RE/DE is low level, RE low level is enabled, MAX485 is turned into receiving state, and the transmitting driver is disconnected. RS485 works in the half-duplex mode. The chip still belongs to the transmitting mode. The voltage difference between AB is pulled to +5V, that is, the voltage difference of the RS485 level signal "1" by the pull-up resistor R8 and the pull-down resistor R10, and the data "1" is transmitted.
It implements that when the STM32F103 sends a signal, it automatically changes to the transmission mode. When the STM32F103 receives the signal, it automatically changes to the receiving mode.

Human-computer interaction module
Four buttons and a LCD display are provided to the user. Basic operations that the user can complete, such as measure, transmission, set system time, delete data and other, and display measuring curve on the LCD screen.

Power module
The whole system is powered by a 3.7V lithium battery. Boost from 3.7V to 5V, 5V is boosted to 12V and regulated to 3.3V, providing 5V, 12V, 3.3V to each module and chip. It can be charged by the USB cable and can run for more than two hours.
The power consumption of the 5V power supply is shown in Table 1. The power consumption of the 12V power supply is shown in Table 2.

Software Design
The lower computer software design adopts modular design, which is divided into RTC clock module, RS485 module, OLED module, SD card + FATFS file system [4] , multi-level menu module [5] , and USB analog card reader module.
The upper computer software design implements the reading of the measurement data in text file, and separates the time data and the measurement data from the text file. Draw the data into graph with the time data as the x-axis and the measurement data as the y-axis. The time data and measurement data of the point will displayed when the cursor catch the point on the graph.

Experimental verification
In this experiment, a 1.5 meter plastic pipe is used to calibrate the depth sensor. Use the brine with the salinity of 5‰ and the room temperature (29℃) to calibrate the temperature-conductivity sensor ( Figure 2). Add water to the pipe to 1.45 meters, put the sensor in the bottom of the pipe for one hour and sent the measurement data to the computer. Use a balance and refractometer to compound the brine with the salinity of 5‰. Put the sensor into the brine and sent the measurement data to the computer. The sensor is then left in the laboratory for one hour to take the measurement data and send it to the computer. Use Matlab to draw the graph of temperature, salinity, and depth on the computer ( Figure 3). As can be seen from Figure 3, the temperature accuracy is ±0.2°C, the salinity accuracy is ±0.02, and the depth accuracy is ±0.02 m .

Conclusion
This design aims to solve the problem that the ocean temperature salinity meter in marine research today has high accuracy, but the cost is high, and it is not easy to combine and combine with other modules. Design a small temperature salinity meter with STM32F103 as the MCU using the temperature-conductivity integrated sensor and depth sensor. Specifically implement the following functions: (1) The system's accuracy mainly depends on the sensor. Users can replace the sensor to convert accuracy and control cost.
(2) The lower computer hardware design is integrated. The single-cell lithium battery is used as the power supply. It can be charged by the USB, and can run for more than two hours. It is small and easy to carry out.
(3) Communicate with the upper computer in U disk mode. The upper computer can take the data of the lower computer to draw a curve and display the data at a fixed point, which is convenient for the user to analyze the data. The data is stored as a text file, and the user can place the data in other software such as Matlab for data analysis.