The measured data from the 14-bit ADC is buffered and sign-extended to 16-bit format. The amplitude of the input signal is adjusted by using a PGA to avoid overflow. The gain of the PGA can be controlled manually, setting its gain to a fixed value, or it can be controlled automatically by the FPGA. The received data are demodulated using the phase-sensitive (I/Q) detector.

#### 2.4.1. Phase-Sensitive Demodulation

Phase-sensitive demodulation (PSD) is a simple and reliable demodulation method to calculate the in-phase (I) and quadrature (Q) components of the measured voltages. However, it needs two demodulation blocks for each frequency to be demodulated simultaneously, which can become costly in terms of FPGA resources if the number of frequencies acquired simultaneously is too high. A workaround is to perform the demodulation multiple times for the same data set [

17].

Considering a number of frequencies

n, the measured voltages (

${V}_{\mathrm{meas}}$) modulated by the body are represented by:

where

${A}_{i}$ is the modulated amplitude and

${\phi}_{i}$ is the phase induced by the tissues impedances, for each frequency

${w}_{i}$.

The demodulation of the I and Q components for each frequency is performed separately by multiplying the measured signal

${V}_{\mathrm{meas}}$ with the original sine and cosine of each frequency, respectively. For that, a dedicated multiplier of a XtremeDSP Slice is used. Although the theory of PSD is well-known [

29], we provide a supplement with the intermediate steps of the demodulation for convenience to the reader. The following equations show the generalized

${I}_{i}$ and

${Q}_{i}$ component of a frequency

${w}_{i}$.

Figure 6 presents the compact block diagram of the demodulation implemented in the FPGA for both

I and

Q components, of the 16-bit signal extended (16 ext) measured voltages. This block is repeated for each frequency

${\omega}_{i}$.

A Cascaded Integrator-Comb (CIC) filter was used for low-pass filtering. CIC filters are similar to moving average filters in which, in each step, the filter is implemented recursively, adding the next sample and subtracting the last. They are a special class of digital linear-phase finite impulse response (FIR) filters used for decimation and interpolation [

30]. It is advisable to use CIC filters as an alternative to other FIR filters, when high sample rate changes are desired.

Figure 7 shows a 4-stage CIC decimator. It has four cascaded integrator stages, followed by a decimator of factor R (sample rate change) that, in turn, is followed by four comb stages. The CIC filters only use additions and subtractions, and do not employ multipliers [

30]; this is why they are a good option for FPGA implementations.

As the CIC core of the FPGA only allows signals of 24-bit maximum, the precision of the multiplication result (32-bit) had to be reduced (rounded). The CIC was configured as one channel decimation filter with four stages N and a differential delay M = 1. The sample rate change R was set to be programmable depending on the frequency used, and has an absolute maximum of 8192 samples. The window has to contain an integer number of complete periods of the frequency ${\omega}_{i}$. The output width was fixed to 32-bit using truncation quantization.

Sequentially, the resultant I and Q components are saved in separated FIFOs, each containing the 208 values of 32-bit corresponding to one complete cycle, i.e., one EIT frame.

As mentioned in

Section 2.3, our system makes uses of multiplexers and two of them are connected only to the even electrodes and the other two only to the odd electrodes. Furthermore, the differential amplifier connected to the output of the multiplexers has its positive pole connected to the multiplexer of the odds electrodes and the negative pole connected to the one of even electrodes. Hence, when measuring between electrode 1 and 2 (“V

${}_{\mathrm{1-2}}$”), and after between 2 and 3 (“V

${}_{\mathrm{3-2}}$”), the signal of the second measurement will be inverted relative to the first one as depicted in

Figure 8, and so forth. Thus, due to the difference amplifier, in every second voltage measurement the signal is inverted. Because of this system configuration, we are limited in the combinations of measurements we can perform, and thus this influence has to be corrected.

Analogue to the current injection pair, in which the even and odd electrodes are connected to

${180}^{\circ}$ (

π radians) phase shifted signals, working one as source and the other as sink, and therefore the injected signal is inverted for every second electrode pair. When demodulating an inverted measured signal, using a non-inverted reference signal, the I and Q components will be inverted:

The correction of this signal inversion was performed in the processing after the demodulation by the software at the PC. For that, the 208 values of the I and Q components were corrected by multiplying these signals with an array containing 208,

$-1$ or 1 values, since

$sin({\omega}_{1}t+\pi )=-sin\left({\omega}_{1}t\right)$ and

$cos({\omega}_{1}t+\pi )=-cos\left({\omega}_{1}t\right)$. Only the values multiplied by

$-1$ are inverted. The correction array

c is a combination of both, the inversion provoked by the voltage measurement and the inversion provoked by the current injection.

Figure 9 is an example of the correction of the signal inversion.

To consider the interaction between the conductivity (in-phase) and permittivity (quadrature) of the measured signals (whose inversion was previously corrected), the amplitude (

A) and the phase (

φ) were calculated in Matlab and were obtained from the following equations:

In Matlab, the phase is calculated using the function atan2 or angle, which returns the four-quadrant inverse tangent, in combination with the function unwrap to correct the radian phase angle jumps.

As frequency-difference images of amplitude as well as phase are intended, further attention is required when treating the phase component. The resultant phase

${\phi}_{i}\left[\mathrm{rad}\right]$ is frequency-dependent. Thus, it must first be converted to time shift

$\Delta {t}_{i}$ in seconds, in order to be comparable between frequencies:

To suppress the amplitude and phase dependencies at different frequencies of the measurement device itself, the data are normalized. For the amplitude at each frequency (

${A}_{i}$), the amplitude is normalized by its maximum of the 208 values:

so that all the values are between a value near 0 (but not 0) and 1.

The phase, in this case as time shift, is normalized by subtracting the mean value of the time shift (

$\overline{\Delta {t}_{i}}$) of a frame (208 measurement values), so that the relative time shifts in seconds relative to its mean stay the same. Only the offset time shift, generated mostly by the measurement system itself, is canceled:

Thus, the time shifts for both frequencies are centered at 0.

Finally, the frequency-difference data of the amplitude (

${d}_{A}$) and time shift (

${d}_{\Delta t}$), necessary for the reconstruction, is given by:

where

${f}_{1}$ is the lowest frequency, and the

${f}_{2}$ the highest one.