# IoT System for Detecting the Condition of Rotating Machines Based on Acoustic Signals
## 2 Condition Detection Algorithm
### FASTER Algorithm  
The algorithm for state detection of rotary machines using acoustical signals (FASTER algorithm) is designed to run on an IoT device which consists of commercially available CPU, such as Raspberry Pi. It is based on combination of DWT for feature extraction and NN for classification, as suggested in [19]. However, since it needs to operate in real time on acoustic signals, which are at least a couple of minutes long and usually quite noisy, some additional steps need to be conducted. The entire algorithm is given in Figure 3 and parameters/hyperparameters used to adjust the algorithm for specific rotary machine are indicated.  
Figure 3: FASTER algorithm block diagram.  
The steps in the procedure are given as follows.  
(1) Acoustic signal acquisition: The recording of the acoustic signal is obtained using an inexpensive commercially available microphone attached to the platform described in the next section. The length of the recording should be significantly longer than the length of an analyzed audio signal (_L_). Experimental results indicate that it should not be shorter than 5 min.  
(2) Preprocessing: In this step, the recorded signal is divided into segments that have a uniform design. Therefore, the extracted features will be comparable between several recordings of different lengths. The recorded signal is windowed into smaller segments of \(L\) seconds, and the shift between two consecutive windows is \(d\) seconds. In this way, one long recording is divided into several shorter ones, which are separately analyzed. In this step, the amplitude normalization is performed as well as decimation in which the original sampling frequency is reduced to the new sampling frequency _F_s.  
(3) Feature extraction: DWT is performed on each segment from the previous step. The number of levels of DWT transform is adjusted with hyperparameter _dwt_lvl_, and it should be chosen to the obtained frequency bands corresponding to the machine's rotational frequencies characteristics. After performing DWT in this way, _dwt_lvl+1_ different coefficients are obtained. The features are powers of these coefficients, so each segment of the length \(L\) has a total of _dwt_lvl+1_ features, which depend on the frequency characteristics of the signals.  
(4) Classification: Neural networks are used for classification. There are _dwt_lvl+1_ inputs (features from the previous step) and 1 output. The output of the classifier is the decision on the state of the rotary machine, and it is a number between 1 and 4. If the output is equal to 1, it means that machine parts are healthy. The output of 2 indicates that the machine begins to wear, without a significant effect on the performance. The output equal to 3 means that the machine parts are starting to wear noticeably, but the machine still operates properly. Output equal to 4 signifies that the performance of the machine is starting to suffer, and it is necessary to perform maintenance and replace worn parts of the machine. The complexity of the neural network is described with the vector hyperparameter _nn_layers_. The number of vector elements determines the number of hidden layers of the network, and each element represents the number of nodes in the appropriate layer. Since it is assumed that the NN is already trained, for the classifier to be able to function properly, the information about network coefficients is provided with the parameter _nn_coefficients._  
The performance of the proposed condition detection algorithm depicted in Figure 3 is dependent on the described hyperparameters (_L_, \(d\), _Fs_, _dwt_lvl_, _nn_layers_) as well as the parameters of an already trained NN (_nn_coefficients_). The training procedure as well as the choice of hyperparameters is conducted separately when a sufficient number of recordings is acquired.