Fabrication of Automated Hydrostatic Pressure-Based Densitometer with a Calibrated Pressure Sensor

: An automated device is designed to measure the density of a liquid material using hydrostatic pressure method. A low cost pressure sensor is calibrated and used to get highly accurate readings. The calibration is done by measuring the pressure values vs. the generated voltage signal. The calibration has been challenging due to the low accuracy of the sensor but proved to be highly effective in applications. The interface is developed using a microcontroller, motor drives, analog to digital converters and sensors. The device is designed to get several readings automatically by changing the positions of the device/liquid column heights to increase the accuracy. Also the device can be programmed to measure the real time density of a liquid continuously. The readings were analyzed and averaged by a software developed in python language. The instruments accuracy was tested against 3 liquid types, water, coconut oil, kerosene oil, and showed a low error (0.007%, 0.001%, and 0.002% respectively) compared to the readings of a standard Pycnometer. The low error percentages confirm the accuracy of the device and the effectiveness of the sensor calibrations.


Introduction
Density (ρ) is a fundamental physical property that quantifies the mass of a substance contained within a specific volume, whether it is a fluid or a solid.Density is influenced by temperature and pressure, providing insights into the substance's compactness and arrangement of its particles.The density of a fluid plays a crucial role in understanding its behavior under various conditions.
To avoid confusion and clearly differentiate between types of density, the term "absolute density" is often used to refer to the density measured without any reference to another substance [1,2].In contrast, "relative density" (also known as specific gravity, SG) accounts for the ratio of the density of the substance in question to the density of a reference substance (usually water).

SG =
Density o f substance at temerature T Density o f water at temerature T A range of fundamental techniques, such as hydrostatic pressure, buoyancy, weighing, and vibrating tube methods etc. .., are employed for measuring density [3][4][5].
The hydrostatic methods encompass two distinct approaches, namely the balance column method and the pressure sensor method.In balanced column method when two vessels holding liquids with distinct densities (ρ1) and (ρ2) are linked through an inverted U-tube, a pressure lower than atmospheric pressure comes into play.This results in the liquids ascending by heights (h1) and (h2) over their original levels in the vessels.A noteworthy advantage of these methods is their independence from any deposits.However, it's crucial to acknowledge that these hydrostatic techniques are unsuited for media that are in motion.
The hydrostatic pressure sensor method, originating from the weight of a liquid column at rest, holds significant importance in various applications.The height of a uniform density liquid column directly correlates to hydrostatic pressure.However, it is important to recognize that hydrostatic properties of liquids are not constant and are influenced by factors like liquid density and local gravity.Determining the hydrostatic pressure necessitates knowledge of both these factors.The formula for computing hydrostatic pressure (P) involves the following variables: liquid height (h), liquid density (ρ), and local gravity (g) [6].
The hydrostatic pressure can encompass different components, including relative pressure and absolute pressure, with atmospheric pressure often being a factor.Measuring absolute pressure requires accounting for atmospheric pressure to accurately determine true hydrostatic pressure.The precision of hydrostatic pressure measurements is impacted by the liquid's temperature, making it crucial to consider temperature variations.Commonly used pressure units, such as meters of water or feet of water, provide convenient correlations between pressure and fluid height.These units are based on specific standards, often involving water at 4 • C due to its close-to-maximum density characteristic.However, variations in temperature and the use of different reference temperatures like 60 • F (15.56 • C) can introduce complexity and potential inaccuracies, warranting caution in high-precision applications.In summary, hydrostatic pressure stands as a pivotal concept intricately tied to the weight of a liquid, its density, and the force of gravity.
According to our study in the recent past the research community's interest has been mostly focused on developing specialized devices for specific density measuring applications.For example there have been several publications related to the density measuring of ionic liquids [7] and the references there in, density of organic solutions [8-13], . . .etc. To fill in this gap of a simple low cost industrial densitometers for commercial purposes we have proposed the automated liquid densitometer in this work.
In the context of our developed automated densitometer, we use hydrostatic pressure sensor method to measure the density of an unknown liquid.We have modified the automated instrument to get an average reading by changing the pressure values with a high accuracy.The pressure sensors were calibrated to increase the accuracy which has been a significant step in increasing the accuracy of the device.The device can also measure the real time density of a liquid going under a chemical or any other process.By exploiting hydrostatic pressure measurements, we can indirectly deduce the density of a liquid substance.The instrument under consideration employs the pressure sensor method for its development.

Materials and Methods
The working flow diagram of the densitometer is depicted in Figure 1a.A tube is dipped in the liquid that need to measure density up to a standard predetermined height.A calibrated pressure sensor is fixed at the top of the tube to measure the pressure inside the tube as shown in Figure 1a.The tube is dipped in the liquid to a standard predetermined height.The pressure inside the tube is related to the height of the liquid column inside the tube (h) according to the Formula (1).The pressure sensor is connected to an analog to digital converter (ADC) module (HX711 module) which amplifies and digitize the signal [14].The digitized signal is fed in to the micro controller based interface with Arduino uno (Arduino, version 1.8.19,Monza, Italy), Atmega 328 (Atmel Corporation, San Jose, CA, USA).The waterproof thermometer, DS18B20 (Dallas semiconductors, Dallas, TX, Sci 2024, 6, 41 3 of 12 USA) is fixed to get the temperature measurements from the liquid and the readings are fed in to the microcontroller to convert in to a digital signal.The microcontroller is connected to the computer and the readings are processed via the designed software.The results are showcased through computer software (designed using python language) [15,16].An automatically adjustable stage was designed to place the container with the liquid sample (Figure 1).A servo motor, 28EYJ-48 (Mikroelektronika, Belgrade, Serbia) with a motor driver is fixed to change the stage positions.The motor driver, L293 (Texas instruments, Dallas, TX, USA) is controlled with the microcontroller and is programmed to adjust automatically to 3 different heights and take 3 different pressure values.The software average the 3 pressure readings and using them calculates the density and the average density is calculated ultimately.The practical setup of the densitometer is show in Figure 2.
A calibrated pressure sensor is fixed at the top of the tube to measure the pressure inside the tube as shown in Figure 1a.The tube is dipped in the liquid to a standard predetermined height.The pressure inside the tube is related to the height of the liquid column inside the tube (h) according to the Formula (1).The pressure sensor is connected to an analog to digital converter (ADC) module (HX711 module) which amplifies and digitize the signal [14].The digitized signal is fed in to the micro controller based interface with Arduino uno (Arduino, version 1.8.19,Monza, Italy), Atmega 328 (Atmel Corporation, San Jose, CA, USA).The waterproof thermometer, DS18B20 (Dallas semiconductors, Dallas, TX, USA) is fixed to get the temperature measurements from the liquid and the readings are fed in to the microcontroller to convert in to a digital signal.The microcontroller is connected to the computer and the readings are processed via the designed software.The results are showcased through computer software (designed using python language) [15,16].An automatically adjustable stage was designed to place the container with the liquid sample (Figure 1).A servo motor, 28EYJ-48 (Mikroelektronika, Belgrade, Serbia) with a motor driver is fixed to change the stage positions.The motor driver, L293 (Texas instruments, Dallas, TX, USA) is controlled with the microcontroller and is programmed to adjust automatically to 3 different heights and take 3 different pressure values.The software average the 3 pressure readings and using them calculates the density and the average density is calculated ultimately.The practical setup of the densitometer is show in Figure 2.

The Pressure Sensor and Calibration
The employed pressure sensor was MPS20N0040D (OEM electronics, Tranas, Sweden) [17].The calibration process involved establishing a correlation between pressure inputs and the corresponding voltage response of the pressure sensor.This section has become a crucial

The Pressure Sensor and Calibration
The employed pressure sensor was MPS20N0040D (OEM electronics, Tranas, Sweden) [17].The calibration process involved establishing a correlation between pressure inputs and the corresponding voltage response of the pressure sensor.This section has become a crucial part in this work since it improves the accuracy of the device drastically and has open doors for future researchers/developers to use the sensor in different applications.This facilitated accurate conversion of voltage readings into pressure measurements.The setup encompassed the integration of a manometer, the MPS20N0040D pressure sensor, necessary connecting components, tubing, a syringe utilized for precise pressure control, and an Arduino board.Figure 3 shows the experimental setup involved connecting the manometer and pressure sensor through a "T" junction, which facilitated the controlled application of varying pressures.Specifically a syringe was employed to maintain consistent pressure levels during measurements, ensuring the accuracy and stability of readings from both the manometer and the pressure sensor.In terms of wiring, the MPS20N0040D pressure sensor was seamlessly integrated with the Arduino board to enable effective signal acquisition.This cohesive arrangement established a robust foundation for the calibration experiments.Measurements were taken at various values from the MPS20N0040D, and corresponding column height levels were recorded using a caliper.Subsequently, multiple data points were collected to examine the relationship between the ADC value and the approximate manometer pressure.Utilizing the 16 calibration points obtained from the digital ADC readings of the manometer water column heights, a plot was generated by plotting these points against each other, resulting in the Figure 4. Finally the compilation of a comprehensive dataset, featuring pressure levels alongside their corresponding voltage readings were derived from the pressure sensor.The calibration process unfolded through a systematic sequence of steps.To ensure precision a syringe was utilized to apply pressure within the sensor pressure range [17].A crucial waiting period was observed to establish a static pressure environment, a prerequisite for accurate measurements.The height of the water column within the manometer was meticulously gauged using a precise measuring tool like a caliper.This recorded height was in direct correspondence with the applied pressure, offering a fundamental reference for subsequent calibration.Concurrently, the voltage reading from the MPS20N0040D pressure sensor, interfaced with the Arduino board.This voltage reading provided an immediate insight into the applied pressure magnitude.
Measurements were taken at various values from the MPS20N0040D, and corresponding column height levels were recorded using a caliper.Subsequently, multiple data points were collected to examine the relationship between the ADC value and the approximate manometer pressure.Utilizing the 16 calibration points obtained from the digital ADC readings of the manometer water column heights, a plot was generated by plotting these points against each other, resulting in the Figure 4. Finally the compilation of a comprehensive dataset, featuring pressure levels alongside their corresponding voltage readings were derived from the pressure sensor.The MPS20N0040D pressure sensor is designed to respond to a range of 40 kPa within a 50 mV span [17].As explained before the sensor is connected to a HX711 (Avia semiconductor, Xiamen, China), which serves as a 24-bit analog-to-digital converter and signal amplifier, with a fixed amplification factor of 128.When a 5 V supply voltage is applied to the sensor, the potential response spans from 0 V to 6.4 V [14].Under the common assumption of linearity, the relationship between the electrical signal and the measured pressure from the MPS20N0040D can be approximated using a linear equation: Here, "V r " is the voltage output of the pressure sensor.R denotes the sensitivity of the system, assumed to be 50 mV/40 kPa [17], and "a" is the DC offset, assumed to be +25 mV [14].It's worth noting that the response is limited to 5 V due to the constraints of the HX711, effectively limiting the usable range.The theoretical response curve of the MPS20N0040D is depicted in the Figure 5.
Upon observation of the plot depicted above, it becomes apparent that the operational range of the pressure transducer can be approximated to fall within the −20 kPa to 12 kPa range.This represents the expected range of pressure values that can be accurately recorded by the analog-to-digital converter (ADC).Multiple readings were garnered by iterating steps of pressure levels.This strategic approach guaranteed a robust dataset, furnishing ample data points essential for a comprehensive calibration curve.
Figure 4 displays a crucial outcome.As anticipated, the digital response of the pressure transducer exhibits a linear relationship with the height of the manometer's column, even when subjected to varying input pressures.This finding reaffirms the pressure relationship as a function of column height, highlighting the transducer's consistent and predictable response across different pressure inputs.

𝑅 𝑅
Here, "Vr" is the voltage output of the pressure sensor.R denotes the sensitivity of the system, assumed to be 50 mV/40 kPa [17], and "a" is the DC offset, assumed to be +25 mV [14].It's worth noting that the response is limited to 5 V due to the constraints of the HX711, effectively limiting the usable range.The theoretical response curve of the MPS20N0040D is depicted in the Figure Upon observation of the plot depicted above, it becomes apparent that the operational range of the pressure transducer can be approximated to fall within the −20 kPa to 12 kPa range.This represents the expected range of pressure values that can be accurately recorded by the analog-to-digital converter (ADC).Multiple readings were garnered by iterating steps of pressure levels.This strategic approach guaranteed a robust dataset, furnishing ample data points essential for a comprehensive calibration curve.
Figure 4 displays a crucial outcome.As anticipated, the digital response of the pressure transducer exhibits a linear relationship with the height of the manometer's column, even when subjected to varying input pressures.This finding reaffirms the pressure relationship as a function of column height, highlighting the transducer's consistent and predictable response across different pressure inputs.
Moving forward, the focus shifts to the ADC response of the MPS20N0040D.It's important to recall that the HX711 amplifies the signal from the pressure transducer by a factor of 128× and confines the response within a voltage range of 0 V to 5 V.With this in mind, we can establish the following relationship,  = 5.0 *   128 2 − 1 (4) Moving forward, the focus shifts to the ADC response of the MPS20N0040D.It's important to recall that the HX711 amplifies the signal from the pressure transducer by factor of 128× and confines the response within a voltage range of 0 V to 5 V.With this in mind, we can establish the following relationship, where (ADC value) represents the reading obtained from the ADC, averaged within the Arduino code, and V r signifies the approximate voltage produced by the MPS20N0040D transducer before undergoing amplification.By considering both forms of representation for sensor voltage and manometer pressure, we can create the following plot that illustrates their relationship (Figure 6).where (ADC value) represents the reading obtained from the ADC, averaged within the Arduino code, and Vr signifies the approximate voltage produced by the MPS20N0040D transducer before undergoing amplification.By considering both forms of representation for sensor voltage and manometer pressure, we can create the following plot that illustrates their relationship (Figure 6).The way the sensor's response relates to real-world pressure values is finally visible in the graph above.As expected, the pressure transducer's response is centered on approximately 25 mV-20 mV, and the pressure values fall within the kPa range.Now, when the relationship between the voltage output of the MPS20N0040D, its offset voltage, and the operational pressure range is revisited, an understanding of how The way the sensor's response relates to real-world pressure values is finally visible in the graph above.As expected, the pressure transducer's response is centered on approximately 25 mV-20 mV, and the pressure values fall within the kPa range.Now, when the relationship between the voltage output of the MPS20N0040D, its offset voltage, and the operational pressure range is revisited, an understanding of how the sensor could be calibrated can begin to take shape.
The above equation now makes sense, as both the V r value and the approximate offset (in our case, a ≈ 22.5 mV), and (a) is the DC offset, assumed to be +25 mV have been considered.The original claim in the datasheet, stating that the offset is +25 mV and that R ≈ 50 mV/40 kPa, is implemented, and this can be plotted against our data.
The necessity for adjustments to improve alignment with the theoretical model, despite the general similarity in behavior, has been identified in our data (Figure 7).Firstly, an update to the offset from the previously assumed 25 mV to 20 mV was proposed.This alteration aims to strengthen the correlation between the data and the theoretical curve.Secondly, the determination of the value for R through the utilization of a least-squares approach is suggested [18].This approach is intended to minimize the error between the theoretical predictions and the actual data.Through the application of the fitting process to the data and the adjustment of the offset, the following relationship between MPS20N0040D voltage and incident pressure can be established as shown below (Figure 8).A better approximation for the sensitivity factor, R, can be made using the slope and intercept of the least-squares linear fit.The gradient (m) and the intercept (C) of the of fitting plot is, m = 0.4477, C = −8.97 The corresponding value for voltage (the offset) for zero applied pressure can be found as follows.A better approximation for the sensitivity factor, R, can be made using the slope and intercept of the least-squares linear fit.The gradient (m) and the intercept (C) of the of fitting plot is, m = 0.4477, C = −8.97 The corresponding value for voltage (the offset) for zero applied pressure can be found as follows.From above calculations, an estimation of approximately 50 mV/22.3880kPa for sensitivity (R) was confirmed, which experiences a deviation from the 50 mV/40 kPa as specified in the datasheet [14].As a result, the response of the MPS20N0040D transducer can be expressed in relation to the derived parameters involving its physical and electrical characteristics.Now we can write the final calibrated pressure equation for the MPS20N0040D pressure transducer. where, The ADC value is the output signal of the analog to digital converter.The pressure sensors output voltage signal is first amplified and converted to a digital signal by the ADC and that signal is converted to a pressure signal by the software via the given equation.This equation enables the conversion of ADC values into approximate pressure measurements in kilopascals.

Temperature Sensor and Calibration
The DS18B20 temperature sensor [19,20] was used to give a better understanding of the density results to the user in sensitive applications.The sensor is functional within a temperature range of −55 • C to 125 • C. The measured temperature is displayed on the serial monitor and in a specifically designed graphical user interface (GUI).The software design is coded through the Arduino Integrated Development Environment (IDE) and Python.The program's execution entailed the initial reading of the analog sensor's output signal, followed by the pressuring of sensor calibration.This action enabled the acquisition of the calibration factor required for the main program.The operational procedure involved taking readings 50 times at a 1-s interval, after which the average density value was calculated.Subsequently, the average density outcome was showcased on the GUI along with the corresponding temperature value.Figure 1b delineates the system workflow.
In the calibration of the temperature sensor an Arduino UNO was used in conjunction with a DS18B20 temperature sensor and a 4.7 kΩ resistor, as depicted in Figure 9. Data communication was established with the serial monitor by coding the Arduino.Subsequently, a calibration procedure was conducted using the known temperatures (boiling water bath and melting ice).

Density Testing of Liquid Samples
Testing is essential to evaluate the device's performance.Preliminary tests were carried out on water samples, with variations in probe depths at 2.0 cm, 4.0 cm, 6.0 cm, 8 cm, and 10.0 cm to change the pressure values and increase the accuracy.All measurements were taken at 29 °C.These tests were repeated three times to further improve the accuracy, and the recorded values were plotted on a graph.Following this, the density of the same water sample was determined using a Generic 50 ML glassware specific density gravity bottle pycnometer.The same procedure was then replicated for liquid samples of coconut oil and kerosene oil.The obtained graphical results/density values of the three liquids using the densitometer is shown in Figure 10.
It should provide a concise and precise description of the experimental results, their interpretation, as well as the experimental conclusions that can be drawn.
The Table 1 shows the summarized density measurement data for the 3 types of test samples, water, coconut oil, kerosene oil.In Table 1, 3 trials at 3 different heights have been measured and averaged to improve the accuracy of the results.The results of the developed densitometer show errors of 0.007%, 0.001%, 0.002% for water, coconut oil and kerosene oil, compared to the pycnometer results.These very low error percentages confirms the accuracy of the instrument as well as the effectivity of the calibration of the sensors.Compared to the existing pycnometer we have shown our instruments accuracy is very high.The designed automated instrument changes the height of the liquid column by changing the stage position automatically to take several readings and average them so increase the accuracy compared to the pycnometer.The device can be easily programmed to measure real time density of a liquid undergoing a process (chemical or physical) continuously.According to our knowledge there is no similar simple and low cost device in the commercial market.

Density Testing of Liquid Samples
Testing is essential to evaluate the device's performance.Preliminary tests were carried out on water samples, with variations in probe depths at 2.0 cm, 4.0 cm, 6.0 cm, 8 cm, and 10.0 cm to change the pressure values and increase the accuracy.All measurements were taken at 29 • C.These tests were repeated three times to further improve the accuracy, and the recorded values were plotted on a graph.Following this, the density of the same water sample was determined using a Generic 50 ML glassware specific density gravity bottle pycnometer.The same procedure was then replicated for liquid samples of coconut oil and kerosene oil.The obtained graphical results/density values of the three liquids using the densitometer is shown in Figure 10.
It should provide a concise and precise description of the experimental results, their interpretation, as well as the experimental conclusions that can be drawn.
The Table 1 shows the summarized density measurement data for the 3 types of test samples, water, coconut oil, kerosene oil.In Table 1, 3 trials at 3 different heights have been measured and averaged to improve the accuracy of the results.The results of the developed densitometer show errors of 0.007%, 0.001%, 0.002% for water, coconut oil and kerosene oil, compared to the pycnometer results.These very low error percentages confirms the accuracy of the instrument as well as the effectivity of the calibration of the sensors.Compared to the existing pycnometer we have shown our instruments accuracy is very high.The designed automated instrument changes the height of the liquid column by changing the stage position automatically to take several readings and average them so increase the accuracy compared to the pycnometer.The device can be easily programmed to measure real time density of a liquid undergoing a process (chemical or physical) continuously.According to our knowledge there is no similar simple and low cost device in the commercial market.

Figure 1 .
Figure 1.(a) The working flow diagram of the densitometer; (b) The process flow of the system.

Figure 1 . 13 Figure 2 .
Figure 1.(a) The working flow diagram of the densitometer; (b) The process flow of the system.Sci 2024, 6, x FOR PEER REVIEW 4 of 13

Figure 3 .
Figure 3. Experimental setup to calibrate the pressure sensor.

Figure 3 .
Figure 3. Experimental setup to calibrate the pressure sensor.

Figure 5 .
Figure 5. Theoretical response curve of the MPS20N0040D Pressure sensor.

Figure 5 .
Figure 5. Theoretical response curve of the MPS20N0040D Pressure sensor.

Figure 7 .
Figure 7. Sensor voltage and manometer pressure (Theoretical and experimental response).Figure 7. Sensor voltage and manometer pressure (Theoretical and experimental response).

Figure 7 .
Figure 7. Sensor voltage and manometer pressure (Theoretical and experimental response).Figure 7. Sensor voltage and manometer pressure (Theoretical and experimental response).
where, Z is the maximum pressure can handled by the sensor.

Figure 7 .
Figure 7. Sensor voltage and manometer pressure (Theoretical and experimental response).

Table 1 .
The average results of the density data for three liquids measured by each technique.

Table 1 .
The average results of the density data for three liquids measured by each technique.