# A Phase Error Correction System for Bioimpedance Measurement Circuits
## 2 Methods  
### Phase Error Analysis  
As earlier stated, bioimpedance involves the injection of low-amplitude alternating current \(i_{out}=i_{o}\sin(\omega t)\) into the biological tissue, where \(i_{o}\) = the amplitude of the injected constant current from the current source. Measured voltage \(v_{meas}\) relative to the reference voltage \(V_{in}\) and affected by the erroneous phase shifts of the VCCS can be expressed as:  
\[v_{meas}=A_{v}i_{0}z_{x}\sin(\omega t-\varphi-\Delta\theta) \tag{1}\]  
where, \(A_{v}\) is the gain of the measuring instrumentation amplifier; \(|Z_{x}|\) is the measured impedance magnitude determined by applying Ohm's Law to the relationship between the measured voltage and the injected current as in Equation (1); \(\angle Z_{x}\) is the measured impedance phase; \(\varphi\) = tissue impedance phase (ideally equal to \(\angle Z_{x}\)); \(\Delta\theta\) = erroneous phase due to frequency dependent delay by VCCS. Demodulation signals were used to further extract impedance data from \(v_{meas}\), including in-phase lock in signals \((v_{-0})\) and the quadrature sinusoidal signal \(v_{-0}\), defined as:  
\[v_{-0}=v_{0}\sin(\omega t) \tag{2}\]  
\[v_{-0}=v_{0}\sin(\omega t+90^{\circ}) \tag{3}\]  
The in-phase demodulation procedure involves multiplying \(v_{meas}\) by \(v_{-0}\), yielding the output of the in-phase multiplier:  
\[v_{multi0 deg}=\frac{A_{v}i_{0}Z_{x}v_{0}}{2}[\cos(\varphi+\Delta\theta)-\cos( 2\omega t-\varphi-\Delta\theta)] \tag{4}\]  
The output of the multiplier \(v_{multi0 deg}\) is also passed through a low-pass filter to eliminate high-frequency components, leaving out the DC components. The output of the low pass filter for the in-phase demodulation is:  
\[v_{LPFudge}\approx\frac{A_{v}i_{0}Z_{x}v_{0}(\cos\left(\varphi+\Delta\theta \right))}{2} \tag{5}\]  
Hence, the real part of the impedance is:  
\[Re=\left(cos(\varphi+\Delta\theta)\right)=\frac{2*v_{LPFudge}}{A_{v}i_{0}v_{0}} \tag{6}\]  
Similarly, the quadrature demodulation procedure involves multiplying \(v_{meas}\) by \(v_{-90}\), yielding the output of the quadrature multiplier \((v_{multi90^{\circ}})\). \[v_{multi90^{\circ}}=\frac{A_{v}i_{0}Z_{x}v_{0}}{2}*sin(2\omega t)*\cos(\varphi +\Delta\theta)-\frac{A_{v}i_{0}Z_{x}v_{0}}{2}*cos(2\omega t)*sin(\varphi+ \Delta\theta) \tag{7}\]  
\(v_{multi90^{\circ}}\) is also passed through the low-pass filter from which the imaginary part of the Impedance (\(Im\)) is derived, as in Equation (8). \[v_{LPF90^{\circ}}=\frac{A_{v}i_{0}Z_{x}v_{0}}{2}sin(\varphi+\Delta\theta) \tag{8}\]  
\[Im=\left(sin(\varphi+\Delta\theta)\right)=\frac{2*v_{LPF90^{\circ}}}{A_{v}i_{ 0}v_{0}} \tag{9}\]  
The impedance magnitude derives from the SD system:  
\[|Z|=Z_{x}\sqrt{cos^{2}(\varphi+\Delta\theta)+sin^{2}(\varphi+\Delta\theta)} \tag{10}\]\(|Z|=Z_{x}*1\cdot\cdot\)_, magnitude is unaffected by \(\Delta\theta\)_  
While the phase is obtained as  
\[v_{-0}=v_{0}\sin(\omega t) \tag{2}\]0  
Although phase delays between the measured voltage of load impedance (\(v_{meas}\)) and I and Q demodulation signals do not significantly impact the magnitude of the measured impedance, they notably affect the precision of the measured impedance phase. Consequently, this result may lead to erroneous assessments and diagnoses in bioimpedance applications that rely on precise detection of the load impedimetric phase. The block diagram shown in Figure 3 illustrates the SD system block incorporating phase correction methodology proposed in this paper. With switches S2 and S3 closed to com 1 and com 2, respectively, the system functions in a closed-loop system, activating the phase compensation mechanism. The output current (\(l_{out}\)) from the current source undergoes constant phase monitoring facilitated by a very low tolerance (Resense) carbon film resistor integrated into a series with load impedance. The voltage output (Vsense) of Resense is precisely measured via an Instrumentation Amplifier (IA) placed very close to Resense, mitigating parasitic capacitance induced by long signal tracks.