## 3 Hardware Development
### Sensors
#### 3.1.3 Calibration of the Position vs. Percentage Relationship  
At this point, it should be noted that the dial gauge does not display a linear scale, i.e., the percentage values are not evenly distributed, as can be seen in Figure 5a. This is to compensate for the hemispherical cylindrical shape of the tank, which has a greater capacity in the middle part of its body.  
Therefore, to determine the percentage of LPG level in the tank as a function of \(\theta\) and considering the non-linearity of the volume at different levels, it has been proposed to use a lookup table. Then, the fill level percentage is determined from \(\theta\) and by using a linear interpolation between the angles previously recorded in the lookup table. With this method, it is possible to achieve high accuracy, but it will depend on the number of calibration points used. To estimate the spacing (in degrees) required between calibration points, Equation (3) is used, which is based on experimental data collected with the DRV5055 [26]:  
\[Spacing\approx Accuracy\cdot 8 \tag{3}\]  
The spacing between calibration points must not be greater than \(30^{\circ}\), or the error can be unpredictable. The lookup table calibrated system is generated as follows.  
1. For each calibration percentage, the magnet is rotated to the desired percentage and the measured voltages and the calculated \(\theta\) are recorded. Several measurements are made for the same percentage (shown on the dial gauge). Then, a type A uncertainty assessment is performed [27]. Therefore, for each calibration percentage, an angle is recorded, which is the mean value of the different estimates.
2. During normal operation, \(\theta\) has a value between two of the angles assigned to the calibration percentages recorded previously, designated as \(\theta_{below}\) and \(\theta_{above}\).
3. Then, the calculated percentage (\(\%_{\text{c}}\)) is determined from the calculated \(\theta\) and by linear interpolation between the angles assigned to the previously recorded percentages, as:  
\[\%_{\text{c}}=\left\{\left(\frac{\theta-\theta_{below}}{\theta_{above}- \theta_{below}}\right)\cdot\left(\%_{above}-\%_{below}\right)\right\}+\% _{below} \tag{4}\]  
Figure 5b shows the graph obtained from the calculated \(\theta\) (Equation (2)) vs. the calculated percentage (\(\%_{\text{c}}\)) (Equation (4)), when the mechanical float is manually moved from an empty tank (\(0\%\)) to a full tank (\(100\%\)).  
Table 3 shows the lookup table calibration, which is used to evaluate Equation (4) in each measurement. It can be seen that \(\theta_{below}\) and \(\theta_{above}\) have a space of \(5^{\circ}\); thus, according to Equation (3), there is an accuracy of \(0.625^{\circ}\).  
The first column shows the percentage displayed by the dial gauge. Columns two and three show the normalized voltage level at the output of sensors A and Z, respectively. Column four records the value of the calculated \(\theta\). The fifth column shows the \(\%_{\text{c}}\). The sixth column shows the error between the calibration percentage and the calculated one.  
Figure 5: (a) Dial. (b) \(\theta\) vs. \(\%_{\text{c}}\). When the mechanical float was manually moved from an empty tank (\(0\%\)) to a full tank (\(100\%\)).  
For convenience, percentage precision for the mobile app is rounded to \(+0.5\%\). That is, values with decimals greater than \(0.1\) are rounded to \(0.5\) and decimal values greater than \(0.5\) are rounded to the next higher value, as shown in column seven of Table 3.  
This measurement process is valid for all horizontal stationary tanks of different capacities (\(100\) to \(3400\) L) that use the same magnetic level gauge system (see Figure 1b).