# Data-Driven and Machine-Learning-Based Real-Time Viscosity Measurement Using a Compliant Mechanism
## 1 Introduction
Rigid body mechanisms comprising several rigid links connected by different types of joints are conventionally used to transmit motion and power. On the other hand, compliant mechanisms have flexible connections at a few locations between two rigid links. Compliant mechanisms are preferred in certain applications due to their advantages: their reduced number of parts, reduced backlash, and lower wear and tear than in the case of the conventional mechanisms [32]. [PERSON] et al. (2022) [33] investigated applications of compliant mechanisms to micro-electromechanical and medical systems, where bulk metallic glasses are used in the form of cantilever beams. [PERSON] et al. (2009) [34] proposed a double parallel four-bar mechanism for guiding a plate in a machine and performed theoretical simulations comprising an analysis of the pseudo-rigid body mechanism with the application of elastic beam theory. [PERSON] et al. (2023) [35] proposed a compliant mechanism that could adapt to changes in relative motion and exhibit multiple operating modes when used to tune a platform's direction of movement. Piezoelectric-material-based viscosity measurement devices have mechanical structures that undergo vibrations generated by piezoelectric actuators. There is the need to explore the possibility of using compliant mechanisms in these mechanical structures, designed with the required directional stiffness to ensure sub-millimeter- or millimeter-scale control over the vibration amplitude but with much lower power consumption, a smaller actuator, and a lower design complexity. The costly piezoelectric material, which operates at higher frequencies (kHz or MHz), used as a vibration actuator in existing devices can be replaced with an electromagnetic actuator, which is inexpensive and easily available and operates at lower frequencies. Furthermore, the vibration responses of the mechanical structures can be measured using piezoelectric sensors, which are inexpensive and easily available. The dynamic vibrations measured using a piezoelectric sensor can be used to estimate fluid viscosity. Lastly, the ML algorithms used in existing devices to estimate fluid viscosity provide results that are burdened with a 10-15% error, which needs to be improved. The proposed work introduces a novel method for real-time viscosity measurements using a compliant-mechanism-based mechanical structure, an electromagnetic actuator, and a piezoelectric sensor. The study presented in the paper, for the first time in the literature, investigates the usage of a compliant mechanism structure for viscosity measurements, the advantages of which are high durability, simplicity, and low cost. Viscosity estimation is based on the voltage output measurement from the piezoelectric sensor, while a regression-based ML model constructed in open-source software is used to estimate the viscosity from the sensor data in an efficient manner. This paper is organized as follows: Section 2 provides detailed information concerning the mechanical system comprising a compliant mechanism, an electromagnetic actuator, and a piezoelectric sensor. Section 3 concerns numerical simulation of the system and the machine learning models used for viscosity prediction. Section 4 describes the experimental arrangement used in a series of viscosity measurements on fluids with known viscosities. Finally, in Section 5, the results of the simulations and experimental studies are summarized.