The Discrete Wavelet Transform and Its Application for Noise Removal in Localized Corrosion Measurements

The present work discusses the problem of induced external electrical noise as well as its removal from the electrical potential obtained from Scanning Vibrating Electrode Technique (SVET) in the pitting corrosion process of aluminum alloy A96061 in 3.5% NaCl. An accessible and efficient solution of this problem is presented with the use of virtual instrumentation (VI), embedded systems, and the discrete wavelet transform (DWT). The DWT is a computational algorithm for digital processing that allows obtaining electrical noise with Signal to Noise Ratio (SNR) superior to those obtained with Lock-In Amplifier equipment. The results show that DWT and the threshold method are efficient and powerful alternatives to carry out electrical measurements of potential signals from localized corrosion processes measured by SVET.


Introduction
Currently, VI offers novel and efficient alternatives in digital measurement and processing of electrical signals in corrosion studies, with significant benefits in the cost of VI systems, compared to the costs of traditional instrumentation, whose function is defined by the manufacturer and not by the end user, allowing the replacement of traditional measurement and control instruments with modern computerized instruments.
1.1.Electrode Scanning Techniques.The electrochemical electrode scanning techniques are represented by scanning reference and scanning vibrating reference electrode (SRET and SVET) [1], since SVET is the best SNR, if we compare the minimum measurement ranges for the SRET technique (that precedes the SVET), which are 200 V and are limited by the noise level of the signal [2,3].
In the SVET the displacement of the vibrating electrode is small, in the range of 1 to 100 m; this displacement provides a small ion flux corresponding to the electric potential at the tip of the electrode, in the order of microvolts [4].
Having electrical signals in the range of microvolts implies that these are vulnerable to electrical noise, which interferes considerably in the electrical signal making it strongly dependent on the SNR, such as the potential curve of the SVET.Under these conditions, measuring the potential difference with the vibrating electrode causes an uncertainty in the potential values of the electrical signal.

Sources of Electrical Noise.
There are two main types of noise sources in SVET system: internal noise and external noise.Internal noise is generated by the components of the system as a consequence of its properties and nature (thermal noise, ripple noise, and fluctuating noise).The internal noise of the electrochemical system appears in the solidliquid interface known as electrochemical noise (EN) whose sources are several types of fluctuations: fluctuation in the concentration of the species in the metal/electrolyte interface, fluctuation in surface morphology, fluctuation in electrode 2 International Journal of Corrosion activity, and fluctuation of activity on the electrode surface [5].
External noise is the main identified source of electrical noise also known as white or Gaussian noise which is considered as a disturbing variable to our measurement system.This comes from external electrical or magnetic sources that affect all the components of the electrical system including the electrochemical part, electrodes, wiring, and instrumentation.The interferences that are presented can be stationary, nonstationary, or random, where the main sources of electrical noise are the current of the conventional electrical line, fluorescent lamps, computers, and electric motors.

Virtual Instrumentation.
VI is an indispensable tool of great utility for the development of measurement and control instruments in the laboratory or field and its application of measurement and control of chemical and electrochemical systems applied to corrosion is not the exception [6][7][8].When talking about VI, we are referring to an instrument found in the hardware of a computer and an interface that allows the physical and functional connection between the VI and the system to be measured and controlled.VIs are recyclable and easily scaled, can be connected to the outside world, and have simple configuration and low cost per acquisition (measurement) channel.Currently VIs are programmable in embedded systems, with the main advantage that their functionality is defined by the end user; that is, we design them according to our needs unlike a traditional rigid instrument whose functionality is defined by the manufacturer and is designed to meet general or very specific needs.The background for VI development dates back to 1986 when National Instruments introduced the LabVIEW5 virtual instrumentation platform which was made to operate on MAC computers.
One of the main features of LabVIEW is the ease of use, valid for both professional programmers and people with little programming knowledge.LabVIEW is a graphical programming tool, meaning that programs are not written but drawn, facilitating their understanding.By having already predesigned a lot of programming blocks, it facilitates the programmer creating the project, allowing him to spend less time on programming.
1.4.Embedded Systems.Embedded systems are computers designed to have a specific function, unlike a general purpose computer which, as its name implies, is designed to perform general computing functions.The embedded systems have a great diversity of applications, some of daily use as the control of operation of a domestic appliance or being more complex as is the case of data acquisition and control in industry, aerospace, automotive, and so on.With an embedded system it is possible to carry out programmable measurement and control operations in real time.The main advantage of an embedded system is to do Digital Signal Processing (DSP) regardless of computer usage, making the embedded system a fully recyclable, portable, efficient, and economical VI with end-user defined functionality.
1.5.The Wavelet Transform.The wavelet transform (WT) has broad application in the analysis of stationary and nonstationary signals.These applications include the removal of electrical noise from the signals, detection of abrupt discontinuities, and compression of large amounts of data.The use of WT in corrosion studies is not the exception, as shown by the works published in the literature [9][10][11][12].
With the WT, it is possible to decompose a signal into a group of constituent signals, known as wavelets, each with a well defined, dominant frequency, similar to the Fourier transform (FT) in which the representation of a signal is by sine and cosine functions of unlimited duration.In WT, wavelets are transient functions of short duration, that is, limited duration centered around a specific time.The problem of the FT is that when passing from the time domain to the frequency domain the information of what happens in time is lost.Observing the frequency spectrum obtained using the FT is simple to distinguish the frequency content of the signal being analyzed but it is not possible to deduce in what time the components of the signal of the frequency spectrum appear or disappear.Unlike the FT, the WT allows an analysis in both time and frequency domains giving information on the evolution of the frequency content of a signal over time [13].
As in the case of FT, the WT has been discretized and is known as a discrete wavelet transform (DWT) and represents an important advantage over traditional FT methods.The WT decomposes a signal into several scales representing different frequency bands, and, at each scale, the position of the WT can be determined at the important time characteristic with which the electrical noise can be identified and effectively removed.Short-time wavelets allow information to be extracted from high-frequency components.This is important information to eliminate electrical noise since electrical noise is more likely to exhibit high-frequency fluctuations [14].Long-term wavelets allow you to extract information from low frequencies.With the information of the high and low frequencies, we can define a threshold and zero the frequencies below the undesired threshold of the electric noise [15].
The pioneering work of removing electrical noise from signals using the WT has its origin in the works of Donoho and Johnstone [16,17], which propose the use of a threshold for the removal of Gaussian white electrical noise in the signals.Similar works but with the use of the discrete wavelet transform undecimated (UWT) are given later allowing the removal of the electrical noise by a nonlinear method suggested by Coifman and Donoho [18].
The DWT is considered a suitable tool for the elimination of electric noise as a novel alternative that replaces procedures of attenuation of electrical noise with the use of low-pass filters of the systems Lock-In Amplifier or fast Fourier transform (FFT) that alone can be used in the circumstances in which the electrical noise has a very small overlap of bands or completely different and separated from the signal and the noise to be able to use the method of filtering, this being an important limitation in the moment of processing digitally signals not stationary whose content changes over time.1.6.Noise Attenuation Procedure with the DWT Using the Threshold Method.The threshold method is the most used method by the wavelet transform for the attenuation of electrical noise [19], in which the main theoretical basis is to determine, in the time and frequency domain, the coefficients of the signals that throughout the space concentrate the energy of the SVET signal as well as the coefficients and energy of the noise that is generally distributed in the time domain and the whole frequency whose energy is less than the energy of the SVET signal.
By decomposing the SVET signal with noise by the DWT, we find that the resulting WT coefficients of the SVET potential signal are larger than the wavelet coefficients of the noise signal; this identification of coefficients allows defining a threshold and making the coefficients below the threshold equal to zero, resulting in noise removal from the potential SVET signal.

Stages in Noise
Removal by the Threshold Method.Figure 1 shows a scheme for the general method of the threshold method for the removal of electrical noise.We show the three main stages, decomposition, threshold application, and reconstruction, as well as their respective substages.In LabVIEW the decomposition, threshold, and reconstruction are implicit in the Denoise function as follows: (i) Decomposition: it consists of determining the coefficients of the low and high frequencies and the level to which the threshold would be applied using the DWT of the SVET potential curve contaminated with white electric noise.In the Denoise function of LabVIEW, we can choose the mother wavelet and a level to decompose the potential signal.
(ii) Application of the threshold: subsequently, once the SVET potential signal coefficients have been determined, a threshold is chosen to eliminate all threshold values below the threshold.In the Denoise function we can choose between soft thresholding or hard thresholding, type of rescaling, and threshold rule.
(iii) Reconstruction: finally, after the threshold is applied and the noise is eliminated, the resulting coefficients, the level, and the wavelet used are part of the reconstruction.With the reconstruction, we finally obtain a signal of SVET potential free of electrical noise.
The objective of the present investigation is to obtain a potential SVET signal with a high SNR for aluminum alloy A96061 in contact with an aqueous solution of 3.5% NaCl.

Metals and Specimens.
In the experiment, samples of aluminum alloy A96061 protected with chromium conversion coating were used, applying chromium oxide as an anticorrosion pretreatment for aerospace applications.For the pitting corrosion formation process, the aluminum specimens were exposed in a saline mist chamber.The solution used in the fog chamber was 3.5% NaCl at 20 ∘ C; tests were carried out following the procedure recommended in standard ASTM B117.

System Employed.
Here are four main devices that integrate the configuration of the system utilized to determine and measure the potential signal with the SVET.The first one is a homemade SVET device that utilized a vibrating microelectrode with 10 to 20 m spherical platinum black tip and vibrated with 20 m amplitude at an average distance of 100 m above the surface of the sample, with a vibration frequency of 60 Hz.
The second one is a mighty scope near infrared 10x-200x 5.0 MP video inspection system, Color CMOS, 6-LED light microscope operating at 850 nm, and USB 2.0 infrared digital microscope with a homemade lineal stage focus controlling mechanism in the range from 8.5 mm to 112 mm, with stepper motor NPM PF35-24CL.
The third one is homemade SVET device with  stages, stepper motors VEXTA model PX245M-01, and a gain controlled instrumentation amplifier with high input impedance (1013 Ω/100 fA).
The fourth one is an embedded data acquisition FPGA (Field Programmable Gate Array) NI RIO NI myRIO with a dual-core Xilinx Z-7010 processor, 667 MHz processing speed 256 MB nonvolatile memory, and USB ports.This includes a 12-bit CAD and a sample rate of 500 kS/s connected to a computer whose main function is to display the results and store the information as well as to execute the virtual instrument that controls the SVET systems and computational vision of the optical preanalysis of the specimen under study.It is important to clarify that the data acquisition system employed has a dual-core processor and a FPAG array of components allowing the VI program to run on the NI

Method.
The pitting found in aluminum A96061 surface after being exposed to the saline fog is preanalyzed and identified optically using a virtual computer vision instrument developed in the laboratory and VI Localized Corrosion Image Analyzer (LCIA).The LCIA determines the location of pits in Cartesian coordinates.Subsequently, the coordinates are sent by electronic file to a workstation for electrochemical scanning that operates with the SVET.With the application of LCIA an effective sweep is made, only in the bites identified by computational vision, saving a considerable time of scanning.
The exploration of the pits that appear after the fog chamber test in 3.5% NaCl previously detected by the computer vision system was validated with the use of SVET.
VI employed in electrical noise attenuation includes the digitization of the potential signal obtained by SVET under background noise testing and the application of the Denoise and digital filter design functions of LabVIEW to the testing signal, to suppress the background noise.

Results
The localized corrosion pits were generated under saline fog conditions, the procedure recommended in the ASTM standard B117, the SVET technique, the application of the DWT, digital filtering implemented, in an embedded FPGA myRIO system, and the use of a VI for the optical preprocessing of specimens with localized corrosion.
Figure 3 shows images of the optical preprocessing.(a) corresponds to the digitized image of the observed specimen and (b) shows the preoptical processing.The red, green, blue, and yellow colors indicate possible stings.
The SVET potential curve with respect to the distance shown in Figure 4 corresponds to the bite identified with the green color in the optical preprocessing of Figure 2. The result of the measurement is an electrical signal immersed in noise.In the potential curve of Figure 3, a SNR of 9.03 dB was measured.
By digitally processing the VI potential signal, the discrete wavelet transform, and the LabVIEW Denoise function implemented in an embedded FPGA myRIO system, a potential curve with a measured SNR of 178.56 dB was obtained.Figure 5 shows the potential amplitude SVET with respect to the distance of the potential curve digitally processed with the DWT.The parameters used were a Daubechies (db02), Level 15, threshold method, and soft thresholding wavelet.
By digitally processing the potential signal with the Lab-VIEW digital filter design (DFD) functions implemented in the embedded FPGA myRIO system, the resulting potential curve with the use of DFD is shown in Figure 6 presenting a SNR of 38.59 dB.For the SVET anode potential curve in Figure 3, the digital filter used to obtain these results is a Dolph-Chebyshev Window low-pass type FIR filter.

Discussion
The results were obtained by comparing two VIs implemented in an embedded data acquisition system FPGA myRIO.The first one uses the Wavelet Denoise function of the advanced signal processing toolkit and the second with the tools and functions for LabVIEW digital filter design.In addition, information on preprocessing is presented as an alternative preanalysis method for A96061 aluminum specimens.
With the preoptical processing it is possible to detect in real time potential pitting and Cartesian coordinates of the pitting, in order to perform a sweep only in the incipient bites.The immediate benefit of this procedure is a reduction of scanning time with the SVET technique.Figure 4 shows a SVET potential curve immersed in electrical noise making it impossible to measure the electrical potential due to corrosion without the application of noise suppression.
The graphs of Figures 5 and 6 and Table 1 demonstrate the electrical noise attenuation with the DWT and digital filtering as well as a summary of the electrical measurements made by SVET, respectively.
It is evident that DTW increases significantly the SNR to 178.56 dB corresponding to a noise removal of 169.53 dB compared to 9.03 dB of the SVET potential at the electrode tip, shown in Figure 4.
Using a digital filter, a SNR of 38.59 dB was achieved, representing an electrical noise attenuation of 31.3 dB, with a significant reduction in the amplitude of the potential and a displacement in the location distance of the potential peak of the bite of 100 m regarding the time of the potential waveform, and it is due mainly to the transient response characteristics or filters instability zone.
The use of embedded systems presents an important advantage in the implementation of virtual instrumentation which makes it possible to develop portable instruments of specific function, recyclable and scalable for studies of localized corrosion.
If we compare the obtained results of the DTW, we find a noise removal 169.53 dB higher than that provided by the digital filtering of 31.31dB.On the other hand, with the DWT the peak of the anodic potential waveform of the pit in its original position of 481 micrometers is maintained which does not happen if we use digital filtering.

Conclusions
VI implemented in an embedded system was developed with application in the electrical potential measurement and electric noise removal in SVET results.VI and embedded systems are recyclable, scalable, and end-user-defined for specific applications and are an alternative to traditional electrochemical measurements.
It was experimentally verified that the DWT and the threshold method are efficient and powerful alternatives to carry out electrical measurements of potential signals from localized corrosion processes measured by SVET.The application of the functions for the DWT can effectively remove electrical noise with a SNR of 169.53 dB or higher.

Figure 3 :
Figure 3: Identification of potential pitting by computational vision: (a) digitized image; (b) preprocessing of colors red, green, blue, and yellow identifying potential stings.

Table 1 :
Results of measurement and noise attenuation with wavelet transform and digital filtering.