# Absolute Capacitance Measurement by Direct Digital Fitting of Proportional Coefficient
## 3 Measurement Program Design
### Data Smoothing  
In this experiment, during capacitance measurement, the theoretical difference in the wave response varies at each sampling point, and with the passage of time, the slope should decrease, as should the difference value. However, in practical capacitance measurements, due to the quantization error of the ADC and the impact of random noise, especially when measuring high capacitance values, the charging time becomes longer, and the output signal rise curve becomes gentler. This results in smaller differential values after ADC sampling and differential processing, making them more susceptible to quantization errors and random noise.  
Therefore, the smoothing function can effectively address these issues by enhancing the quality of the data and improving the accuracy of capacitance measurement.  
In this experiment, the difference of the analog voltage signal with RC time constant corresponds to the proportion of points, in order to avoid too many effective points are discarded to ensure that the elimination of the impact of noise points, the choice of each point before and after the 25 points for smoothing operation, smooth function smoothing is mainly used in the method of moving average, a sliding window to cover the data sequence, the calculation of the average value of the data within the window or the weighted average value, used to reduce the random fluctuations. After replacing the current value with the mean value of 25 points before and after each point, the k-value is then fitted. The smoothing method is shown in Equation (22), replacing \(z_{1}(n)\) in Equation (16) with the smoothed data \(z_{2}(n)\).  
\[z_{2}(n)=\frac{1}{50}\sum_{n-25}^{n+25}z_{1}(i) \tag{22}\]  
The smoothed data still have the same scaling relationship. The data before and after the smoothing process with a capacitance setting value of 3000 pF are shown in Figure 6.  
The fitted image before and after smoothing, with the value of k at a capacitance setting of 3000 pF is shown in Figure 7. The horizontal coordinates in Figure 7 correspond to \(y_{2}(n)\) in Equation (19), and the vertical coordinates correspond to \(z_{1}(n)\) in Equation (19). It can be clearly observed that the smoothed data processed by Equation (22) effectively suppress the influence of noise points and makes the data have more definite trend.  
Figure 6: Difference of output signal with 3000 pF capacitance before and after smoothing.  
Confidence intervals for slopes are a central indicator for assessing the reliability of a linear relationship. The width of the interval directly reflects the quality of the data and the rationality of the experimental design. We calculated the fitted k-value confidence intervals before and after smoothing and present them in the Table 1  
After the data smoothing process, some of the random errors are eliminated and the interference of noise points is effectively suppressed. It can also be clearly seen in Table 1 that after data smoothing, the range of k-value confidence intervals has been significantly narrowed, which indicates that the data noise has been reduced, the data quality has been improved, and the narrow intervals indicate that the effect sizes are estimated accurately. After smoothing y and x have higher correlation. The effect of systematic random error and ADC sampling error is greatly reduced. The smoothing of the data is improved, which facilitates the subsequent calculation and visualization of the image.