Converter-based drive systems with permanent magnet synchronous motors (PMSM) are widely used in many industrial sectors. Consequently, issues related to the monitoring and diagnosis of electrical, magnetic, and mechanical faults are becoming increasingly important due to the growing use of these drives in various devices, including those critical to safety. Modern drive systems consist not only of the motor and magnets but also of a range of specialised devices, such as power supply systems, frequency converters with pulse width modulation (PWM), measurement and control systems, and complex mechanical systems that transmit mechanical torque (shafts, gears, couplings) to drive the given actuator. Each of these components is susceptible to failures that can disrupt normal drive system operation and require appropriate actions, particularly from the control system, to detect anomalies in the drive system [
1,
2,
3]. Modern diagnostic methods enable the detection of both electrical faults (including various types of short circuit, interphase faults, winding connection issues, etc.) and mechanical faults (such as the most common: bearing damage, eccentricity, misalignment of the drive system, unbalance of rotating elements, shaft deflection, etc.), as well as demagnetisation in permanent magnet motors [
4]. Lack of proper diagnostics can lead to significant losses, including a substantial reduction in drive system efficiency, decreased positioning accuracy in servodrives and CNC machines, increased energy consumption, and unplanned downtime. According to the ISO 17359 standard [
5], the following signals are used for the proper evaluation of motor condition: current, voltage, input and output power, temperature, rotational speed, vibrations, torque, noise, and acoustic techniques. In advanced motor diagnostics, the most commonly used methods include [
1,
2,
3,
6]: motor current and voltage analysis, temperature measurement [
7] vibration analysis, and noise analysis. The degradation of the motor and the torque transmission system, manifested by various anomalies or asymmetries, leads to unstable operation. This is typically observed through increased levels of vibration, noise, and temperature [
2,
4,
7]. The electric drive is not fully symmetric [
8,
9]. To differentiate between asymmetry caused by drive system degradation and asymmetry resulting from power supply issues or inherent design characteristics, it is crucial to correctly identify, record and classify the relevant signals for the proper operation of the drive system. Assessing characteristics, particularly those related to current, helps increase detection sensitivity, thereby eliminating design or power supply asymmetries. Analysis and estimation of these changes serve as criteria for effective operation and accurate detection. As highlighted in review studies [
1,
2,
3,
4,
10] anomalies can occur in various parts of the drive system. In this article, the focus is on detecting the unbalance of a mechanical component in the electric drive system of a two-mass servomechanism with a PMSM motor, which is connected to the load via a long, flexible shaft. In the analysed system, no additional external sensors for current, acceleration, or acoustics were used; instead, sensors that are part of the drive system's basic equipment (such as speed, position, and current measurement) were utilised. The unbalance was modelled by adding additional masses to a rotating disc that was rigidly attached to the motor shaft. The test mass was varied during the experiments. A review of the literature indicates that there are many methods to detect unbalances in drive systems, most of which pertain to single-mass systems using external sensors [2–4,7,10-12]. These include diagnostic signals such as mechanical vibrations (acceleration) [
2] noise (acoustic waves) [
2,
4] current (stator current) [
3,
11,
12] and temperature [
7]. These signals allow for the assessment of the current condition of the electric drive system, particularly in the evaluation of the state of bearings, alignment, balancing, and the condition of the foundation. Thanks to modern measuring instruments (dedicated sensors, measurement cards, and microprocessors), it is possible to measure mechanical vibrations (which can have various causes, whether electrical, magnetic, or mechanical) that indicate the condition of the drive system. In industrial environments, fully symmetrical drive systems are rare or non-existent. Even if such a system was initially balanced at a particular workstation, over time, degradation of a component of the system (whether electrical, magnetic, or mechanical) may occur [
13]. Therefore, this work focusses on detecting unbalance in the drive system of a two-mass setup with a PMSM motor, using, among other things, the reference current signal from the speed controller. The two-mass model was investigated because it allows for analysing the impact of torsional vibrations on the drive system. One source of these vibrations is a sudden change in the motor rotational speed, which causes twisting in the flexible connection [
14]. Vibrations in two-mass systems lead to energy loss, reduced efficiency, and dynamic stresses [
15]. These vibrations are also problematic in precise position control. Therefore, diagnosing the unbalance in the system, which significantly exacerbates this issue, becomes crucial. When a mechanical fault occurs in an electric drive, particularly for a PMSM motor operating in a field-orientated control structure, changes in electrical, magnetic and mechanical parameters lead to disturbances in current, voltage, and speed signals, affecting the proper functioning of the frequency control structure [
3,
10,
16,
17,
18,
19,
20]. An uncontrolled increase in the level of damage leads to unstable drive operation [
17]. Therefore, it is crucial to detect faults as quickly as possible. Depending on the type and power of the drive, this could range from a few to several seconds. As demonstrated in [
3,
4,
16] internal signals from the drive control structure, particularly current, can be utilised effectively for this purpose. Hence, the aim of this work is to develop a method for monitoring and diagnosing unbalance faults in a two-mass precision servodrive system, using signals from the internal field-orientated control structure embedded within the control system. Many existing solutions, such as those described in [
2,
3,
4,
10,
12,
13,
21,
22,
23,
24,
25,
26,
27,
28,
29] use additional sensors to monitor the condition of machines or equipment. Adding these elements to existing systems significantly increases costs during both installation and operation. This requires regular calibration, maintenance, and, in the case of failure, replacement, which introduces another potential source of problems within the system. It often requires modifications to existing infrastructure and integration with monitoring software. Furthermore, data from different sensors can be difficult to interpret, often requiring the use of advanced analysis algorithms and personnel with specialised qualifications. The use of non-invasive measurement methods in the drive system, as proposed in the article, reduces costs because utilising existing control signals does not incur additional expenses related to the purchase, installation, and maintenance of new sensors. The non-invasive approach does not require intervention in existing mechanical or electrical systems, thereby eliminating the risk of introducing new sources of failure. Signals used for control are typically already well validated and monitored, which enhances the system's reliability. Since these signals are already part of the control system, using them for fault detection is much simpler and less risky. Fewer components in the system mean fewer potential points of failure, which increases the overall reliability of the system, not just the drive system. For example, in [
20] an online diagnostic method for minor Interturn Short Circuits (ISCF) in low-speed Permanent Magnet Synchronous Motors (PMSM) used a technique based on the decomposition of the zero-sequence voltage vector, which is measured within the internal system. Many studies measure voltage, current, or speed signals, such as in [
12] where current and speed measurements, along with frequency analysis, were used to diagnose mechanical faults in synchronous machines, with additional sensors used. In [
30] a model-based scheme was proposed to detect and identify faults in a gear drive with a steady state PMSM motor. A state-space model of the system was proposed and the Recursive Least Squares (RLS) algorithm was used for parameter estimation. Fault detection was performed using a thresholding method on the residual current spectrum to assess the frequency characteristic of a particular fault. Both invasive and non-invasive methods are applied in this context. For example, in [
11,
31] the stator current, after Park's transformation, was analysed for rotor unbalance using the discrete wavelet transform. This work focused on the latter method. From a diagnostic perspective, both invasive and non-invasive signals, as well as the methods for processing them, are of equal or similar importance. Thus, the effectiveness of the diagnostic process depends not only on the diagnostic signals analysed [7-9,12,14-15,30] but also on the processing methods applied. For example, in [
18], although analysis of Root Mean Square (RMS) vibration signals detects individual faults and helps to determine the technical condition of the machine, unfortunately it cannot specify the cause of its malfunction. In [
19] the Fast Fourier Transform (FFT) algorithm was used to detect broken rotor cage bars, eccentricity, and damaged bearings in an induction machine based on mechanical vibration analysis. In [
32] the potential for using average, maximum and RMS signals, as well as cross-correlation coefficients, kurtosis, and peak values, for detecting rotor unbalance was presented, with an MLP neural network employed to differentiate these faults. In [
33] phase currents and a vibration sensor were used to detect stator faults in a PMSM motor, where wavelet analysis of vibrations was able to identify up to 15% of turn-to-turn shorts in a single phase. Mechanical vibrations are a versatile and widely used diagnostic signal, as demonstrated in [
34] where they were also used to detect electromagnetic faults. An example of applying vibroacoustic to identify misalignment in a drive system consisting of a motor, a cylindrical gear and a worm gear is presented in [
35]. To detect unbalance in a PMSM drive system, mechanical vibration signals can be analysed using FFT, bispectrum, full spectrum, and orbit shape analysis, as described in [
22]. In [
21] mechanical vibrations were analysed with FFT to detect PMSM unbalance, with additional modelling of demagnetisation and dynamic eccentricity. In [
23], FFT and bispectral analysis of mechanical vibrations and stator current were used to detect rotor unbalance in an induction motor powered by a frequency converter. FFT analysis has limitations because it does not account for changes in process over time [
24,
25,
26,
36,
37] which is why the Short-Time Fourier Transform (STFT) is used to detect faults in dynamic states, enabling the identification of both the type of fault and its timing. In [
36] STFT was used to detect stator faults in a PMSM machine by analysing the stator current, its envelope, and the spatial vector module of the stator current, highlighting STFT's advantages over traditional FFT analysis. In [
24] the possibility of detecting the rotor unbalance in an induction motor was demonstrated using STFT analysis of the stator current vector, with results compared to an approach based on FFT analysis of the stator current. In [
25] the application of STFT to detect mechanical faults, such as blade-to-stator friction in turbochargers, was demonstrated by analysing vibration signals during machine start-up and braking, showcasing the method's superiority over traditional FFT analysis. In [
26] STFT was used to analyse noise from both an undamaged motor and motors with unbalance, misalignment, and bearing damage, allowing for precise determination of the timing of the fault. In [
37] the use of variable window STFT was proposed to detect winding faults in PMSM by analysing stator current signals and automating the detection process using a convolutional neural network. It should be noted that the presented literature review does not cover two-mass systems nor does it analyse the reference current signal from the speed controller. In the existing literature, the unbalance is modelled in various types of electric machines and drives. Specifically, an this phenomenon has been identified in induction motors [
23,
24,
26] PMSMs [
11,
21,
22,
31,
36] tidal turbines [
13], commutator motors in impact drills and mixers [
27] and washing machines [
28,
29]. The literature analysis indicates that the issue of unbalance affects all rotating machines. Consequently, this work focusses on detecting unbalance in a two-mass system with a long shaft consisting of two AC servodrives (PMSMs). The non-invasive standard equipment in an automated control system, the reference current signal in the q axis of the speed controller, was analysed using STFT. The study investigated the impact of varying the test mass installed in single-mass and two-mass systems on the level of unbalance in the drive system, specifically examining how the moving average window affects this issue. The influence of different neural network architectures was also analysed, and the optimal solution for the given example was proposed, with experimental validation of this choice in relation to the single-mass system.