A Wireless Intelligent System Construction For Measuring And Control Of Liquid Product Level In Reservoir Parks

The article is devoted to a system construction for measuring and controlling the liquid materials level in remote reservoirs. The hardware solution is based on Wi-Fi technology with radio frequency data transmission and level measurement using an ultrasonic sensor. An internet server is used to collect data in a database and present the data to users in the web pages form. The developed system provides high accuracy, low power consumption and low cost.


INTRODUCTION
Level gauges play an important role in the stocks measurement and control in tank farms, since when used in the chemical, pharmaceutical and refining industries, they are usually scattered over large areas. Therefore, it is necessary to develop systems for remote monitoring and inventory product accounting contained in them.
When working in conditions of potential spark-explosion-fire hazard, measurement and control of the liquid level in many tank farms is a complex technical problem. For the first time in the world, such a difficult situation arose in Japanese tank farms in 2011 at a nuclear power plant in Fukusima city, where, in order to prevent further catastrophic consequences, the electricity was turned off, and as a result, not a single level sensor worked and information about the coolant level in the reactor ceased to flow.
Today, there is a replacing wired technologies trend with wireless, both in mobility and space saving, etc. [1][2][3]. There are several sensors available on the market for measuring the liquid level and bulk materials, but most of them use a cabled data connection [4][5]. When using communication via Wi-Fi, new opportunities open up for processing information from sensors. The non-contact level sensor connected to Wi-Fi is itself an intelligent technology object: it can be easily connected to the entire system, the operation which depends on the current level [6]. Relatively recently, modules appeared on the market that combine Wi-Fi and Bluetooth technologies in one chip, which guarantees high transmission speed due to Wi-Fi connection to the Internet, low energy consumption due to Bluetooth technology [7].
A literature review [8][9][10][11][12] showed that in practice many methods and measuring a liquid product level are used, but accurate results cannot be obtained if the optimal method is not chosen depending on the medium and the measurement -object. In this work, a piezoelectric ultrasonic transducer will be used to generate ultrasound due to its availability and ease of use. This transducer type will also be used as a receiver. Figure 1 shows a simplified schematic of an ultrasonic level meter that uses ultrasonic propagation time measurement.
Comparing wireless technologies with low energy consumption. Wireless data transmission in the sensors was developed many years ago. However, it only came to the fore with the low-power modules advent, which is mainly used in smartphones, smart homes, meters, remote controls, mobile devices, applications, etc. Previously, the technology could not focus on mobile systems, since the data transmission in wireless technology meant a lot of energy and required specialized communication equipment. The situation changed with the low power technologies advent, which are characterized by low energy consumption, small dimensions, high productivity and low purchase price [13,14].
The main goal was to develop a technology in which the device will operate from a power source for a long time. To recharge the batteries, recharging with the use of external sources, the so-called "collecting power", begins to expand. "Low power" wireless technology includes Bluetooth, Wi-Fi, ZigBee, ANT +, Nike +, NFC, and more. Comparative characteristics of these technologies are shown in There is a direct proportionality between technologies in consumption and transmission speed. Although NFC as a passive element does not require a power source, the data transfer rate is in the order of kilobytes/s. On the contrary, Wi-Fi transmission speeds reach almost 6 Mbps. Power consumption will also depend on this speed.
The Wi-Fi technology advantage is that the modules can be easily connected to the network. Modules with this technology are mainly used in industrial automation, healthcare, etc. Bluetooth with low energy, also called BLE, differs from the original mainly in energy consumption due to a lower transmission rate, and when powered by a button battery, it can work for up to one year [15].

MATERIALS AND METHODS
We have developed and implemented of equipment for measuring a liquid product level and sending the measured data to a remote receiving station. Wireless transmission of this data is required. In the specification, the required distance to the receiving station is about 500m. The whole structure must be made so that it can be used for multiple sensors that will send information to one central receiving station. The challenge is to select the components according to the requirements under which the device can be implemented as efficiently as possible, i.e. a suitable sensor selection for measuring the liquid level in the tank. In addition, a suitable device selection will store the measured values and then send them to the transmitter. It is also necessary to select a suitable transmitter that will be able to transmit data over a given distance (500 m) and develop a communication protocol with which the data will be sent in the required form.
A piezoelectric ultrasonic transducer will be used to generate ultrasound due to its availability and ease of use. This type of transducer will also be used as a receiver. Figure 1 shows a simplified schematic of an ultrasonic level meter that uses ultrasonic propagation time measurement.
lies in their dependence on the atmosphere properties (temperature, pressure, etc.), and the inaccuracy problem if the sensor is placed in a dusty environment or foams on the measured liquid surface. However, in this case (in Figure 2.) it is sufficient to compensate for the temperature effect. (1) where t-is measured time in seconds, and v -signal speed in m/s. Under normal conditions, the speed of sound is about 340 m/s. However, in formula (2) we can see what effect the temperature has on the speed of sound. For the speed of sound in air at temperature t, 0 C: (2) A more accurate calculation is given by formula 3: where κis adiabatic constant (1.402 for air), Ris gas constant for air (287,05 J.), and T -is thermodynamic temperature (t + 273,15K). If the liquid level is measured with an ultrasonic sensor, it is absolutely necessary that the measuring device also includes temperature measurement in order to be able to correctly calculate the speed of sound and then measure the liquid level accurately. Figure 3. shows the temperature dependence characteristic on the speed of sound. The wireless intelligent liquid level sensor is a module consisting of one already installed printed circuit board. The main part of the module consists of a printed circuit board, on which the main control unit is located -a microcontroller. It also contains a Wi-Fi module for wireless data transfer to a Wi-Fi network, connectors for components, LEDs, reset buttons, and passive components such as resistors and capacitors.
There are also two reset buttons on the board that are used to reset the Wi-Fi module and microcontroller to the default program state. For communication with the standard WEB user interface.
The power consumption is solved mainly through the use of low consumption cells. This system uses the STM32F050F6 microcontroller. ARM microcontrollers are characterized by low power consumption. We achieve maximum savings in standby mode, in microcontroller mode, or in microcontroller mode by programmatically disabling unnecessary input and output ports. In addition, a Wi-Fi module called Nano WiReach from ConnectOne is used, which has a higher power consumption compared to competing products (see table 2 for comparison.) By using a more suitable and especially new version on the market, the AMW004 Wi-Fi module from ACK achieves a significant reduction in overall power consumption, but the cost of the module is very expensive.  Figure 4. shows the electronic circuit of the power supply of the entire module, which is carried out from a switching power supply unit, which is located on a separate board. This voltage powers a switched voltage source that converts the voltage to 2.9V (on the VCC circuit). This value is adapted for the ST-LINK programmer, which uses the voltage of this value for programming and tuning microcontrollers.
All elements of the main board are supplied with VCC voltage. An exception to the power supply is the ultrasonic module. Since it uses five volt logic, it is powered separately from the circuit that forms a 5V voltage regulator. An LED connected directly to the VCC voltage indicates if the power supply is connected. To monitor the state of the battery capacity, the battery voltage is supplied through a voltage divider (input voltage 1: 3) to the microcontroller pin PA1.
This applied voltage is read by a 12-bit A/D converter and then the value is evaluated by the microcontroller. When the minimum value is exceeded, the user is informed about one of the options selected in the configuration settings.

Diagram -communication part.
Communication between the control unit and the Wi-Fi module is carried out via an asynchronous UART communication interface. The transmission port of the Wi-Fi module is connected to the microcontroller at the PA10 pin, which receives data. The receive contact receives data from port PA9. The Wi-Fi module works using AT commands to which the Wi-Fi module sends response messages, most often I/OK or I/ONLINE strings.
An important part of the Wi-Fi module is also the DATA_RDY port. The default value for this port is logical 0.When changing values in the configuration window, this port is set to logic 1, and it remains there until the microcontroller reads the new settings. Then it goes back to logical 0 (in Figure 5).
For error-free transmission via the UART communication interface, an external crystal is connected, which must be equipped with capacitors to prevent interference.
The LED2 luminodiode is used to indicate in certain transmission parts, for example, for lighting when installing the Wi-Fi module in the configuration menu. Programming scheme -SWD. The serial debug interface SWD is used to download the program to the microcontroller. This method is mainly used for microcontrollers that are manufactured with a small number of pins. This is programming where only two wires are connected to the microcontroller in the clock and data form. The BOOT0 pin is not used and is grounded through a resistor (in Figure 6). An important part is the ST-Link debugger, without which downloading the program to the microcontroller is impossible. This debugger is sold as a standalone device or is also found on every STM32x development board from STMicroelecronic, the so-called Discovery kit. The manufacturer [16] recommends connecting the button S1 and the capacitor C2 in parallel with the NRST pin. The capacitor must be placed on the board as close to the button as possible. This connection protects the microcontroller from spikes that can reset it during program execution. Figure 7 shows the general electronic circuit for connecting the device components.

SOFTWARE
The entire sensor is controlled through the user interface. The web interface is created in the HTML programming language with JavaScript elements and cascading styles. It connects to this user interface using the IP address of the Wi-Fi module. In this case, the module acts as a web server to which the web application is loaded. The Wi-Fi module communicates with a microcontroller that evaluates and updates values from the web application. The program for the microcontroller is created in the Atollic TrueSTUDIO development environment in C. Figure 8 shows a block diagram of the program working as follows. After connecting the power supply, the microcontroller will be configured (counter / timer, ADC converter, inputs and outputs, USART). For the program to work correctly, you must first disable the echo of the Wi-Fi module and enable the interrupt enable from the USART communication interface.
First, the Wi-Fi module is configured to configure the Ad-hoc network using commands. With this setting, the Wi-Fi module creates an access point to which the user connects. To access the web application, you must first enable the embedded web server and disable authentication. The user is now allowed to connect to 192.168.50.1 using any web browser.
At this moment, the indicator LED lights up, the power saving mode is activated. The program then waits for the user to enter data into the configuration window.  When this setting is confirmed, the DATA_RDY port of the Wi-Fi module is set to logic 1, and the microcontroller receives this data. It then evaluates the data and proceeds according to the user's preferences. The user chooses between offline mode, i.e. on the Ad-hoc network and online. Both of these modes have a common part, in which they differ only in the case of sending an email notification and an SMS message. You must be online for this option. In this first part of the program, the water level and battery capacity are measured. The values are sent to the site.
In addition, the values are compared to see if the set limits have been exceeded. If one of the limits is exceeded, a warning message is also sent about this situation. In online mode, this is also the already mentioned email alert function. Then the power saving mode is set again, which lasts all the time waiting for the next measurement period. Before the next measurement period, it is checked again whether the configuration settings have changed. In online mode, you must first connect to a network access point. The name, password and security type of this network are user-defined. After connecting to the network, you need to find out the IP address of the Wi-Fi module that is assigned by the router.
This address is then sent to the user's email address. Using this IP address, you can connect to a web application to which data is sent continuously. This page address is in the IP / actual form. Figure 6 shows a block diagram of the program algorithm.
To send commands to the Wi-Fi module using USART, a Send Commad method is created that takes a pointer to a character string to send. This method first enables the USART for communication and then sends the character string using the USART_putstring method. For the Wi-Fi module to accept a string, it must end with a "\ r" check character. After sending characters, it goes to the IOKMessage method, where it first waits for an interrupt response from the USART. The program of the command sending method looks like this: voidSendCommand(char*cmd) { delay_ms(200); USART_Cmd(USART1, ENABLE); USART_putstring(cmd); IOKMessage(); } The received characters are written in turn to the at Answer variable. If the control characters "\ n" and "\ r" are received, the entire interrupt is terminated and the USART is turned off, and the method code for receiving the response looks like this: It is also possible to create a sensor network either from the same type of sensors or from sensors combination from different industries. The main advantages of the sensor include the ability to connect to existing Wi-Fi networks, whether it is a public metropolitan area covered by some cities or home networks. First of all, this sensor can be used for level measurement, but it can also be used in other applications based on the principle of distance measurement.
Graphic user interface. The graphical user interface consists of two simple web pages (configuration and current values page). The user accesses these pages using the IP address of the sensor, depending on the network on which the sensor is located.
Web pages are created using the HTML programming language, which contains cascading style elements and JavaScript. The Configuration button can be used to change the measurement setting.   CONCLUSION A sample of a wireless level sensor capable of sending measured data over a Wi-Fi network has been developed. For this, wireless technologies and a set of AT + for managing Wi-Fi technology modules have been thoroughly studied. The projected level gauge can be customized using the website, which also displays data on liquid level or power source power. In addition, a number of functions have been successfully implemented, including sending an informational SMS or e-mail in the event of exceeding the level or limits of the source capacity. Solutions were adopted, such as replacing the stabilizer with a switching power supply and lowering the voltage to a certain value. Further research in this area may lead to an increase in the signal transmission distance up to 2 km.