**1. Introduction**

Predictive maintenance is a recent technique, the result of the evolution of maintenance techniques over the years. Initially, the most commonly used maintenance systems were corrective. These systems carry out the relevant actions once the failure has occurred. With this approach, it may happen that the repair has to be postponed instead of being repaired on the spot due to a lack of readiness. Preventive maintenance, where maintenance activities are scheduled at periodic intervals to prevent component degradation, was introduced in the 1950s. However, as in the previous case, costs remain very high.

Given the growing demand for more reliable, safe and efficient industrial systems, the need to optimize these maintenance processes becomes evident. In the 1980s, some factories began to apply predictive maintenance techniques. They used sensors that continuously monitored the machines and sent alerts when predefined limits were exceeded. This significantly reduced scheduled maintenance activities and their associated costs. Currently, the use of large databases combined with machine learning techniques makes it possible to predict what is going to happen, when it is going to happen, and to alert the person in charge (Industrial Internet of Things, IIoT) [1,2]. In this way, a "just-in-time" maintenance that allows maximizing economic and productive performance is achieved. For this reason, as

**Citation:** Gascón, A.; Casas, R.; Buldain, D.; Marco, Á. Providing Fault Detection from Sensor Data in Complex Machines That Build the Smart City. *Sensors* **2022**, *22*, 586. https://doi.org/10.3390/s22020586

Academic Editors: Suparna De and Klaus Moessner

Received: 15 December 2021 Accepted: 11 January 2022 Published: 13 January 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

shown in Figure 1, predictive maintenance applications are having a grea<sup>t</sup> boom in the market, expecting, according to a PWC survey, a 3.6% reduction of the annual costs during 2020.

**Figure 1.** Annual cost reduction due to the incorporation of predictive maintenance techniques [1].

Predictive maintenance requires a grea<sup>t</sup> deal of dedication prior to installation. The problems and their causes must be identified in order to subsequently define and develop the monitoring system. This preliminary process could be structured in the following phases:


In industrial environments, the most relevant machines that can be found most frequently are electric motors [3,4]. Within them, the elements that concentrate the highest number of failures are the rotating elements and the transmission mechanisms due to their fatigue wear. Figure 2 shows the result of an ABB study on the critical elements and the most common causes of failure in induction electric motors.

Once the critical machines, the elements that fail most frequently and the possible causes have been identified, the subsequent phases are carried out.

**Figure 2.** Representation of the critical elements of induction motors and their main causes of failure [3].

In contrast to the simple sensors and actuators that make up a large part of the common Internet of Things (IoT) scenarios in the smart city [5], there is an increasing number of applications that are made up of what we may call complex machines.

As illustrated in Figure 3, we define complex machine as a device that:


Some examples of complex machines in the smart city are: household appliances, climate control machines, vehicles, elevators, cash counting machines, etc.

Technically both production lines and complex machines are made up by a network of controllers that integrate sensors and actuators. There are many works proposing predictive maintenance strategies in production lines [6] or industrial equipment [7,8]. These approaches gather all the data together in edge/fog devices [9] or in the cloud [10] and centrally analyzes them. In complex machines, this is not possible due to memory and computation restrictions of controllers and also to industrial bus bandwidth limitations.

Currently, there are different predictive maintenance strategies depending on whether they focus on physical aspects (physical model-based), on aspects of knowledge of the machine itself (knowledge-based), or if they are based on the use of large quantities data, pattern recognition, statistics, etc. (data-driven). This article proposes a fault detection methodology applicable to complex machines, trying to apply hybrid methodologies that combine the advantages of each strategy, adjusting them to the needs of complex machines. For this reason, special attention needs to be paid to preprocessing, seeking to minimize the number of data to be sent, so that malfunctions can be detected with the least amount of data possible. In this way, this strategy can be applied to machines with limited memory capacities, data transmission, etc.

**Figure 3.** Block diagram of an example of a complex machine, green lines indicate energy flow, and blue lines indicate the data transmission to the cloud.

This paper is organized as follows. Section 2 presents the data processing methodology and its three different levels indicating the process applied in each case: sensor level—variable targeting, board level—embedded data curation and feature extraction, and machine level—feature integration and pattern finding. Then, Section 3 illustrates the testbench used to verify the system proposed and analyzes the results obtained on each layer. Finally, Section 4 provides conclusions.

### **2. Materials and Methods**

### *2.1. Data Processing Methodology*

A methodology for data processing consisting of three parts or levels will be proposed. The first level, called the sensor level, focuses on taking measurements using various types of sensors. The second level or board level, starts with the data obtained in the sensor level to carry out a processing that allows reducing the amount of data to be transmitted and extracting as much information as possible from them. The last level or machine level seeks to perform an analysis of the data of the board level in order to extract some results. In Figure 4, you can see the scheme of the proposed methodology.

**Figure 4.** Scheme of the proposed methodology for data analysis.

2.1.1. Sensor Level—Variable Targeting

The variables to be monitored in this type of application can be grouped into the following groups: mechanical, electrical, audio, temperature and pressure [3].

The analysis of **mechanical variables** and specifically the analysis of vibrations are the most common. Depending on the frequency range of the vibrations to be measured, position sensors (0–10 kHz), speed sensors (10 Hz–1 kHz) or accelerometers (8 Hz–15 kHz) can be used [2]. However, the use of accelerometers is the most common, as has been seen in the vast majority of the articles consulted [11–19]. This type of analysis presents good results, since the most common faults always generate additional vibrations to those of the engine in normal operation. Thus, through its analysis, inappropriate behavior and even the type of failure can be identified [19].

Another common approach is the analysis of **electrical variables** [4,11,13–15,20–22]. In them, the values of the stator's motor currents and voltages are mainly monitored. The use of these variables is based on the fact that the consumptions of a damaged machine present variations compared to those of a "healthy" machine. In addition, the use of these measures has advantages, such as the possibility of measuring without having to access the interior of the motor, reducing the risk of damaging fragile parts and facilitating the installation of the sensors. On the other hand, it requires a grea<sup>t</sup> knowledge of the normal behavior of the machine and the different harmonics it presents due to construction characteristics or load variations. In addition, this knowledge of healthy functioning must be updated over time. Thus, applying techniques such as motor current signature analysis (MCSA), it is possible to detect anything from electrical failures, such as short circuits in the stator, to mechanical failures, such as eccentricities or rotor bar breaks [4].

In [2,23], **audio measurements** are used to detect bearing failures through the use of microphones. These types of measures are not so well-established, although they are gaining presence, as shown in [2]. The main cause is the contamination to which the audio signals are exposed in an industrial environment, requiring the use of techniques for their elimination. However, the possibility of obtaining them using microphones pointing towards the machine from the outside at between 2 and 10 cm is a clear advantage compared to vibration measurements [2].

These are the most commonly used types of measurements. However, others appear as complementary measures, such as **temperature measurements** [13–15,17,21] or **pressure measurements** [21], which are being used in very specific cases. A temperature increase makes possible to detect electrical and mechanical failures, since in the event of excessive friction or high electrical currents the elements tend to overheat. In addition, these types of measurements do not require complex processing, and faults can be detected by simply observing their values. Pressure measurements, for example, can be of grea<sup>t</sup> importance in the analysis of the motor of an air compressor (Air Booster Compressor).

### 2.1.2. Board Level—Embedded Data Curation and Feature Extraction

Each board has a smart controller that might have wide variety of computational and memory resources; from 8-bit microcontroller to an FPGA (Field Programmable Gate Array). To extract the most relevant characteristics and reduce the volume of data used, it is necessary to perform raw data filtering or pre-processing. In the case of predictive maintenance systems, preprocessing methods can be separated into three major groups according to whether they are, in the time domain [13,14,20–22], in the frequency domain [4,11,15–17,19,23] or in the time-frequency domain [12,18].

In the **temporal domain**, an attempt is made to reduce the number of data by filtering outliers and erroneous data [14,21]. Normalization [13,21,22] becomes relevant due to the use of various variables (mechanical, electrical, temperatures, pressures, etc.) that can take values on different scales. Once the data have been adjusted, they can be used as they are [21,22], or other indicators can be extracted from the parameters. In this second case, statistical indicators (such as maximum, minimum, mean, median, standard deviation, variance, gradients, kurtosis, skewness or crest factor [14,24]) or of another type (such as the principal components [13]) can be used.

On the other hand, in the **frequency domain**, the vast majority of cases use the fast Fourier transform (FFT) as an analysis method [4,15–17,19,23]. It provides useful information through the detection of the signal's frequency peaks and the detection of harmonics. This analysis is mainly applied when making vibration or sound wave measurements. The virtue of the FFT is that it allows decomposing a signal into individual periodic signals and establishing the relative intensity of each component, as can be seen in Figure 5. In this way, it is very easy to identify the faults, corresponding to peaks at unusual frequencies. In addition, it is a technique included in many electronic devices.

The FFT requires that the sampled signal contains a complete representation of the signal to be processed in the time domain or a periodic repetition. In cases where a complete cycle of the signal to be modulated is not captured, techniques such as the Hanning window are applied on the signal to mitigate possible reconstruction errors [16] (Figure 6).

**Figure 6.** Representation of the Hanning window effect.

Finally, techniques in the **time-frequency domain** [12,18] provide a more realistic description of the state of the machine. The main advantage they provide is that they are capable of managing both stationary and non-stationary signals (limitation presented by the FFT). The most popular for vibration analysis in rotating machines is the wavelet transform (WT) [12].

This technique starts from an orthonormal wavelet located in time that multiplies the signal. It can be applied at different times and with different scales to analyze the high and low frequency components of the signal at different points. The signal is decomposed into the approximation and detail coefficients, allowing the identification of the different frequency contributions over time. An example can be seen in Figures 7 and 8.

There are also other techniques such as the Short-Time Fourier Transform, STFT [18], which consists of dividing the signal into small time windows on which the Fourier transform is applied. In this way, it is possible to know the part of the signal in which each frequency appears, but it has a lower resolution than the WT.

In the case of audio signals, an additional preprocessing would be necessary to carry out the separation of the audio signal from the ambient noise. Some of the techniques used are BSS (Blind Source Separation) or TDSEP (Temporal Decorrelation source SEParation), which allow isolating a mixture of sounds from a specific process in real time [26].

**Figure 8.** Coefficients of approximation and detail obtained by means of the WT of the signal displayed with a Symlets wavelet.

2.1.3. Machine Level—Feature Integration and Pattern Finding

Once all the desired indicators have been extracted, in order to make sense of these data, it is necessary to analyze them together in what will be called the machine level. This processing would consist of the procedure for identifying possible failures. Techniques for the detection and identification of failure mechanisms are based on pattern recognition. These can be applied following complex strategies, such as the use of neural networks and machine learning [11,13,14,18,20–23], or through simpler methods, such as the use of fuzzy logic [15,16] or visual analysis by specialist personnel [17].

**Artificial neural networks** (ANN) are very convenient for this type of task, as they are able to work with a large amount of data and manage non-linearity situations with a short response time [20]. However, actual failure data are scarce, and forced failure data acquisition can be expensive. Even so, supervised learning methods are commonly used [13,18,20–23], although a predictive maintenance implementation could be initiated with unsupervised or semi-supervised learning (with labeled and unlabeled data) [14].

Finally, **simpler techniques** such as fuzzy logic are also applied. In [15,16], a classification of the data is carried out based on the ranges in which they are found, using fuzzy classifiers (good, normal, bad...). This allows a greater interpretability, something that can be tricky with neural networks. However, this apparent simplicity presents a key point that can become a bottleneck, the definition of the ranges, which requires a grea<sup>t</sup> knowledge of the situation to be treated. Furthermore, since it has no learning capability, it is often used in combination with neural networks, generating the so-called neural fuzzy systems (NFS) [27].

Once the results of the machine level processing have been obtained, the data can be sent to the cloud in order to perform a normality model that considers a large amount of data from different machines. Thus, while in the machines, the neural networks have patterns at the local level, in the cloud, the patterns are at a global level, which allows a greater abstraction.

A complete example of a complex machine with the different layers can be seen represented in the diagram in Figure 9: in yellow, the lowest layer would be that of the sensor level; in orange, encompassing the previous one would be the board level; and finally, in red, encompassing the previous two, is the machine level.

**Figure 9.** Diagram of an example of a complex machine with layer differentiation (Yellow, sensor level; orange, board level; red, machine level).

In this example, it can be seen how the first three boards (energy management, microcontrollers and FPGAs with actuators) communicate with a fourth, which is differentiated by the ability to communicate with the outside. Said communication can be both, with the user (Human Machine Interface) and with another computational element, proposed

in the example through an IP bridge. This board also has processing capacity, along with large RAM and FLASH memories, so that it can be in charge of analyzing the results obtained. In this way, this fourth board is in charge of receiving possible orders from the user, performing an analysis of the data received from other boards and sending the data to a downstream processing unit (in the cloud in the proposed example).

### **3. Results and Discussion**

*3.1. Testbench Definition*

The machine on which this methodology will be applied is a machine designed to count banknotes that will be used mainly in bank branches to be able to count cash and make deposits safely (Figure 10).

**Figure 10.** Image of the prototype used to test the methodology.

The complex machine is made up of a main board and three secondary boards: energy board, engines board and energy board (Figure 11), and the variables that are going to be monitored are shown in Table 1:

**Figure 11.** Scheme of application of the methodology to the specific case.


**Table 1.** Summary of the variables monitored.

The tests will consist of passing bundles of 50 banknotes of the same denomination (5 €, 10 €, 20 € and 50 €) through the machine. In addition, each bundle will pass through the machine four times, placing all the banknotes in every possible orientation: front, back, reverse front, and reverse back (Figure 12). This results in 16 samples for each tested case, making a total of 800 banknotes analyzed per case.

**Figure 12.** Disposition of a €50 banknote in the different orientations analyzed.

Regarding the failures analyzed, 13 defects (Table 2) were forced into the machine through variations in eccentricities in axles (4) and wheels (3), use of defective components such as springs (2), dented bearings (2), and deteriorated pulleys and worn belts (2):

This means that the whole dataset consists of 11,200 banknotes records. The proposed strategy will focus on detecting failures that could be called permanent, this means that they will appear throughout all the data collection and not sporadically, something that could also happen under real operating conditions.


**Table 2.** Summary of the tested cases.
