DEGREE PROJECT, IN MEDICAL ENGINEERING , SECOND LEVEL STOCKHOLM, SWEDEN 2015
Design and implementation of an
impedance analyzer based on
Arduino Uno
A PILOT STUDY OF BIOELECTRICAL
IMPEDANCE ANALYSIS
JING WANG
Examensarbete inom medicinsk teknik (HL202X) 30hp
2014:13
Design and implementation of an impedance analyzer based on Arduino Uno
Technology and Health
Jing Wang Godkänt 2015-03-25 Recensent Kaj Lindecrantz Handledare Farhad Abtahi Uppdragsgivare Mats Nilsson
Sammanfattning
Mätning med elektrisk bioimpedans är vida använt idag för medicinsk övervakning. Användningsområden inkluderar bland annat bedömning av kroppssammansättning, uppskattning av nutritionsstatus och detektering av cancer. Modaliteterna för att tolka informationen från elektrisk bioimpedans har också utvecklats snabbt över de senaste årtionden, från analys med en frekvens till spektrum och bilder.
Master of Science Thesis in Medical Engineering (HL202X) 30 credits
2014:13
Design and implementation of an impedance analyzer based on Arduino Uno
Technology and Health
Jing Wang Approved 2015-03-25 Reviewer Kaj Lindecrantz Supervisor Farhad Abtahi Examiner Mats Nilsson
Abstract
Electrical bioimpedance measurement is widely used today for monitoring body condition. The applications include and go beyond, body composition assessment, nutritional status evaluation, and cancer detection. The modalities for interpreting the impedance information have also developed quickly over the recent decades from single frequency bioimpedance analysis to spectrum and to images.Bioimpedance is measured by computing the relationship between voltage and current. In a current based bioimpedance measurement system, the stability of current source has a large influence on the performance of the system. This thesis compared three different voltage controlled current sources: enhanced Howland circuit, load‐in‐the‐loop circuit driven by a current conveyor and double operational amplifiers circuit. These circuits were simulated in Multisim and manufactured into prototypes and tested in lab.
ACKNOWLEDGEMENT
1 INTRODUCTION
1.1 Background
Electrical bioimpedance (EBI) technology measures electrical properties of biological materials by means of applying electrical current/voltage to the whole material or regions of interest, sensing corresponding voltage/current and calculating the impedance by using Ohm’s law. EBI value is related to both the resistive and dielectric properties and the geometrical dimensions of the material, so it is possible to monitor not only material composition but also volume. Over the years, research interest on EBI has raised to develop new methods for patient monitoring and diagnosis. Bioimpedance research applications include but are not limited to body composition assessment (BCA) (1), skin cancer detection (2), impedance cardiography (3), breast cancer detection (4), and cerebral monitoring (5). However, in many cases, due to inaccurate models, presence of artefacts, errors in measurement and estimation of bioimpedance, they have not been widely accepted in clinical applications (6).
Bioimpedance instrumentation by using system‐on‐chips (e.g. AD5933) can provide an affordable framework for developing compact systems (7). However, their applications are currently limited to single‐frequency measurements or bioelectrical impedance spectroscopy (BIS) by using frequency‐sweep technique that estimates bioimpedance in one single frequency at a time and repeat to measure a spectrum. To study different source of errors in bioimpedance measurements and estimation, access to current/voltage signals prior to impedance estimation is desired which requires custom design of measuring device. This device can be also useful in study of BIS by using broadband excitation of waveforms like square wave, step function, chirp and multi‐sine. 1.2 Purpose The object of this thesis project is to design a bioimpedance measuring device with an analog to digital convertor (ADC), a digital to analog convertor (DAC), a voltage controlled current source (VCCS) and an Arduino board working as a microcontroller. By building the whole system from scratch, the aim was to understand the system from each component, test the possibility of building it with lower cost and make suggestions for further improvement. To achieve this goal, this project is divided into following tasks: to simulate and compare different VCCS configurations; to make prototypes for the VCCSs and test in lab; to create a voltage source with DAC and Arduino Uno; to collect electrical signal with ADC and Arduino Uno; to collect samples from Arduino Uno in Matlab; to calculate and display the impedance in Matlab; 1.3 Outline
Three describes the methods and components used in the project. Chapter Four presents results of the simulation and lab test of VCCS and presentation of signal generation and collection. Results are discussed in Chapter Five. Chapter Six is the conclusion of the whole project. Chapter Seven describes the future work to improve the project and suggest alternatives to the component or the method used. And the last chapter is about the experience gained from the project.
2 THEORETICAL FRAMEWORKS
2.1 Circuit theory 2.1.1 Electrical impedance Electrical impedance (Z) is a measure of opposition to the current flow in a circuit (Figure 1). It can be written as a complex in the Cartesian form or the polar form: jZ
R
j X
Z e
. [1]is a measure of the material’s ability to conduct a current. And is the permittivity of the medium between two planes which can be further extended to , where is the relative permittivity of the material and is the dielectric permittivity of vacuum. This parameter is related to the polarization of medium in response to the electric field. A high permittivity denotes easy transmittance of electric field through the medium. is the frequency of the applied electric field. (8)
Figure 3 A capacitor model.
2.2 Electrical properties of living tissue 2.2.1 Cell model
A cell is the most fundamental structural and functional unit in living tissues. The cell membrane, which has a phospholipid bilayer structure, separates the intracellular fluid (ICF) from the extracellular fluid (ECF). The intracellular and extracellular mediums are both electrolytes. They contain ions that can move around the fluid, transport electrical charges and therefore conduct electrical currents. The concentrations of some major ions in ICF and ECF are shown in Table 1. Table 1 Concentration of major ions in body liquids. Adapted from (9) Concentration (meq/L)
Na+ K+ Ca2+ Mg2+ Cl‐ HCO3‐ Protein HPO42‐
ICF 10 100 ‐ 123 2 8 55 149
ECF 142 5 5 2 105 24 16 2
The cell membrane can be considered as a dielectric. It has a very low conductance. So the ECF, membrane and ICF form a conductor‐dielectric‐conductor structure, which is an analogy to a capacitor in the circuit.
Figure 4 Equivalent electrical model of a cell. Re represents resistance of ECF. Ri represents resistance of ICF. Rm represents resistance of membrane. And Cm represents capacitance of membrane. (8) Based on the model introduced above, the impedance of a cell can be written as:
1 1 1 e i e i e i R j CR Z R R j C j C R R
[4]At low frequencies, the electrical current is impeded by the membrane. So the ECF plays a major role in conducting electrical current. In the extreme case, when a DC current is applied, the measured signal would be related only to ECF. This could also be demonstrated with the equation above. When the frequency → 0, the expression for the impedance could be written as:
Z
R
e. [5] At high frequencies, the electrical current passes through the membrane and the measurement is dependent on both ECF and ICF. 2.2.2 β dispersion
Figure 5 Frequency dependence of permittivity and conductivity of living tissue (11).
β dispersion includes the frequency range from 1kHz to several Mhz. This dispersion is considered to be related to the behavior of membrane. The properties of cells are mainly influenced by dielectric properties of membrane and the process of charging and discharging the membrane. Because of this reason, the measurement of electrical bioimpedance is usually performed in this range. And for single frequency bioimpedance analysis, the frequency is typically 50kHz.
2.3 Bioimpedance measurement system design
There are two methods to obtain the impedance. One is to inject an electrical current and measure the corresponding voltage. Another method is to apply voltage to the object of interest and measure the current. Both methods are used in bioimpedance measurement, and both have their advantages and limitations. Compared to the BIA device that applies voltage to the target, the current based BIA is able to manage currents within medical safety limits more easily. Besides, it suffers less noise due to spatial variation and produces better bioimpedance tomography results. However, current source gives poor performance at high frequency due to its decreased output impedance. Voltage sources applications work with higher bandwidth, however low dc SNR. (12) The current source based BIA is more commonly used in the EBI measurement devices today. In this thesis work, the focus will be the impedance measurement system with a current source.
2.3.1 Electrodes and connection
Bioimpedance measurement devices typically consist of two major functions: first inject an alternating current to the biological material and then measure the potential difference from two ends. Fulfilling these two functions requires two, three or four electrodes (13). Two‐ electrode method and four‐electrode are introduced here. Three‐electrode method is not very common. One example using three‐electrode method can be found in (14).
Figure 6 Biopolar bioimpedance measurement system (a) and its equivalent electrical circuit (b). So the two‐electrode method only works when the impedance of the tested material is much higher than the impedance of electrode contacts at the BIA working frequency. If a BIS device is used, two‐electrode method is not an option because the impedance at electrode‐electrolyte interface is susceptible to frequency variations. (15) Four‐electrode system The four‐electrode system is also known as tetrapolar system. It uses separate electrode pairs to inject current and measure voltage. Figure 7 Tetrapolar bioimpedance measurement system (a) and its equivalent electrical circuit (b). Assuming the voltmeter is ideal, the measurement result will involve only the impedance of the tested material. This makes the four‐electrode method most commonly used in today’s bioimpedance measurement.
In practice, however, the impedance at the contact sites still has an impact on the measurement because of common voltage introduced by contacts’ impedance and common mode rejection ratio (CMRR) of the differential amplifier in the voltmeter. (15) (16)
2.3.2 Current generation
An alternating current source can be obtained by combining a voltage generator with a voltage‐ to‐current convertor circuit. For a current source, high output impedance is desired in EBI measurement, especially in BIS where the working frequency goes up to several Mhz. However, the output impedance of a current source drops as the frequency increases. This is caused by the parasitic capacitances that come from many components in the circuit, for example between electrodes. The output impedance of the current source should be at least 100 kOhm (17).
Sinusoidal signal generation
One example of analog method is to use a sinusoidal oscillator that converts DC power to a periodic waveform. This method requires complexity in circuits and high accuracy in some of the electrical components. And it lacks flexibility compared to digital methods. Generating waveforms with digital modules is called direct digital synthesis (DDS). The block diagram below shows the idea of a simple DDS system (Figure 8) (18). DAC takes values from a look‐up table where the address counter points. As the counter steps through the look‐up table repeatedly, a periodical wave is obtained from the DAC output. The low‐pass filter (LPF) after the DAC filters out the high‐frequency harmonics and makes the curve smoother. VCCS Many studies have been conducted on the VCCS design to achieve as large output impedance at high frequencies as possible (17) (19). Some typical VCCS configurations include Howland circuit, load‐in‐the‐loop circuit, etc. More detailed descriptions can be found in Section 3.3.1.
2.3.3 Impedance analyzing
One of the most popular methods for analyzing the impedance of biological material is the quadrature demodulation (QD) method (20). The basic idea is introduced here.
Consider
i t
I
cos(
0t
)
, by adding the phase shift
caused by the impedance Z, theexpression of voltage can be written as:
0
0 0
( )
( )
cos(
)
=
cos(
) cos
sin(
) sin
v t
Z i t
I Z
t
I Z
t
I Z
t
, [6]where the two items are in phase and in quadrature with the injected current. Then the impedance Z can be expressed as:
cos
sin
Z
R
jX
Z
j Z
[7]In the upper branch, the voltage is multiplied by
cos(
0t
)
, so the signal before low‐pass filter is:1 0 0 0 0 0 ( ) ( ) cos( ) cos( ) cos( ) 1 cos(2 ) sin(2 ) ( cos sin ) 2 2 v t v t t I Z t t t t I Z
[8] The high frequency components are filtered out by the low‐pass filter, so the output contains only 1 cos 2I Z
which can be written as 2 I R . Similarly, the output of lower branch is 2 I X Figure 8 Block diagram of a simple DDS system. Address counter Look‐uptable Register DAC LPF
Figure 9 Quadrature demodulation method. Other impedance analyzing methods include measuring the amplitude and phase using Gain‐ phase detector (21), bridge method (22), etc. 2.4 Communication protocol
Communication between devices requires a common language that could make data identifiable. Communication protocols are such rules that define the formats of data and may contain other information like the speed of transmission, the order of data bits, direction of operation, etc. 2.4.1 I2C Inter‐integrated circuit (I2C) is a multi‐master and multi‐slave protocol. It uses two bidirectional signal lines. One is the serial data line (SDA) for data transmission, and the other is the serial clock line (SCL) for two‐wire interface clock frequency. Figure 10 I2C connection with one master and three slaves (23)
Figure 11 SPI communication with single master and single slave (24)
2.4.3 I2C vs. SPI
Both I2C and SPI are commonly used in electronic devices. However, they have some important
differences that make them suitable for different purposes. Understanding the difference between I2C and SPI helps to select a proper interface for certain project. Two aspects are
discussed below:
Wiring: I2C is a two‐wire interface, while SPI typically requires 3+N signal lines for N slave
A typical Arduino program has two major functions: setup(), which runs in the beginning of a program and initializes settings; and loop(), which is called repeatedly to fulfill desired tasks.
Figure 12 Arduino Uno front (25).
3 METHODS
3.1 System Implementation
A simple impedance measurement system was implemented in this thesis. Arduino Uno was used as a microcontroller. It wrote to a DAC and generated a sine waveform. A low‐pass filter was connected to the DAC output to smooth the signal and a high‐pass filter was connected after the low‐pass filter. The high‐pass filter was used to remove the DC component from DAC output, since the output range of DAC used in the project was 0‐5V (27). The voltage source would then be transferred to a current source after VCCS. A DC offset was added to the voltage signal over the RC model to fit the analog input range of ADC. The ADC measured voltages over the RC model and a reference resistor. Voltage data was then sent to Arduino Uno. Finally, samples were sent to Matlab and impedance was calculated and displayed in Matlab. The block diagram of major function blocks in the system is shown in Figure 13 below. 3.2 Source generation 3.2.1 Generating waveforms from look‐up table A sinusoidal voltage signal was generated from DAC using the DDS method. To generate this waveform, a sine wave look‐up table is needed. The look‐up table stores both amplitude and phase information of a sine (or cosine) wave. When reading from the look‐up table continuously, the index of the amplitude value increases and so does the phase of the output waveform. To achieve n‐bit resolution, a sinusoidal cycle is divided into 2n phase points (Figure 14). If these points are read by DAC successively without skipping points, the frequency of the output waveform obtained will be: 1 2 out n in f f [9] Figure 13 Simplified block diagram of the impedance measurement system. I DC power supply VCCS Microcontroller (Arduino Uno)
DAC V 2R1C model V ADC Matlab
Figure 14 A sinusoidal cycle is divided into 2n points.
The frequency is changeable by changing the input clock frequency, rewriting the look‐up table or skipping points.
In our project, the sine wave look‐up table was stored in the flash memory of Arduino. To achieve the highest frequency, 32 points were taken for one sinusoidal cycle.
3.2.2 MCP4725
MCP4725 (27) is a single channel 12‐bit DAC supporting I2C interface. This chip is chosen
because it is easy to use. It has three modes: standard mode supports a baud rate of 100 kbps; fast mode supports a baud rate of 400 kbps; high‐speed mode supports 3.4 Mbps. The maximum SCL clock frequency supported by ATmega328 on the Arduino Uno board is 400 kHz (28). So it is only possible to use standard and fast mode with Arduino Uno. Fast mode communication was used in the thesis to get as high speed as possible with available hardware components. Commands that need to be written in the microcontroller are shown in Figure 15. The output voltage is given by: 4096 REF n OUT V D V [10]
where equals to the single power supply and is the input code. In our case, is 3.3 V from Arduino Uno board. The output signal ranges from 0 to 3.3 V. And the smallest voltage difference that MCP4725 can produce is 0.8 mV.
Arduino Uno supports two‐wire interface communication with the wire library. Common commands include: Wire.begin() to initiate the wire library, Wire.beginTransimmission(address) to begin transmission to the I2C device with the given address, Wire.endTransmission() to end the
Seoane et al (30) proposed an enhanced version based on simple load‐in‐the‐loop configuration. A current conveyor was added to the first stage so that the output current would be independent of the value of resistor R3 that is connected to the inverting input of the second stage. This resistor can be changed to get higher output impedance (Figure 17).
Figure 17 A single Op‐Amp VCCS circuit driven by current conveyor. (30)
Figure 18 shows a simplified equivalent schematic of AD844. The current flowing between the input nodes gets replicated and flows in resistor Rt. In the method proposed by Seoane et al, this current was connected to the next stage via AD844 Pin 5. The amplitude of current in Figure 17 can be calculated approximately by: 1 1 IN V I R R [12] where the typical value of RIN is 50 Ohm (31) Figure 18 Equivalent circuit of AD844. (31) Enhanced Howland circuit
1 1 s z L
Z
i
I
R
[17] When the switch S is open: 2 2 s zi
i
I
[18]
2 2 s z LZ
i
I
P
R
[19] Subtracting Equation [16] and [18]: 1 2 z2 z1I
I
i
i
I
[20]Subtracting Equation [17] and [19], and substituting with [20], can be calculated from equation:
2 1
/
s L LZ
I
P
R
I
R
I
[21] 3.3.3 Simulation Software environmentThree VCCS configurations: load‐in‐the‐loop circuit driven by a current conveyor; enhanced Howland circuit and DOA circuit were simulated in Multisim. Multisim is a powerful simulation environment developed by National Instruments. It has a large number of components in the library, which makes it convenient to build a circuit, simulate it and monitor the signals.
Besides the inbuilt modules like oscilloscope and multimeter, Multisim software offers two convenient functions that analyse frequency response of a circuit:
AC analyse ‐ This function shows the value of chosen parameters over a range of frequencies. Single frequency AC analysis ‐ This function shows the value of chosen parameters at a single frequency. The user can choose either to display the result in real/imagery form or magnitude/phase form. Output impedance measurement The output impedances were measured according to 3.3.2. P was set to 500 Ohm and RL was set to 200 Ohm. The current flowing through the load was measured. Output current measurement The output currents were measured with a load of 470 Ohm. Then the values were normalized by dividing the output current at the lowest frequency. 3.3.4 PCB prototyping
After simulation, the circuits were drawn in Eagle 7.1.0 (See Appendix A) and printed circuit board (PCB) files were generated (See Appendix B) and sent to milling.
3.4.1 Signal collection setup Two voltage levels were measured with the setup shown in Figure 22. A reference resistor was connected in series with the tested load. The voltage over the reference resistor is linear to its current flow, so the phase information of electrical current was obtained. Signals went through a voltage lifting circuit (34) before entering ADC to match the ADC’s analog input range. Figure 22 Block diagram for signal measurement 3.4.2 MCP3008
MCP3008 (35) is an 8 channel 10‐bit ADC with SPI Serial Interface. It operates with a single power supply ranging from 2.7 V to 5.5 V. The maximum sampling rate is 75 ksps at VDD = 2.7 V and 200 ksps at VDD = 5 V. According to Nyquist‐Shannon sampling theorem – the sampling rate should be higher than twice the value of the maximum frequency in the signal to avoid aliasing. Theoretically MCP3008 is able to sample 100 kHz signal at 5 V, which is not sufficient for BIS measurement that deal with frequencies up to Mhz. However, because the signal generated in this thesis is way below 100 kHz, MCP3008 is enough for signal sampling.
Figure 23 SPI Communication with the MCP3008 (Mode 0,0: SCLK idles low).
To get the SPI communication to work, the Arduino sends command bits to the ADC chip. This configures the ADC chip to work in either single‐ended or pseudo‐differential input mode and select channel for the analog input.
In single‐ended mode MCP3008 can measure analog inputs between 0 and VREF (3.3 V). And in
pseudo‐differential mode the IN‐ should be within (‐100 mV, 100mV), and IN+ should be within (IN‐, VREF +IN‐). However in our case, the voltage to be measured was bipolar. So a voltage
lifting circuit was used before connecting to ADC.
Arduino has a SPI library to support the communication between Arduino and SPI devices. Detailed information could be found in (36). 3.4.3 Communication between Arduino Uno and Matlab Since Arduino Uno has no file system, it is impossible to save data using Arduino Uno alone. Data processing is time consuming, so it is inefficient to do it in the Arduino sketch. Exporting data to other software to save the file somewhere on the computer or process data and display result is necessary. Matlab was chosen in this project for its convenience to communicate with Arduino Uno. Matlab is able to communicate with Arduino Uno in four different ways.
shield and WiFi shield. Users can connect these blocks with other existing blocks in Simulink, modify the parameters and program the Arduino board without even write any command.
Figure 24 Arduino common blocks. (39)
The third method is to use Matlab serial port interface capability. It treats Arduino with no difference from any other devices that want to send data to Matlab and do further data processing in Matlab. Sketches that manipulate I/O pins are written with Arduino software and uploaded to the board. In the Arduino software, a serial monitor takes and displays strings or numbers from the serial port. Matlab can read from the serial port when the serial monitor is closed and the serial port is not occupied.
The fourth method is to use Simulink to receive data from the serial port in real time. This is achieved by using serial port interface blocks, such as Serial Receive, Serial Send, Query Instrument and To Instrument.
In our project the command lines for controlling Arduino Uno board was written in Arduino software. On the Matlab side, the codes created a serial port object and read data from the port.
3.5 Results display
Arduino sends samples to the serial port. Matlab reads from the serial port and performs further processing and calculations on the data.
3.5.1 Matlab GUI
Since a reference resistor is connected in the circuit (Figure 22), and one of the channels measures the voltage over both tested load and reference, the load value and reference resistor follows the relation in Equation [23]: signal LOAD REF
V
Z
R
I
[23]This equation can be extended assuming
Z
LOAD
R
LOAD
j X
LOAD. The resistance and reactanceof the load can be calculated from: 2 2 1 2
(
)
/
tan(
)
signal REF LOAD ref REF REF LOADV
R
R
X
V
R
X
c
c
R
R
[24]4 RESULTS
In this chapter the output of signal generation, VCCS and signal collection are presented. 4.1 Signal generation The voltage signal was generated with 12‐bit DAC chip MCP4725 (Figure 25.Channel 1). Angles can be seen clearly on the waveform. An RC low‐pass filter was applied to the output signal to attenuate high‐frequency harmonics from the waveform. After that, an RC high‐pass filter was added to remove the DC offset. A smooth sinusoidal wave with around 3.3 Vpp was obtained. The SCL signal frequency from Arduino was around 278kHz. Figure 25 DAC output waveform (Channel 1, up) and waveform after low‐pass and high‐pass filtering (Channel 2, down). 4.2 VCCSThe output impedance and output current of the three VCCS configurations at frequencies 1kHz, 10kHz, 50kHz, 100kHz, 300kHz, 1MHz and 2MHz were simulated in Multisim. PCB prototypes were tested in lab.
Figure 26 Simulation results of three VCCS configurations’ output impedance over frequency from 1kHz
to 2MHz.
Table 4 Output impedance of three VCCS configurations, simulation result.
Load‐in‐the‐loop
circuit driven by current conveyor Enhanced Howland Double Operational Amplifier
Frequency(Hz) Zout(Ω) Zout(Ω) Zout(Ω)
1k >1.0M >1.0M >1.0M 10k >1.0M >1.0M >1.0M 50k >1.0M >1.0M >1.0M 100k >1.0M >1.0M >1.0M 300k >1.0M >1.0M >1.0M 1M ‐ 235.0k 242.8k 2M ‐ 65.9k 63.0k Figure 26 and Table 4 contains the output impedance of these three configurations from 1kHz to 2MHz in simulation. All circuits maintain high output impedance over a wide frequency range and show variance as the frequency increases. At the highest frequency 2MHz, enhanced Howland circuit and DOA circuit have output impedance around 60kOhm. The curve for load‐ in‐the‐loop circuit driven by current conveyor shows abnormal behavior compared to other two circuits. 103 104 105 106 107 -4000 -2000 0 2000 4000 6000 8000 10000 12000 14000 16000 Frequency [Hz] Out put i m ped an c e of V C C S [k O h m ] Enhanced Howland,simulation DOA,simulation
Figure 27 Simulation results of three VCCS configurations’ output current over frequency from 1kHz to
2MHz.
Seeing from the output current results in Figure 27, the enhanced Howland circuit shows the least variation at a very high frequency.
4.2.2 PCB
Boards for three VCCS configurations are shown in Figure 28, 29, 30. Components were soldered in lab. Figure 28 PCB for load‐in‐the‐loop circuit driven by current conveyor Figure 29 PCB for enhanced Howland circuit 103 104 105 106 107 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1 1.02 Frequency [Hz] O u tp u t c u rr en t o f V C C S /C u rr e nt @l ow e s t fr equ enc y Enhanced Howland,simulation DOA,simulation
Figure 30 PCB for double Op‐Amp circuit
Figure 31 PCB tested results of three VCCS configurations’ output current over frequency from 1kHz to
2MHz.
Curves in Figure 31 show output current results from testing PCB in lab. The curves have fluctuations. This is partly due to some errors when reading amplitude values from the oscilloscope. The amplitude values shown in the oscilloscope was not stable. The last two points on the load‐in‐the‐loop circuit driven by current conveyor curve are inaccurate. Because at 1Mhz and 2Mhz frequencies, the output waveforms have distortion.
For current amplitude confirmation, DAC was connected to the DOA circuit. And the output of DOA circuit was connected to a pure resistance load of 330 Ohm. The peak‐to‐peak value of output current was around 1.6 mA. 103 104 105 106 107 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1 1.02 Frequency [Hz] O u tp u t c u rr en t o f V C C S /C ur re n t@l ow es t f re que c y Enhanced Howland,lab DOA,lab
Figure 32 Waveform after high‐pass filter (Channel 1, up) and voltage over a 330 Ohm load (Channel 2,
down).
4.3 Signal measurement and display
The frequency generated from DAC was very low (below 10Hz) when working together with ADC chip. So this part of test was conducted using signal generator in the lab as the input voltage to VCCS. The input voltage was set to 200 Hz, 2.4 Vpp. VCCS output was then applied to the load connected in series with a reference resistor (Figure 22). Samples were sent to Channel 0 and Channel 1 of MCP3008.
Before clicking the “Calculate” button, the value of reference resistor must be entered into the software.
Figure 34 An example of impedance calculation.
5 DISCUSSION
5.1 Impedance measurement system
Using a DAC device with I2C interface is not a good choice for projects that demand high
speeds. The microcontroller ATmega 328 on the Arduino Uno board supports a maximum serial clock of 400 kHz for two‐wire interface. In principle, with DAC working on the fast mode, the maximum sine frequency generated per second should be around 400000 (bits transferred per second) / 29 (bits for one data points, including three bytes command and data, one start bit, one stop bit and three acknowledge bits)/32 (data points in one sinusoidal cycle). The result is around 4.3 kHz. However, in practice the frequency of voltage signal generated from MCP4725 could only go up to around 260 Hz. The serial clock was measured in lab to be around 278 kHz. This serial clock frequency explains the reason for a maximum signal frequency of less than 300Hz in the real test.
Three VCCS configurations were simulated, tested and compared. For both enhanced Howland circuit and Double Op‐Amp circuit, the symmetry of circuit components is expected to contribute to higher output impedance. This lays demands on the accuracy of the resistors. In the load‐in‐the‐loop circuit driven by a current conveyor, AD844 was used as the current conveyor and LMH6655 was used as the amplifier in the second stage. According to Equation [12], the output current could be regarded simply as the ratio between V1 and R1 when R1 is very
high compared to RIN (Figure 17). Increasing the value of the resistor R3 connected between Pin
5 of AD844 and inverting input of LMH6655 is considered to be beneficial to higher output impedance according to the equation for output impedance in (30). When changing R3, the
linearity of the system should be closely monitored to get reliable results. In the lab test, the value of R3 was set to 6.5kOhm as in (30), and the desired output current was 1mA, the voltage
level at Pin 5 of AD844 went up to around 6.5V. This requires the power supply of AD844 to be higher than 6.5V. Otherwise the output waveform will be flat during certain part of a cycle. To power up both AD844 and LMH6655, more power supplies were used in the load‐in‐the‐loop circuit driven by a current conveyor compared to the other two configurations. Besides, the simulation and lab test results for this method show abnormity at 1Mhz and 2Mhz. The output impedance has an increase at very high frequencies in simulation, and waveforms have distortion in the lab test. More reasonable simulation results could be found in (30).
The measurement used two single‐ended analog input channels of MCP3008. So the common mode signal stayed in the input and could lead to inaccuracy in sampling. To eliminate or reduce the effect of common mode signal in the input, pseudo‐differential mode input should be tested in future experiment. In terms of sampling speed, the maximum sampling rate of MCP3008 is 75ksps, which means it can sample 37.5 kHz sine wave according to Nyquist‐ Shannon sampling theorem. Two channels work alternately. This will reduce the sampling rate to half. But even if there is a need to sample the signal at higher frequencies, undersampling technique can be applied to recover the original signal.
The signal collection in Matlab is not stable. Reading from serial port is not always successfully executed probably because that some data is missing in the transmission process. Before deciding to use Matlab to interface with Arduino, Processing software was tried. Received data had blank lines or half blank (i.e. “1 1” was sent but only ”1 ” was received).
The interpolation method used in impedance analysis is sometimes time consuming and sometimes it exceeds the maximum evaluation values and ends without any optimum solution. Besides, the performed interpolation result is easily influenced by the samples used. In the result for 2R1C model measurement, the amplitude ratio between two channels of samples is around 3.5, which is bigger than the expected ratio calculated from circuit theory. This is possibly caused by parasitic capacitor over the reference resistor, or errors introduced from voltage lifting circuits.
The phase shift in the test with two pure resistors as load was tried as a phase calibration option in testing the 2R1C model. The reactance of the calibrated goes nearer to the calculated value, however the resistance part separates farther. More tests should be done to draw a conclusion. Measuring the amplitude and phase of signal to analyse the impedance is intuitive.
The whole system was tested on the breadboard. The analog modules on the breadboard includes an RC low‐pass filter, an RC high‐pass filter, two voltage lifting circuits, a reference resistor and a 2R1C model to be tested. All the jumpers together make the parasitic capacitor even more complex and introduce larger errors to the system.
5.2 Safety considerations
For the safety of patients, the current from EBI measurement device injected to human body should be bipolar with an average current 0. If an electric signal with DC offset is applied, there will be electrons accumulated and may cause damage to living tissues.
The amplitude of the current should be as low as possible. Many research studies limit the maximum current to 1mA, which is less than the threshold of perception.
6 CONCLUSIONS
The EBI measurement system was studied in this thesis work. A system using Arduino Uno to generate sine wave from DAC MCP4725 and collect samples with DAC MCP3008 was tested. Three different VCCS configurations were simulated and tested with PCB in practice. Finally, a simple GUI was implemented in Matlab to display and process data. The system is still quite preliminary. It fulfills most of the functions in an impedance analyzer but with poor performance. Further improvements need to be done.
7 FUTURE WORK
7.1 Recommendation
One problem is related to the speed of signals generated in the system. One Arduino Uno alone is not sufficient for controlling both DAC and ADC and transfer data at the same time. Suggestions would be to use a higher speed microcontroller and high‐speed DAC and ADC chips, for example AD5764 from Analog Devices. It is a 16‐bit high‐accuracy DAC compatible with SPI interface. And for the measurement part, data acquisition devices can be considered for fast data sampling.
To reduce the jumpers needed in the experiment setup, I would recommend using a DAC chip with bipolar output and ADC with differential anolog inputs. In this way the parasitic capacitance in the system will be reduced.
In a bioimpedance analysis system, it is not important to visualize data in real‐time. So it is advisable to store data first and send the package to computer after signal collection.
The calculation steps for the impedance will be clearer if the voltage over the load can be measured directly instead of calculating from the load and reference combination as was done in this thesis. It is advisable to connect the voltage over the load to an instrumentation amplifier before it goes to the ADC input. For impedance analysis section, system design environment like Simulink and Labview could be considered. Many analog and digital functional modules are available in the software. The QD method, for example, can be tried in Simulink. 7.2 Future work
The bioimpedance measurement system in this thesis is only considered as a pilot study. As readers can see from the results and discussion parts, there are needs for improvement from many aspects. The goal is to implement a low‐cost bioimpedance measurement device compared to those that are available on the market.
Apart from that, in future work, how to build a multi‐frequency current source, how to extract signals from samples, how to design a multi‐channel system and how to fit the device to clinical needs are problems to be considered.
8 EXPERIENCE GAINED
Both hardware and software development are involved in this thesis project. This makes it interesting however complex. Of course I learned a lot about hardware, interface between devices and knowledge on this topic. But the points I want to stress is about something else. The most important lesson I have learned from the project is time management. I have to admit I did not do very well in time control. Some problems were related to external or unexpected forces, for example shipment of the components, DAC board broken in the last month. But more were caused by being unfamiliar with the contents and underestimating the time needed for completing sub‐tasks. I will definitely start everything as early as possible for the tasks in the future. And I think this applies for any project and every people.