# A Low-Cost, Small-Size, and Bluetooth-Connected Module to Detect Faults in Rolling Bearings
## 2 Evaluation of the Frequency Spectrum
### Optimized Discrete Fast Fourier Transform  
As far as the detection of faulty bearing is concerned, the amplitudes of the frequency spectrum should be evaluated to verify their values at the defect fundamental frequencies, eventually. In order for the signal processing to be performed on-board, an efficient and accurate algorithm is required. The most famous and popular one is the Discrete Fast Fourier Transform (DFFT) algorithm [25], where the \(N_{s}\) elements of the input sequence \(X[n]\) are multiplied by constants, the so-called twiddle factors, and summed together in the consecutive stages of the algorithm. If the length of the inputsequence \(N_{s}\) is a power of 2, then the resulting complexity is \(O(N_{s}log(N_{s}))\). The required operations are sums and multiplications, which are highly optimized for both integers and floating data in modern microcontroller architectures, and the computation of the twiddle factors, where sine and cosine functions are required. Such twiddle factors can be evaluated only once and then stored in a buffer, as their values only depends on \(N_{s}\). Even though more performing algorithm exists in terms of required operations, e.g., the Fast Hartley Transform (FHT), the radix-2 DEFT was exploited in what follows since it requires the lowest data memory [26], which is an important aspect in a limited-resources design. As far as the detection of bearing faults is concerned, the input sequence (\(X[n]\)) is the readout of analog sensors, thus its imaginary part is always zero. As a consequence, symmetry properties can be exploited to reduce the amount of required operations, resulting an optimized DEFT for real data [27]. As the fault assessment is based on the amplitudes of the spectrum at given frequencies, the evaluation of such frequency spectrum must be reliable. However, the spectral leakage phenomenon, which occurs when the sampling frequency, is not an integer number of the populated frequencies, may result in an underestimation, up to 3 dB, of some spectral components [28]. In a such a case, a faulty bearing may be detected as a healthy one, resulting in a false negative. To address this issue, the input sequence (\(X[n]\)) can be multiplied by a proper windowing function, so that \(X[n]\) smoothly reaches zero at its boundaries and the spectral leakage phenomenon is strongly reduced. Different windows, e.g., top flat, Hann-2, Hann-4, or Blackman, may serve this scope. Aiming to perform such computations on board, the required steps are reported in Figure 1, where the encircled numbers refer to the step number and where the data array at the input of the i-th step is named \(X_{i-1}\). A detail description of each step is reported in what follows. * _Step 1_ The windowing function, which was previously evaluated for the \(N_{s}\) samples and stored in the \(K_{window}[n]\) array, is multiplied by the input sequence \(X_{0}[n]\) of the sampled data, resulting in the \(X_{1}[n]\) output array. \[X_{1}[n]=X_{0}[n]\cdot K_{window}[n]\] (5)
* _Step 2_ The even components of \(X_{1}[n]\) are placed in the real part of \(X_{2}[n]\), and the odd ones in the imaginary part, so that \(X_{2}[m]\) is a complex data array of length \(N_{s}/2\). \[\mathsf{Re}(X_{2}[m])=X_{1}[2n],\mathsf{Im}(X_{2}[m])=X_{1}[2n+1],\quad n=0, \ldots,N_{s}/2\] (6)
* _Step 3_ The standard Cooley-Tukey radix-2 transform [25] is evaluated on the basis of the \(X_{2}[m]\) array, resulting in \(X_{3}[m]\). It is worth noticing that the length of the input sequence is \(N_{s}/2\), which is one only half of the original input sequence (\(X_{0}[n]\)). * _Step 4_ Real and imaginary parts have to be recombined together to reconstruct the \(N_{s}/2+1\) samples of the positive frequency spectrum as \[Re(X_{4}[k]) = A_{r}[k]Re(X_{3})[k]-A_{i}[k]Im(X_{3})[k]+B_{r}[k]Re(X_{3})[N-k]+ B_{i}[k]Im(X_{3})[N-k]\] (7) \[Im(X_{4}[k]) = A_{r}[k]Im(X_{3})[k]+A_{i}[k]Re(X_{3})[k]+B_{i}[k]Re(X_{3})[N-k]- B_{r}[k]Im(X_{3})[N-k]\] (8)  
Figure 1: Flowchart of the optimized algorithm for the frequency spectrum evaluation.