Design of a New PH Meter

STC12C5A60S2 chip with 8-way high-speed 10 bit a / D conversion (250K / s) is used as the core of the device. Through the in-depth study of the simple liquid container system, a set of system which can automatically measure the liquid level and weight and determine the given liquid type (including brine, pure water, milk, white vinegar, etc.) is designed. In the hardware design, ultrasonic module is used to measure the liquid level, load cell is used to measure the weight of liquid, analog signal collected by ad of main control chip is converted into digital signal, and pH sensor is used to measure pH value, so as to determine the type of liquid.


Introduction
A simple multifunctional liquid container device is designed, which can detect the liquid level, weight and type in the container, and keep the liquid level error of ± 2mm and weight error of ± 1g. Therefore, under the above requirements, the device can distinguish different concentrations of brine, and display the types of concentrated brine and light brine, as well as the types of pure water, brine, milk, white vinegar liquid, etc. according to the different pH value of the liquid. In addition, according to the electronic measurement technology, the device can distinguish pure water and sugar water [1][2][3][4][5].

System Plan
The system consists of single chip microcomputer module, ultrasonic sensor module, weighing sensor module and so on. The circuit structure is based on STC12C5A60S2 chip, which is connected with external devices through I / O port, receives control instructions through serial port, reads the data collected by sensors for processing, and reaches the display. The overall structure of the system is shown in Figure 1.  Figure 1. Overall structure of the system (1)Selection of main control chip STC12C5A60S2 single chip microcomputer is adopted. STC12C5A60S2 series single chip microcomputer has the functions of high speed, low power consumption and super strong anti-interference. The processing speed of CPU is better than that of ordinary 51 single chip microcomputer. The internal integrated special reset circuit and 2-way PWM, 8-way high-speed 10 bit a / D conversion are used in this experiment. The operation speed is fast and it can run well in the palm control experiment [6][7][8][9][10].
(2)Display section 12864 display. 12864 display screen can not only display letters, numbers and symbols, but also display all Chinese characters. Using 12864 display screen to display data, the display effect is better and more intuitive.
(3) Ranging part Scheme 1: laser ranging. The advantage of laser ranging is accuracy, but the disadvantage is that we need to pay attention to human safety, and the production is difficult, the cost is high, especially the optical system needs a clean environment, otherwise it will affect the measurement. Scheme 2: infrared ranging. The advantages of infrared ranging are cheap, easy to make and safe. The disadvantages are low precision, short distance and poor directivity. Scheme 3: ultrasonic ranging. The ultrasonic ranging is relatively stable because it is less affected by the environment.
(4) Weighing part Scheme1: resistance strain sensor. The resistance strain sensor is composed of four parts: elastic element, resistance strain gauge, measuring circuit and transmission cable. When the resistance strain gauge is attached to the elastic element, when the elastic element is deformed by force, the strain gauge on it will be deformed and the resistance will be changed. The change of strain gauge resistance is measured and transformed into electrical signal output which is proportional to the external force. After processing, the electrical signal shows the quality of the tested object in digital form.
Scheme2: capacitive sensor. The capacitance sensor transforms the mass of the object into displacement through the elastomer, which causes the change of capacitance and inductance. The corresponding measuring instrument detects the changed capacitance and converts it into mass.
Selection of weighing module: according to the demonstration of the above two schemes, the resistance strain sensor is easy to use and the measurement accuracy is accurate, so scheme 1 is selected for design and manufacture. The whole program of the device is composed of initialization program, ultrasonic testing program, weight testing program and AD acquisition program.

Software Programming (1)System program composition
(2)System flow The control system program flow chart is shown in Figure 2. According to the test requirements, all test items use the unified start key, and each start is only allowed once.

Test Liquid Level and Weight Data
When using ultrasonic to measure liquid level, because the interval time between each measurement data of ultrasonic is short, the bubble sorting method is used to select the maximum value and the minimum value, and to take the average value, so as to reduce the fluctuation error of liquid level and reduce the error. The test results show that the device has a good effect in measuring liquid level and weight. After adding bubbling algorithm and filtering, the error of liquid parameter water level is within 2mm and the error of weight is between 1g. Because the pH value of brine and purified water is almost the same, and the effect of pH test is limited, the proportional test method is adopted to achieve the purpose of liquid resolution, so as to meet the requirements of the design topic.

Conclusion
The device realizes the measurement of liquid level and liquid weight. The errors of liquid level and weight are between 2mm and 1g respectively, and the experimental parameters are displayed on the display screen in real time. Because density formula ρ = m / V density = mass divided by volume, fuzzy algorithm is used to calculate the density according to the liquid level and weight. The principle of different density of thick and thin brine completes the requirements of distinguishing between them. The difference of pH value collected by ad can distinguish the type of liquid. Meet the requirements of design topic.