# Data-Driven and Machine-Learning-Based Real-Time Viscosity Measurement Using a Compliant Mechanism
## 4 Experimental Setup  
The arrangement of the viscosity measurement system ensures that the resultant vibrations in the compliant structure are influenced by the fluid viscosity. Vibrations in the compliant mechanism are measured using the piezoelectric sensor located in the central link of the compliant mechanism, as illustrated in Figures 2 and 3. Identification experiments were performed to determine the voltage generated by the piezoelectric sensor as the mechanical structure with the compliant mechanism underwent vibrations when suspended in a liquid with a known viscosity. Water-glycerol solutions containing different proportions of glycerol were used to obtain fluid of the required viscosity. The fluid viscosity values were measured using an Ostwald viscometer (produced by Thomas Scientific), which measures dynamic fluid viscosity based on the time required for fluid to pass through a narrow tube. The dynamic voltage generated by the piezoelectric sensor was recorded using DAQ (v.NI cDA9174) and NI Lab View software (Version 2022). Experimental research was performed to measure the piezoelectric sensor's voltage output for different fluid viscosity values from 10 cP to 60 cP, where the initial readings were taken for 10 cP viscosity fluid. The time duration for each measurement was kept at 0.5 s, and the sampling rate during the data acquisition process was set to 2000 samples per second. Experimental observations were made of the voltage generated by the piezoelectric sensor at the given time intervals in the form of a single column, where each observation contained 1000 data points taken at an interval of 0.5 milliseconds. The measurement process was repeated to obtain 250 voltage records for each viscosity value. Later, the process was repeated for liquids \begin{table}
\begin{tabular}{p{56.9 pt} p{56.9 pt} p{56.9 pt} p{56.9 pt} p{56.9 pt} p{56.9 pt}} \hline \hline
**Reference** & **ML Model(s) Used** & **Application** & \begin{tabular}{c} **Accuracy/** \\ **Performance** \\ **Metrics** \\ \end{tabular} & **Fluid Type** & \begin{tabular}{c} **Main Contributions** \\ **and Limitations** \\ \end{tabular} \\ \hline \hline [PERSON] et al. (2021) [22]; & ANN & \begin{tabular}{c} Viscosity in \\ nanofluids and \\ refrigerants \\ \end{tabular} & \begin{tabular}{c} RMSE = 0.051, \\ high accuracy \\ \end{tabular} & \begin{tabular}{c} Nanofluids, \\ refrigerants \\ \end{tabular} & \begin{tabular}{c} Contributions: Effective \\ of viscosity \\ and nanofluids \\ Limitations: Limited \\ generalizability for \\ other fluids \\ \end{tabular} \\ \hline [PERSON] et al. (2018) [24]; & GA-ANN, ELM, ANFIS-PSO & \begin{tabular}{c} Viscosity \\ prediction \\ \end{tabular} & \(R^{2}\) up to 0.999 & Gas condensates, various fluids & \begin{tabular}{c} Contributions: High \\ and ensemble \\ algorithms \\ \end{tabular} \\ \hline [PERSON] et al. [26]; & ANN & \begin{tabular}{c} Real-time viscosity \\ and density \\ \end{tabular} & Broad coverage & General liquids & \begin{tabular}{c} Contributions: \\ Real-time fluid property \\ estimation using \\ piezoelectric sensors \\ Limitations: Sensor \\ calibration \\ \end{tabular} \\ \hline [PERSON] et al. [29]; [PERSON] & \begin{tabular}{c} GPR, GA, PSO, \\ Simulated \\ Annealing \\ \end{tabular} & \
\begin{tabular}{c} Enhanced viscosity \\ models \\ \end{tabular} & High accuracy & PCM suspensions, varied &
\begin{tabular}{c} Contributions: \\ Improved robustness \\ and accuracy using \\ metaheuristics \\ Limitations: Complex \\ optimization required \\ \end{tabular} \\ \hline \hline \end{tabular}
\end{table} 
Table 2: _Cont._with viscosity values of 20 cP, 30 cP, 40 cP, 50 cP, and 60 cP to determine the voltage output at the piezoelectric sensor. The voltage data from the piezoelectric sensor were measured using NI Lab View hardware (Chassis: cDA9174; voltage measurement module: NI9252). The data obtained were visualized and processed in the NI Lab View software.