# Data-Driven and Machine-Learning-Based Real-Time Viscosity Measurement Using a Compliant Mechanism
## 2 Materials and Methods  
The conceptual arrangement of the viscosity measurement system is presented in Figure 1. The system comprises a compliant-mechanism-based mechanical structure, a vibration exciter, a piezoelectric sensor, a DC power supply, a National Instrument (NI) data acquisition (DAQ) system, and NI Lab View software (version 2022).  
The details of the mechanical structure with a compliant/flexible mechanism are shown in Figure 2. A photograph of the complaint mechanism is presented in Figure 3a, while the mechanical structure is shown in Figure 3b.  
Figure 1: Conceptual arrangement of the viscosity measurement system.  
The mechanical structure comprises two vertical links and a central link, which are connected by compliant joints. This structure was manufactured through 3D printing with a polypropylene material. It is possible to create in-plane vibrations in the compliant mechanism that cause the structure to be subject to a dynamic force in the \"\(x\)\" and \"\(y\)\" directions, as illustrated in Figure 3. As the vibration exciter for generating the in-plane vibrations, a micro-vibration motor located in the horizontal central link of the compliant  
Figure 3: Photograph of (**a**) the compliant mechanism and (**b**) the system’s mechanical structure.  
Figure 2: Details of the system’s mechanical structure (dimensions are provided in millimeters).  
mechanism is used (Figures 2 and 3). The compliant joints in the structure ensure that it has the necessary directional stiffness, which ensures that it exhibits a large vibration amplitude in the \"\(x\)\" direction. On the other hand, the higher stiffness in the \"\(y\)\" direction limits the vibration amplitude in this direction.  
The mechanical structure is inserted into a bath of fluid whose viscosity is under study. The vibration exciter generates a dynamic force with a constant frequency and amplitude, causing the compliant mechanical structure to vibrate in the \"\(x\)\" direction. As the mechanical structure vibrates in the oil bath, the fluid's viscosity creates damping effect in the mechanical structure. It is clearly visible that the resultant vibrations of the mechanical structure in the \"\(x\)\" direction are influenced by the damping effect of the fluid. A higher fluid viscosity results in a large damping effect and low amplitude vibrations, whereas a lower viscosity results in large amplitude vibrations. The vibrations in the mechanical structure are influenced by the liquid's viscosity, which facilitates carrying out measurements of the fluid's viscosity on the basis of measurements of the compliant structure's vibrations. Thus, the vibrations in the mechanical structure are correlated to determine the viscosity of the fluid in the container. The piezoelectric sensor, which is dedicated to measurements of vibrations in the '\(x\)\" direction, is fitted firmly inside the slot in the compliant structure to generate voltage as the central mass undergoes the vibrations. (It is the compliant mechanism that generates the voltage)  
The liquid whose viscosity we want to measure is kept in a glass beaker, and the mechanical structure with a compliant mechanism is inserted into the liquid. A rubber block is placed at the interface between the glass beaker and the mechanical structure to ensure than the vibrations generated by the exciter are not transmitted to the glass beaker.  
The parameters of the vibration exciter and the piezoelectric sensor are provided in Table 1.