scieee AI-readable full text Open interactive document viewer

Non-Intrusive Tank-Filling Sensor Based on Sound Resonance

García, Adrián,Toral López, Víctor,Márquez, Álvaro,García, Antonio,Castillo, Encarnación,Parrilla Roure, Luis,Morales Santos, Diego Pedro

Abstract

Different types of fill-level measurement systems exist in the market, but most of them imply some type of intrusion in the tank itself. In this paper, a reconfigurable system based on sound resonance for measuring the fill-level of a tank from the exterior is presented. A relation between sound resonance frequencies and the content of the tank has been found, especially as the tank gets closer to being full. A prototype has been created using reconfigurable technologies combined with wireless communications in order to control the system from an ad hoc application. With this prototype, the fill-level of different tanks has been measured with good resolution, especially when the tank is over half of its capacity.

Full text

electronics Article Non-Intrusive Tank-Filling Sensor Based on Sound Resonance Adrián García, Víctor Toral , Álvaro Márquez, Antonio García , Encarnación Castillo, Luis Parrilla * and Diego P. Morales Department of Electronics and Computer Technology, University of Granada, 18071 Granada, Spain; [email protected] (A.G.); [email protected].es (V.T.); [email protected] (Á.M.); [email protected] (A.G.); [email protected] (E.C.); [email protected] (D.P.M.) *Correspondence: [email protected].es; Tel.: +34-958-24-04-82 Received: 31 October 2018; Accepted: 29 November 2018; Published: 3 December 2018   Abstract: Different types of fill-level measurement systems exist in the market, but most of them imply some type of intrusion in the tank itself. In this paper, a reconfigurable system based on sound resonance for measuring the fill-level of a tank from the exterior is presented. A relation between sound resonance frequencies and the content of the tank has been found, especially as the tank gets closer to being full. A prototype has been created using reconfigurable technologies combined with wireless communications in order to control the system from an ad hoc application. With this prototype, the fill-level of different tanks has been measured with good resolution, especially when the tank is over half of its capacity. Keywords: tank-filling sensor; fill-level sensor; reconfigurable instrumentation; sound resonance 1. Introduction The automatization of industries, such as those related to agriculture or food, is under permanent development. These industries require new technologies to improve their operations, whether it be for an increase in production or for security reasons [ 1 ]. In this context, accurate tank level monitoring is of special interest. There are many studies addressing this issue, with some based on the use of the fluid as a dielectric of two capacitor plates [ 2 ], and others using IR image processing [ 3 ] for detecting the tank level, or even based on the use of an optical fiber [ 4 ] whose signal is modulated according to the fluid level. Moreover, most of these methods require the introduction of part of the instrument into the tank and its direct interaction with the monitored fluid. In the case of thermal imaging, the cost of these systems makes them unpractical, as they require a thermal camera and intensive image processing computation [ 3 ]. Besides, the immersion of a probe in the liquid is, in many cases, unsuitable due to the measurement conditions (such as the presence of acids, high pressure or temperatures, corrosion, and contamination risks). Other methods make use of radar or waveguides that are based on the reflection of signals in the liquid, as in References [ 5 – 7 ]. However, these systems are also expensive and need sophisticated technologies, and in the case of waveguides [ 7 ], they do not avoid the interaction between the content and the measuring system. Systems using capacitive arrays have also been developed for non-liquid contents like grain. For example, capacitive measurements are used in References [ 8 , 9 ] to measure the content flow and content level in pipes or tanks. Acoustic signals and resonance are resources used in several works, such as in Reference [ 10 ], where a speaker and a microphone inside a pipe are used to measure the level of a tank. A Helmholtz resonator is used in Reference [ 11 ] to determine the liquid volume inside the tank. In Reference [ 12 ], Electronics 2018,7, 378; doi:10.3390/electronics7120378 www.mdpi.com/journal/electronics Electronics 2018,7, 378 2 of 14 the tank response to an acoustic excitation is used as a measurement of the level and density of the content. This paper proposes a device that introduces advantages over these solutions, since it is a wireless measurement technique which obtains the liquid volume inside the tank in a non-intrusive way based its relationship with the resonance frequency. While the proposed solution is based on similar concepts to those used in Reference [ 12 ], this last solution requires two separated transducers, which makes such a system complex to scale to big tanks. Thus, while there are already similar measurement systems, as seen in References [ 11 , 12 ], these systems imply higher costs than the proposed system. Additionally, the particular case of Reference [ 11 ] requires a specific tank size and geometry, while the proposed system is useful for any type of tank geometry and also for different tank materials. Moreover, the proposed system directly provides volume measurements rather than fluid height readings, which are usually provided by most systems. Therefore, the proposed system is a low-power, scalable solution for those industries in which continuous tank level monitoring is necessary. This device can be used in a distributed measuring system. Thus, each tank in an industry can have a measuring device connected via Bluetooth, WiFi or any other suitable protocol to a central node from which it is possible to read the load of each tank. In Figure 1, a conceptual graph of the proposed system is shown. Electronics 2018, 7, x FOR PEER REVIEW 2 of 14 the tank response to an acoustic excitation is used as a measurement of the level and density of the content. This paper proposes a device that introduces advantages over these solutions, since it is a wireless measurement technique which obtains the liquid volume inside the tank in a non-intrusive way based its relationship with the resonance frequency. While the proposed solution is based on similar concepts to those used in Reference [12], this last solution requires two separated transducers, which makes such a system complex to scale to big tanks. Thus, while there are already similar measurement systems, as seen in References [11,12], these systems imply higher costs than the proposed system. Additionally, the particular case of Reference [11] requires a specific tank size and geometry, while the proposed system is useful for any type of tank geometry and also for different tank materials. Moreover, the proposed system directly provides volume measurements rather than fluid height readings, which are usually provided by most systems. Therefore, the proposed system is a low-power, scalable solution for those industries in which continuous tank level monitoring is necessary. This device can be used in a distributed measuring system. Thus, each tank in an industry can have a measuring device connected via Bluetooth, WiFi or any other suitable protocol to a central node from which it is possible to read the load of each tank. In Figure 1, a conceptual graph of the proposed system is shown. Figure 1. Conceptual scheme of the proposed system. The olive oil industry can be used to demonstrate the advantages of this system. In this industry, the level of the tanks is checked on a daily basis through visual checks of a marked glass level meter. This time-consuming process can be reduced to checking in a smartphone or PC the state of all the tanks at the same time, even from a place far apart from the tanks. The manuscript is divided into four parts. Following this introduction, Section 2 is devoted to the materials and methods involved in the implementation. Section 3 includes the results, which confirm the feasibility of the presented device, as well as the corresponding discussion. Finally, the main conclusions are presented in Section 4. 2. Materials and Methods 2.1. Physical Phenomena Involved and Model Derivation The proposed system is based on acoustic waves generated in the tank-fluid system when the tank is hit by an instrument (described in the following), in a similar way to how bells are rung. Thus, the vibration frequencies observed on the tank’s surface will depend on, in this case, the tank geometry and material, the fluid filling the tank and its physical properties, and the corresponding fill-level of the tank. This results in a complex mathematical model, mainly derived from two different phenomena. First is the vibration of the tank itself, which can be described through the theory of vibration of solids. This is of interest for a variety of fields, from the automotive industry to aerospace Figure 1. Conceptual scheme of the proposed system. The olive oil industry can be used to demonstrate the advantages of this system. In this industry, the level of the tanks is checked on a daily basis through visual checks of a marked glass level meter. This time-consuming process can be reduced to checking in a smartphone or PC the state of all the tanks at the same time, even from a place far apart from the tanks. The manuscript is divided into four parts. Following this introduction, Section 2is devoted to the materials and methods involved in the implementation. Section 3includes the results, which confirm the feasibility of the presented device, as well as the corresponding discussion. Finally, the main conclusions are presented in Section 4. 2. Materials and Methods 2.1. Physical Phenomena Involved and Model Derivation The proposed system is based on acoustic waves generated in the tank-fluid system when the tank is hit by an instrument (described in the following), in a similar way to how bells are rung. Thus, the vibration frequencies observed on the tank’s surface will depend on, in this case, the tank geometry and material, the fluid filling the tank and its physical properties, and the corresponding fill-level of the tank. This results in a complex mathematical model, mainly derived from two different phenomena. First is the vibration of the tank itself, which can be described through the theory of Electronics 2018,7, 378 3 of 14 vibration of solids. This is of interest for a variety of fields, from the automotive industry to aerospace research, also including civil engineering and musical instruments. However, this is a mathematically complex field, as shown by the general equation describing the vibration of a solid cylindrical shell, derived by Love [ 13 ] in 1888. In the case of generic tanks, the model will be even more complicated due to more complex geometries. Moreover, the presence of fluid in the tank further complicates the system’s mathematical description, as it could be modeled as two separate tanks–one filled with fluid and the other filled with air–or with any other gas used in the system under measure. On the other hand, the resonant cavities formed inside the tank, once again corresponding to both fluid and air, are a second source of acoustic vibration in the presented system. The geometric parameters of these cavities depend on the fill-level of the tank and the tank geometry, with one cavity size increasing as the tank is depleted, and the other one decreasing in volume, and vice versa. Simplifying the model of this sound resonance in the tank to a Helmholtz resonator [ 14 ], and assuming a cylindrical tank, resonance frequencies could be simply described [ 15 ] to be proportional to the sound propagation speed, and inversely proportional to the length of the cavities. However, the phenomena described above are not independent, and the mathematical analysis of the acoustic resonance in the tank is a very complex problem due to the different interactions between the vibration of the tank, the sound transmission in the fluid, the interface between fluid and gas inside the tank, the fluid-tank and gas-tank interfaces, and the tank geometry. Additionally, physical parameters of the tank material and fluid, such as rigidity, density, bulk modulus, viscosity, and others, will also be factors in the mathematical model of the whole system. Thus, the presented instrument relies on a so-called calibration process of the tank under measurement, as it will be described in Section 3.1. This calibration process, which requires only to perform a series of acoustic measurements for a number of controlled fill-levels, will produce a model relating the volume of fluid to the resonance frequency, which will be later used as a transfer function relating excitation (knock) and response (acoustic vibration on the outer tank surface). The selected resonance frequency will simply be the one with higher amplitude, as discussed below, of those acoustically observed on the tank surface after the knock. Apart from its non-intrusive nature, simplicity, and applicability to any tank geometry, this procedure does not require the conversion from fluid height to fluid volume, which is usually needed for most alternative systems. The presented instrument directly measures the fluid volume. 2.2. Measurement Procedure As will be further elaborated in Section 3.1, once the calibration process described above has been carried out and the model of the tank relating frequency and volume is available, the measurement process is composed of three stages: •Knock: In this stage the tank is beaten, so it starts resonating at the fundamental frequency and its harmonics. The hit must be a fast, dry blow, in order to create a sound as clean as possible with no dumping of vibrations. •Sampling: After the hit, using a piezoelectric microphone, the sound is captured and later digitized with an ADC (Analog-to-Digital Converter). •Analysis: Finally, FFT (Fast Fourier Transform) is applied to the digital signal, which is analyzed to obtain the resonance frequency that is later compared to the tank resonance model in order to determine the fill-level of the tank. The FFT Algorithm For the FFT analysis, the chosen algorithm is a butterfly algorithm with decimation in time (DIT FFT), which is based on the decomposition of the N-point signal into two vectors with the pair and odd positions of the original vector [ 16 ]. This process is repeated until Nscalar signals are obtained. Figure 2illustrates this process. Electronics 2018,7, 378 4 of 14 Electronics 2018, 7, x FOR PEER REVIEW 4 of 14 Figure 2. Vector reordering for the Fast Fourier Transform (FFT) algorithm. After that, it is possible to obtain the FFT combining the results with a sinus function that, as the discrete space is used, are the N-th roots of unity,  =  . Then the reconstruction of the spectrum is made, as shown in Figure 3. 0 4 2 6 1 5 3 7 -1 W N 0 -1 W N 0 -1 W N 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) Figure 3. The butterfly algorithm used to compute the decimation in time (DIT) FFT. 2.3. Device Prototype As a proof of concept of the proposed method, a portable prototype using reconfigurable electronics has been developed. Analog and digital reconfigurable technologies have been shown as ideal candidates for the implementation of smart instruments for biosignal acquisition and processing [17], while new SoC devices, such as Cypress PSoC, are the core of low-cost reconfigurable platforms that can be used in different instrumentation applications [18]. In this way, thanks to its reconfigurable nature, the developed device can be adapted to different scenarios depending on the needs of calibration, alternative sensors or actuators, or even different tank sizes and materials. The main unit of the device is a PSoC 5 LP [19], which integrates an ARM Cortex-M3 combined with FPAA-like and FPGA-like resources, thus providing a versatile and reconfigurable System-on-Chip approach. This main unit oversees the following tasks: • Communication with the computer or mobile device via Bluetooth; • control of the hit system to synchronize the moment of impact; • acquire the sound signal and store it in the memory to transmit it later; • analyze the signal and compute the filling level. Figure 2. Vector reordering for the Fast Fourier Transform (FFT) algorithm. After that, it is possible to obtain the FFT combining the results with a sinus function that, as the discrete space is used, are the N-th roots of unity, Wk N=e−ik2π N . Then the reconstruction of the spectrum is made, as shown in Figure 3. Electronics 2018, 7, x FOR PEER REVIEW 4 of 14 Figure 2. Vector reordering for the Fast Fourier Transform (FFT) algorithm. After that, it is possible to obtain the FFT combining the results with a sinus function that, as the discrete space is used, are the N-th roots of unity,  =  . Then the reconstruction of the spectrum is made, as shown in Figure 3. 0 4 2 6 1 5 3 7 -1 W N 0 -1 W N 0 -1 W N 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) Figure 3. The butterfly algorithm used to compute the decimation in time (DIT) FFT. 2.3. Device Prototype As a proof of concept of the proposed method, a portable prototype using reconfigurable electronics has been developed. Analog and digital reconfigurable technologies have been shown as ideal candidates for the implementation of smart instruments for biosignal acquisition and processing [17], while new SoC devices, such as Cypress PSoC, are the core of low-cost reconfigurable platforms that can be used in different instrumentation applications [18]. In this way, thanks to its reconfigurable nature, the developed device can be adapted to different scenarios depending on the needs of calibration, alternative sensors or actuators, or even different tank sizes and materials. The main unit of the device is a PSoC 5 LP [19], which integrates an ARM Cortex-M3 combined with FPAA-like and FPGA-like resources, thus providing a versatile and reconfigurable System-on-Chip approach. This main unit oversees the following tasks: • Communication with the computer or mobile device via Bluetooth; • control of the hit system to synchronize the moment of impact; • acquire the sound signal and store it in the memory to transmit it later; • analyze the signal and compute the filling level. Figure 3. The butterfly algorithm used to compute the decimation in time (DIT) FFT. 2.3. Device Prototype As a proof of concept of the proposed method, a portable prototype using reconfigurable electronics has been developed. Analog and digital reconfigurable technologies have been shown as ideal candidates for the implementation of smart instruments for biosignal acquisition and processing [ 17 ], while new SoC devices, such as Cypress PSoC, are the core of low-cost reconfigurable platforms that can be used in different instrumentation applications [ 18 ]. In this way, thanks to its reconfigurable nature, the developed device can be adapted to different scenarios depending on the needs of calibration, alternative sensors or actuators, or even different tank sizes and materials. The main unit of the device is a PSoC 5 LP [ 19 ], which integrates an ARM Cortex-M3 combined with FPAA-like and FPGA-like resources, thus providing a versatile and reconfigurable System-on-Chip approach. This main unit oversees the following tasks: •Communication with the computer or mobile device via Bluetooth; •control of the hit system to synchronize the moment of impact; •acquire the sound signal and store it in the memory to transmit it later; •analyze the signal and compute the filling level. Electronics 2018,7, 378 5 of 14 As the used kit board of PSoC [ 20 ] does not include Bluetooth and external memory is also needed, a shield for the development kit was designed so the full device follows the scheme shown in Figure 4. Electronics 2018, 7, x FOR PEER REVIEW 5 of 14 As the used kit board of PSoC [20] does not include Bluetooth and external memory is also needed, a shield for the development kit was designed so the full device follows the scheme shown in Figure 4. ADC Piezoelectric membrane F-RAM Bluetooth Module PGA KnockTank Device PSoC 5LP UART SPI Driver Solenoid KnockTank Shield Figure 4. Conceptual schematic of the prototype device. The internal configuration of the PSoC 5LP device is illustrated in Figure 5. As it is shown, the device configuration includes a PGA (Programmable Gain Amplifier) to amplify the signal received prior to the ADC. The ADC used is a Delta-Sigma type with 16-bit resolution. After that, 2 DMA (Direct Memory Access) channels are configured to transfer data to the memory without using CPU resources. Also, a NVRAM (Non-Volatile RAM) block is configured to manage the data transfer between the PSoC and the external RAM through an SPI protocol. A UART (Universal Asynchronous Receiver-Transmitter) for Bluetooth communication has been configured for 921,600 bps and fullduplex mode. Figure 5. The PSoC 5LP block diagram. 2.3.1. The Knock Subsystem The knock subsystem is composed of a small driver and a solenoid, as it is shown in Figure 6. The used MOSFET is an NTR4501 and the solenoid is the ZYE0530Z. When the MOSFET is activated through the resistance, the solenoid inductor creates a magnetic field, so the plunger goes backward. Once the MOSFET is turned off, the inductor is discharged through the Schottky diode, releasing the plunger quickly to generate an appropriate knock to the tank. Figure 4. Conceptual schematic of the prototype device. The internal configuration of the PSoC 5LP device is illustrated in Figure 5. As it is shown, the device configuration includes a PGA (Programmable Gain Amplifier) to amplify the signal received prior to the ADC. The ADC used is a Delta-Sigma type with 16-bit resolution. After that, 2 DMA (Direct Memory Access) channels are configured to transfer data to the memory without using CPU resources. Electronics 2018, 7, x FOR PEER REVIEW 5 of 14 As the used kit board of PSoC [20] does not include Bluetooth and external memory is also needed, a shield for the development kit was designed so the full device follows the scheme shown in Figure 4. ADC Piezoelectric membrane F-RAM Bluetooth Module PGA KnockTank Device PSoC 5LP UART SPI Driver Solenoid KnockTank Shield Figure 4. Conceptual schematic of the prototype device. The internal configuration of the PSoC 5LP device is illustrated in Figure 5. As it is shown, the device configuration includes a PGA (Programmable Gain Amplifier) to amplify the signal received prior to the ADC. The ADC used is a Delta-Sigma type with 16-bit resolution. After that, 2 DMA (Direct Memory Access) channels are configured to transfer data to the memory without using CPU resources. Also, a NVRAM (Non-Volatile RAM) block is configured to manage the data transfer between the PSoC and the external RAM through an SPI protocol. A UART (Universal Asynchronous Receiver-Transmitter) for Bluetooth communication has been configured for 921,600 bps and fullduplex mode. Figure 5. The PSoC 5LP block diagram. 2.3.1. The Knock Subsystem The knock subsystem is composed of a small driver and a solenoid, as it is shown in Figure 6. The used MOSFET is an NTR4501 and the solenoid is the ZYE0530Z. When the MOSFET is activated through the resistance, the solenoid inductor creates a magnetic field, so the plunger goes backward. Once the MOSFET is turned off, the inductor is discharged through the Schottky diode, releasing the plunger quickly to generate an appropriate knock to the tank. Figure 5. The PSoC 5LP block diagram. Also, a NVRAM (Non-Volatile RAM) block is configured to manage the data transfer between the PSoC and the external RAM through an SPI protocol. A UART (Universal Asynchronous Receiver-Transmitter) for Bluetooth communication has been configured for 921,600 bps and full-duplex mode. 2.3.1. The Knock Subsystem The knock subsystem is composed of a small driver and a solenoid, as it is shown in Figure 6. The used MOSFET is an NTR4501 and the solenoid is the ZYE0530Z. When the MOSFET is activated through the resistance, the solenoid inductor creates a magnetic field, so the plunger goes backward. Once the MOSFET is turned off, the inductor is discharged through the Schottky diode, releasing the plunger quickly to generate an appropriate knock to the tank. Electronics 2018,7, 378 6 of 14 Electronics 2018, 7, x FOR PEER REVIEW 6 of 14 Figure 6. Schematic of the solenoid driver circuit. 2.3.2. The Sound Subsystem In order to capture the vibrations generated by the knock, a piezoelectric membrane is used. This membrane has one contact on each side with a piezoelectric PZT ceramic plate in between. The diameter of the sensor is 25 mm in the front side contact, and the diameter of the piezoelectric material is 17 mm. The piezoelectric membrane thickness is 0.2 mm. The resonance frequency of this sensor is 4.6 kHz, with a maximum resonance impedance of 300 Ω. This piezoelectric membrane is connected as shown in Figure 5, so the signal is first amplified with a PGA and later is digitalized using a DeltaSigma ADC. In order to have a correct acquisition, it is important to avoid dissipation of vibration within the housing of the membrane, so the backside should be firmly adhered to the prototype case. 2.3.3. The Final Prototype For the final prototype, a housing case was designed in order to have a compact device. The housing has been fabricated using 3D printing and has two separated compartments, one for the electronics and the other one for the solenoid for better encapsulation and mechanical mounting of the components. In Figure 7, a picture of the complete prototype in this housing case is shown, as well as an illustration of its positioning for measurement. It must be noted that, as deduced from the tests carried out, the exact position of the instrument does not noticeably influence the measurement results, while calibration for specific positions in the case of complex geometries is always possible. Figure 7. The complete prototype mounted in the case and position used for measurement. Shield Solenoid Piezoelectric PSoC 5LP Figure 6. Schematic of the solenoid driver circuit. 2.3.2. The Sound Subsystem In order to capture the vibrations generated by the knock, a piezoelectric membrane is used. This membrane has one contact on each side with a piezoelectric PZT ceramic plate in between. The diameter of the sensor is 25 mm in the front side contact, and the diameter of the piezoelectric material is 17 mm. The piezoelectric membrane thickness is 0.2 mm. The resonance frequency of this sensor is 4.6 kHz, with a maximum resonance impedance of 300 Ω . This piezoelectric membrane is connected as shown in Figure 5, so the signal is first amplified with a PGA and later is digitalized using a Delta-Sigma ADC. In order to have a correct acquisition, it is important to avoid dissipation of vibration within the housing of the membrane, so the backside should be firmly adhered to the prototype case. 2.3.3. The Final Prototype For the final prototype, a housing case was designed in order to have a compact device. The housing has been fabricated using 3D printing and has two separated compartments, one for the electronics and the other one for the solenoid for better encapsulation and mechanical mounting of the components. In Figure 7, a picture of the complete prototype in this housing case is shown, as well as an illustration of its positioning for measurement. It must be noted that, as deduced from the tests carried out, the exact position of the instrument does not noticeably influence the measurement results, while calibration for specific positions in the case of complex geometries is always possible. Electronics 2018, 7, x FOR PEER REVIEW 6 of 14 Figure 6. Schematic of the solenoid driver circuit. 2.3.2. The Sound Subsystem In order to capture the vibrations generated by the knock, a piezoelectric membrane is used. This membrane has one contact on each side with a piezoelectric PZT ceramic plate in between. The diameter of the sensor is 25 mm in the front side contact, and the diameter of the piezoelectric material is 17 mm. The piezoelectric membrane thickness is 0.2 mm. The resonance frequency of this sensor is 4.6 kHz, with a maximum resonance impedance of 300 Ω. This piezoelectric membrane is connected as shown in Figure 5, so the signal is first amplified with a PGA and later is digitalized using a DeltaSigma ADC. In order to have a correct acquisition, it is important to avoid dissipation of vibration within the housing of the membrane, so the backside should be firmly adhered to the prototype case. 2.3.3. The Final Prototype For the final prototype, a housing case was designed in order to have a compact device. The housing has been fabricated using 3D printing and has two separated compartments, one for the electronics and the other one for the solenoid for better encapsulation and mechanical mounting of the components. In Figure 7, a picture of the complete prototype in this housing case is shown, as well as an illustration of its positioning for measurement. It must be noted that, as deduced from the tests carried out, the exact position of the instrument does not noticeably influence the measurement results, while calibration for specific positions in the case of complex geometries is always possible. Figure 7. The complete prototype mounted in the case and position used for measurement. Shield Solenoid Piezoelectric PSoC 5LP Figure 7. The complete prototype mounted in the case and position used for measurement. Electronics 2018,7, 378 7 of 14 2.4. Mobile APP and MATLAB GUI As detailed above, the device allows for autonomous measuring of the level of the tank, sending the captured signal to an external device that acts as user interface. In order to use this functionality, two different applications have been developed: An Android application and a MATLAB-based GUI (graphical user interface). The MATLAB GUI allows interacting with the device via Bluetooth, making it possible to change the number of samples captured by the device and to control the operation of the device. Once the data is transmitted, the GUI shows the level of filling according to the tank model. It also shows the acquired signal, the FFT, and the model that was used. The general appearance of this GUI is illustrated in Figure 8. Electronics 2018, 7, x FOR PEER REVIEW 7 of 14 2.4. Mobile APP and MATLAB GUI As detailed above, the device allows for autonomous measuring of the level of the tank, sending the captured signal to an external device that acts as user interface. In order to use this functionality, two different applications have been developed: An Android application and a MATLAB-based GUI (graphical user interface). The MATLAB GUI allows interacting with the device via Bluetooth, making it possible to change the number of samples captured by the device and to control the operation of the device. Once the data is transmitted, the GUI shows the level of filling according to the tank model. It also shows the acquired signal, the FFT, and the model that was used. The general appearance of this GUI is illustrated in Figure 8. Figure 8. The MATLAB graphical user interface (GUI). The availability of Bluetooth allows mobile devices to control and read data from the device, so an application for Android has also been created. Thanks to this, the device can be used with smartphones, tablets or smartwatches. For this purpose, a Samsung Galaxy J7 smartphone has been used. It runs Android 7.0, and includes a 5.5″ screen with 720 × 1280-pixel resolution. The application is based in the BluetoothChat example [21]. The main functionality of the application is to capture, analyze and display the signal received from the prototype. Moreover, it also includes some additional control functionalities, such as: • Defining the number of samples; • setting the triggering time for the solenoid; • microphone calibration for offset suppression; • configuration of the PGA gain. Although the application cannot create a model for different tanks, it is able to save the raw data of the acquisition in a text file, so the data can be transferred to a computer to calculate the new model for later integrating it in the application. An example of the appearance of this application can be seen in Figure 9. Figure 8. The MATLAB graphical user interface (GUI). The availability of Bluetooth allows mobile devices to control and read data from the device, so an application for Android has also been created. Thanks to this, the device can be used with smartphones, tablets or smartwatches. For this purpose, a Samsung Galaxy J7 smartphone has been used. It runs Android 7.0, and includes a 5.5” screen with 720 × 1280-pixel resolution. The application is based in the BluetoothChat example [ 21 ]. The main functionality of the application is to capture, analyze and display the signal received from the prototype. Moreover, it also includes some additional control functionalities, such as: •Defining the number of samples; •setting the triggering time for the solenoid; •microphone calibration for offset suppression; •configuration of the PGA gain. Although the application cannot create a model for different tanks, it is able to save the raw data of the acquisition in a text file, so the data can be transferred to a computer to calculate the new model for later integrating it in the application. An example of the appearance of this application can be seen in Figure 9. Electronics 2018,7, 378 8 of 14 Electronics 2018, 7, x FOR PEER REVIEW 8 of 14 Figure 9. Real use-case of the Android application. 3. Results In order to initially test the system, an 8.5-L enameled steel tank was used. As discussed above, the tank needs to be modeled before any proper measurement, so a calibration process was carried out with measurements at different controlled fill levels. These measurements allow for deriving of the tank model, relating resonance frequency and volume. 3.1. Calibration For the calibration process, a commercial audio amplifier [22] and the piezoelectric sensor in the prototype were used for sound acquisition. This commercial audio amplifier was used for validating the data obtained with the reconfigurable prototype and the piezoelectric sensor. Thus, the model derived from this calibration process was later integrated into the prototype. The calibration has been carried out by taking measurements from empty to full with 250 mL steps and following the frequency shift of the higher peak found in the spectrum, which was also found to be the one with more noticeable frequency variations. The results gave resonant frequencies between 615 Hz and 350 Hz. Figure 10 shows examples of how the system responds in four different cases. With the results of the different levels, a curve fitting process has been used to obtain the model. Concretely, a four-order polynomic equation was obtained:  󰇛󰇜= 0.0015 0.6757 2.981 5.9832  616.302 (1) where  is the volume of liquid expressed in liters and 󰇛󰇜 is the resonance frequency expressed in Hz. Figure 11 shows the obtained model compared to the measurements, so it can be observed how the tank model fits the real measurements. It must be noted again that this model directly correlates frequency and liquid volume, so the proposed method is more sophisticated than the simple measurement of the height of the fluid in the tank, which is usually the case for most sensors [4–7]. Figure 9. Real use-case of the Android application. 3. Results In order to initially test the system, an 8.5-L enameled steel tank was used. As discussed above, the tank needs to be modeled before any proper measurement, so a calibration process was carried out with measurements at different controlled fill levels. These measurements allow for deriving of the tank model, relating resonance frequency and volume. 3.1. Calibration For the calibration process, a commercial audio amplifier [ 22 ] and the piezoelectric sensor in the prototype were used for sound acquisition. This commercial audio amplifier was used for validating the data obtained with the reconfigurable prototype and the piezoelectric sensor. Thus, the model derived from this calibration process was later integrated into the prototype. The calibration has been carried out by taking measurements from empty to full with 250 mL steps and following the frequency shift of the higher peak found in the spectrum, which was also found to be the one with more noticeable frequency variations. The results gave resonant frequencies between 615 Hz and 350 Hz. Figure 10 shows examples of how the system responds in four different cases. With the results of the different levels, a curve fitting process has been used to obtain the model. Concretely, a four-order polynomic equation was obtained: f(υ)=−0.0015υ4−0.6757υ3+2.981υ2−5.9832υ+616.302 (1) where υ is the volume of liquid expressed in liters and f(υ) is the resonance frequency expressed in Hz. Figure 11 shows the obtained model compared to the measurements, so it can be observed how the tank model fits the real measurements. It must be noted again that this model directly correlates frequency and liquid volume, so the proposed method is more sophisticated than the simple measurement of the height of the fluid in the tank, which is usually the case for most sensors [4–7]. Electronics 2018,7, 378 9 of 14 Electronics 2018, 7, x FOR PEER REVIEW 9 of 14 Figure 10. Frequency spectrums examples. Figure 11. The model obtained from calibration vs. measured points. 3.2. Model Validation To validate the prototype and the previous calibration, different tests were carried out. The test process was to measure 5 consecutive times the level of the tank without changing the point of measure. This process was repeated with 13 different filling levels separated by 0.7 l all over the capacity of the tank. The results are depicted in Figure 12 and summarized in Table 1. Figure 10. Frequency spectrums examples. Electronics 2018, 7, x FOR PEER REVIEW 9 of 14 Figure 10. Frequency spectrums examples. Figure 11. The model obtained from calibration vs. measured points. 3.2. Model Validation To validate the prototype and the previous calibration, different tests were carried out. The test process was to measure 5 consecutive times the level of the tank without changing the point of measure. This process was repeated with 13 different filling levels separated by 0.7 l all over the capacity of the tank. The results are depicted in Figure 12 and summarized in Table 1. Figure 11. The model obtained from calibration vs. measured points. 3.2. Model Validation To validate the prototype and the previous calibration, different tests were carried out. The test process was to measure 5 consecutive times the level of the tank without changing the point of measure. This process was repeated with 13 different filling levels separated by 0.7 l all over the capacity of the tank. The results are depicted in Figure 12 and summarized in Table 1.