design and implementation of an impedance analyzer based on

52
DEGREE PROJECT, IN , SECOND LEVEL MEDICAL ENGINEERING STOCKHOLM, SWEDEN 2015 Design and implementation of an impedance analyzer based on Arduino Uno A PILOT STUDY OF BIOELECTRICAL IMPEDANCE ANALYSIS JING WANG KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF TECHNOLOGY AND HEALTH

Upload: lamdien

Post on 20-Jan-2017

256 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: Design and implementation of an impedance analyzer based on

DEGREE PROJECT, IN , SECOND LEVELMEDICAL ENGINEERING

STOCKHOLM, SWEDEN 2015

Design and implementation of animpedance analyzer based onArduino Uno

A PILOT STUDY OF BIOELECTRICALIMPEDANCE ANALYSIS

JING WANG

KTH ROYAL INSTITUTE OF TECHNOLOGY

SCHOOL OF TECHNOLOGY AND HEALTH

Page 2: Design and implementation of an impedance analyzer based on
Page 3: Design and implementation of an impedance analyzer based on

  I 

 

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.  

Biompedans erhålls genom att ta fram sambandet mellan ström och spänning. I ett strömbaserat 

bioimpedans‐system  har  spänningsskällans  stabilitet  en  stor  inverkan  på  systemets 

prestanda. Det  här  examensarbetet  jämförde  tre  olika  spänningsstyrda  strömkällor:  en 

förbättrad Howland‐krets, en load‐in‐the‐loop‐krets drivs av en ström transportör och en krets 

med dubbeloperativförstärkare. Dessa kretsar simulerades i Multisim och producerades sedan 

som prototyper och testades i labb.  

Försök har även gjorts med att generera och samla in signaler med digital‐analog omvandling 

och analog‐digital omvandling. De kontrollerades av Arduino Uno och impedans analyserades 

i Matlab. 

Page 4: Design and implementation of an impedance analyzer based on
Page 5: Design and implementation of an impedance analyzer based on

  III 

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. 

Effort has also been made  to generate and collect signals with digital‐to‐analog convertor and 

analog‐to‐digital  convertor.  They  were  controlled  by  Arduino  Uno  and  impedance  was 

analyzed in Matlab. 

Page 6: Design and implementation of an impedance analyzer based on

  IV

 

Page 7: Design and implementation of an impedance analyzer based on

   

ACKNOWLEDGEMENT

First  I  would  like  to  thank  my  supervisor  Farhad  Abtahi  for  his  invaluable  support  and 

guidance during the project. 

I would also like to thank all my friends here for their company.  

Finally, I would  like  to  thank my parents who have supported me and have been waiting for 

me throughout the whole master program. 

Jing Wang 

Stockholm, January, 2015 

 

Page 8: Design and implementation of an impedance analyzer based on
Page 9: Design and implementation of an impedance analyzer based on

   

NOMENCLATURE

Notations

Symbol Description

Z      Impedance (Ohm) 

R      Resistance (Ohm) 

X      Reactance (Ohm) 

I      Current (A) 

V      Voltage (V) 

ω      Frequency (rad/s) 

Y      Admittance (S) 

G      Conductance (S) 

B      Susceptance (S) 

C      Capacitance (F) 

σ      Conductivity (S/cm) 

ε      Permittivity (F/cm) 

Re      Resistance of extracellular fluid (Ohm) 

Ri      Resistance of intracellular fluid (Ohm) 

Rm      Resistance of membrane (Ohm) 

Cm      Capacitance of membrane (F) 

Abbreviations

EBI      Electrical bioimpedance 

BCA      Body composition assessment 

BIS      Bioelectrical impedance spectroscopy 

ADC      Analog to digital convertor 

DAC      Digital to analog convertor 

VCCS      Voltage controlled current source 

ECF                     Extracellular fluid 

ICF                      Intracellular fluid 

SNR      Signal‐to‐noise ratio 

QD      Quadrature demodulation 

CMRR     Common mode rejection ratio 

Page 10: Design and implementation of an impedance analyzer based on

  VIII

Op‐Amp    Operational amplifier 

DOA      Double operational amplifier 

I2C      Inter‐integrated circuit 

SPI      Serial peripheral interface 

IDE      Integrated development environment 

DDS      Direct digital synthesis 

GUI      Graphical user interface 

 

Page 11: Design and implementation of an impedance analyzer based on

   

TABLE OF CONTENTS

ACKNOWLEDGEMENT _________________________________________________________________ V 

NOMENCLATURE ____________________________________________________________________ VII 

TABLE OF CONTENTS _________________________________________________________________  IX 

1 INTRODUCTION _____________________________________________________________________ 1 

1.1 Background  ____________________________________________________________________ 1 

1.2 Purpose  _______________________________________________________________________ 1 

1.3 Outline ________________________________________________________________________ 1 

2 THEORETICAL FRAMEWORKS __________________________________________________________ 3 

2.1 Circuit theory ___________________________________________________________________ 3 

2.2 Electrical properties of living tissue  _________________________________________________ 4 

2.3 Bioimpedance measurement system design __________________________________________ 6 

2.4 Communication protocol __________________________________________________________ 9 

2.4 Arduino Uno ___________________________________________________________________ 10 

3  METHODS ______________________________________________________________________ 13 

3.1 System Implementation __________________________________________________________ 13 

3.2 Source generation  ______________________________________________________________ 13 

3.3 VCCS  _________________________________________________________________________ 15 

3.4 Signal measurement  ____________________________________________________________ 18 

3.5 Results display _________________________________________________________________ 21 

4 RESULTS __________________________________________________________________________ 23 

4.1 Signal generation _______________________________________________________________ 23 

4.2 VCCS _________________________________________________________________________ 23 

4.3 Signal measurement and display __________________________________________________ 27 

5  DISCUSSION  ______________________________________________________________________ 29 

5.1 Impedance measurement system  _________________________________________________ 29 

5.2 Safety considerations  ___________________________________________________________ 30 

6  CONCLUSIONS _____________________________________________________________________ 31 

7  FUTURE WORK ____________________________________________________________________ 32 

8  EXPERIENCE GAINED  _______________________________________________________________ 33 

REFERENCES _____________________________________________________________________ 35 

Page 12: Design and implementation of an impedance analyzer based on

  10

Page 13: Design and implementation of an impedance analyzer based on

   

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

This  thesis  is divided  into  eight  chapters. Chapter Two  contains  the background knowledge 

about  bioelectrical  impedance,  earlier  research  on  BIS  system  design,  BIA  applications  and 

knowledge  about  communication  protocol  and  the  microcontroller  Arduino  Uno.  Chapter 

Page 14: Design and implementation of an impedance analyzer based on

  2

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. 

   

Page 15: Design and implementation of an impedance analyzer based on

   

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] 

The  real part R  is  the  resistance,  the  imagery part X  is  the  reactance,| | is  the magnitude of 

impedance  and   is  the phase difference between  the  applied voltage  (V)  and  corresponding 

current (I). Resistance causes energy loss in the circuit. It won’t lead to any phase shift between 

current and voltage. Reactance stores energy and causes phase difference between voltage and 

current. Usually reactance is introduced by capacitors or inductors in the circuit. (8) 

Electrical impedance can be calculated from Ohm’s law:  

VZ

I  .   [2] 

 

Figure 1 The impedance vector. 

 

Figure 2 An example of phase delay. 

 

2.1.2 Dielectric properties of materials 

The electrical properties of materials can also be expressed as admittance Y, which is the inverse 

of impedance. The formula, with capacitive components in the circuit, can be written as: 

0

1rY G jB G j C K j K j

Z    [3] 

The real part G  is called conductance. The  imaginary part B  is  the susceptance. A capacitor  is 

drawn in Figure 3. Assuming the area of electrodes is A and the distance between two planes is 

d, then K is the ratio between area and distance: K = A/d.    is the conductivity of the material. It 

Page 16: Design and implementation of an impedance analyzer based on

  4

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.  

To  study  electrical  properties  of  living  tissues,  it  is  of  great  help  to  establish  an  equivalent 

electrical circuit for the cells. According to the characteristics introduced above, the ECF can be 

depicted as a single resistor (Re). The ICF contains not only electrolytes but also organelles that 

could introduce dielectric properties. For simplification, it is also modeled as a resistor (Ri). The 

cell membrane  is equivalent to a resistor connected  in parallel with a capacitor (Rm||Cm). (8) 

See Figure 4.  

Page 17: Design and implementation of an impedance analyzer based on

   

 

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: 

 

11

1e i

e ie i

R j CRZ 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: 

  eZ R .     [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 

The dielectric properties of  living  tissues  and  cell  suspensions have  a dispersive behavior  in 

response  to  electrical  currents.  This  means  their  dielectric  properties  like  permittivity  and 

conductivity depends on frequency. According to the changes in permittivity and conductivity, 

Schwan defined  three major dispersions: α, β and   γ dispersion. A  fourth dispersion widow, δ dispersion, between β and γ dispersion has also been noticed. (10)  

Page 18: Design and implementation of an impedance analyzer based on

  6

 

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). 

Two‐electrode method 

The two‐electrode method or bipolar method uses two electrodes to  inject a known current to 

the  biological  material  and  measures  the  voltage  drop  over  this  material  from  the  same 

electrodes. See Figure 6. Apart from the impedance of biological material Zm, the impedances at 

two electrode contacts Zc are also included in the measured impedance.  

Page 19: Design and implementation of an impedance analyzer based on

   

 

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 

Sinusoidal signal can be generated from either analog or digital method. 

Page 20: Design and implementation of an impedance analyzer based on

  8

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  0cos( )i t I t ,  by  adding  the  phase  shift   caused  by  the  impedance  Z,  the 

expression 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 sinZ R jX Z j Z   [7] 

In the upper branch, the voltage is multiplied by  0cos( )t , 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 tI Z

   [8] 

The high frequency components are filtered out by the low‐pass filter, so the output contains 

only 1

cos2

I Z  which can be written as 2

IR  . Similarly, the output of lower branch is 

2

IX   

Figure 8 Block diagram of a simple DDS system. 

Address 

counter Look‐up 

table DAC  LPF Register 

fin  Waveform 

Page 21: Design and implementation of an impedance analyzer based on

   

 

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) 

Data  transmitted between master and slave device always begins with a START bit and ends 

with a STOP bit. After the master device starts data transmission, the master device reaches to 

each slave device with the slave’s unique address. If the address matches, the slave will respond 

to the master with an AKCNOWLEDGE signal. 

 

2.4.2 SPI 

Serial peripheral  interface (SPI)  is a four‐wire full‐duplex  interface allowing a single master to 

communicate with one or multiple slaves. Master In Slave Out (MISO) is used for sending data 

from slave to master. Master Out Slave In (MOSI) is used for sending data from master to slave 

device. Serial Clock (SCK)  is configured by the master device and  is used to synchronize data 

transmission.  Slave  Select  (SS)  is  used  to  select  the  slave  device  that  the master  wants  to 

communicate with. MOSI, MISO and SCLK are common to all slave devices, while SS is specific 

for each slave. The slave device is enabled only when its SS pin is low. See Figure 11. 

Page 22: Design and implementation of an impedance analyzer based on

  10

 

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 

devices.  

Speed: I2C is slow compared to SPI. It transfers data at a speed of 100 kbps in standard mode, 400 

kbps  in fast mode, 1Mbps  in fast mode plus and 3.4 Mbps  in high‐speed mode (23). But high‐

speed mode is not always feasible because of limitations on the master side. SPI has no specific 

working mode or any defined limit. The throughput rate varies from device to device, and can 

go higher than 10 Mbps. 

 

2.5 Arduino Uno

Aruidno Uno (Figure 12) is the latest revision of the basic Arduino USB board. It is based on the 

microcontroller ATmega328. The system clock is 16 Mhz. The board has 14 digital input/output 

pins and 6 analog  inputs. Some of  these pins have  special  functions  for communicating with 

other devices or microcontrollers. (25) 

For SPI communication using SPI library: 

Table 2 SPI pins on Arduino Uno 

Pin 10  Slave selection (SS) 

Pin 11  Master out slave in (MOSI) 

Pin 12  Master in slave out (MISO) 

Pin 13  Serial clock (SCK) 

For I2C communication using Wire libray: 

Table 3 I2C pins on Arduino Uno 

Pin A4  Serial data (SDA) 

Pin A5  Serial clock (SCL) 

Arduino Uno could be programmed with Arduino software by simply connecting the board to 

computer via USB port. Arduino boards  come with  an  integrated development  environment 

(IDE) which  is an open‐source  software based on Processing, avr‐gcc, and other open  source 

software  (26).  The  Arduino  programs  can  be written  in  C/C++.  Arduino  itself  has  its  own 

standard library and some other libraries that have made some transforms on C/C++ language. 

Page 23: Design and implementation of an impedance analyzer based on

   

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). 

 

Page 24: Design and implementation of an impedance analyzer based on
Page 25: Design and implementation of an impedance analyzer based on

   

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

2out innf f       [9] 

 

Figure 13 Simplified block diagram of the impedance measurement system. 

I

DC power supply

VCCS 

Microcontroller 

(Arduino Uno) 

DAC  ADC  Matlab2R1C model V  V

Samples 

Page 26: Design and implementation of an impedance analyzer based on

  14

 

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: 

4096REF n

OUT

V DV

   [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 

transmission and so forth. Detailed description and instruction for the library can be seen in (29). 

 

Page 27: Design and implementation of an impedance analyzer based on

   

 

Figure 15 Fast mode write command. (27) 

 

3.3 VCCS

3.3.1 VCCS configurations 

Load‐in‐the‐loop 

A single operational amplifier (Op‐Amp) can work as a simple and effective VCCS. In a circuit 

like Figure 16,  if  the Op‐Amp  is  ideal,  the electrical current  flowing  through  the  load will be 

equal to that in R1. The output current can be written as: 

1

1load

VI

R    [11] 

which is independent of the load value. 

 

Figure 16 Simple load‐in‐the‐loop circuit. 

Page 28: Design and implementation of an impedance analyzer based on

  16

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

VI

R R

     [12] 

where the typical value of RIN is 50 Ohm (31) 

 

Figure 18 Equivalent circuit of AD844. (31) 

   

Enhanced Howland circuit 

The enhanced Howland  circuit has an advantage over other  current  source  configurations:  it 

needs  only  one Op‐Amp  and  five  resistors  to work.  The  circuit  is  comparably  simple.  The 

output current is given by: 

3

4 2

inL

V RI

R R      [13] 

The resistance follows the ratio: 

3 4 5

2 1

R R R

R R

    [14] 

Page 29: Design and implementation of an impedance analyzer based on

   

 

Figure 19 Enhanced Howland circuit. (32) 

 

DOA circuit 

Double Op‐Amps are used in this circuit (32). It features a differential amplifier with a positive 

feedback. Let  . The output current is calculated by: 

3

inL

VI

R      [15] 

 

Figure 20 DOA current source circuit. (32) 

 

3.3.2 Measurement of output impedance 

The output impedance was measured according to the schematic diagram shown in Figure 21.  

 

Figure 21 Schematic diagram used to measure the output impedance. Adapted from (33). 

The following equations can be written according to KCL and KVL. 

When the switch S is closed: 

1 1s zi i I    [16] 

Page 30: Design and implementation of an impedance analyzer based on

  18

1 1s z LZ i I R    [17] 

When the switch S is open: 

2 2s zi i I    [18] 

2 2s z LZ i I P R [19]

Subtracting Equation [16] and [18]: 

1 2 2 1z zI 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 environment  

Three 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.  

Boards were  connected  to  power  supply  in  the  lab  for  testing.  In  consistence with  steps  in 

simulation,  the output currents of PCBs were measured with a  load of 470 Ohm. Then values 

were normalized by dividing the output current at the lowest frequency. 

 

3.4 Signal measurement

Page 31: Design and implementation of an impedance analyzer based on

   

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. 

The  timing chart of SPI communication with MCP3008  is shown  in Figure 23. The ADC chip 

works in mode (0,0), which means the base value of serial clock is low and data are sampled on 

the rising edge of clock. 

Page 32: Design and implementation of an impedance analyzer based on

  20

 

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.  

The  first method  is  to use  the Matlab Arduino Support package “Aruidno  IO”  that  supports 

serial  port  communication  between  Matlab  and  Arduino.  This  support  package  can  be 

downloaded from (37). It supports Arduino Uno, Mega 2560 and Duemilanove. The Aruidno IO 

package provides  a  server  sketch program  that  should  run  on Arduino. When  the  sketch  is 

uploaded to the Arduino board, board listens to the commands from serial port. There are also 

a Matlab API  and Matlab  example  files  in  the package. These  files  altogether  allow users  to 

access and control pins on Arduino board from Matlab commands directly.   

The  second method  is  to  use  Simulink Arduino  Support  package  (38).  It  contains  common 

function blocks like Analog I/O, Digital I/O, PWM, and also some function blocks for Ethernet 

Page 33: Design and implementation of an impedance analyzer based on

   

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 

Matlab offers a graphical user  interface design environment  (GUIDE)  for designing graphical 

user interface (GUI) (40). Users can add modules like toolbars, push buttons, and pop‐up menus 

by simply clicking on  their  icons and put  them  to desired position. The  tasks  that need  to be 

implemented are defined with Matlab codes. For example, when a push button  is clicked  the 

codes under its callback function are executed.  

 

3.5.2 Impedance analysing 

Samples collected in Matlab were fitted to the form: ( ) sin( )f t a b t c d  [22] 

using the least‐squares curve fitting function lsqcurvefit(). When the fitting curve is generated, it 

is easy to compare the amplitude and phase information from the parameters in the function.  

Page 34: Design and implementation of an impedance analyzer based on

  22

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]: 

signalLOAD REF

VZ R

I  [23] 

This equation can be extended assuming  LOAD LOAD LOADZ R j X . The resistance and reactance 

of the load can be calculated from: 

2 2

1 2

( )/

tan( )

signal

REF LOAD

ref REF

REF LOAD

VR R X

V R

Xc c

R R

    [24] 

where |Vsignal| (a1), |Vref|(a2), c1, c2 are coefficients for the fitted curves. 

Page 35: Design and implementation of an impedance analyzer based on

   

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 VCCS

The  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. 

 

4.2.1 Simulation 

Output impedance 

Page 36: Design and implementation of an impedance analyzer based on

  24

 

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

impe

danc

e of

VC

CS

[kO

hm]

Enhanced Howland,simulationDOA,simulation

Load-in-the-loop circuit driven by current conveyor,simulation

Page 37: Design and implementation of an impedance analyzer based on

   

 

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]

Out

put

curr

ent

of V

CC

S/C

urre

nt@

low

est

freq

uenc

y

Enhanced Howland,simulationDOA,simulation

Load-in-the-loop circuit driven by current conveyor,simulation

Page 38: Design and implementation of an impedance analyzer based on

  26

 

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]

Out

put

curr

ent

of V

CC

S/C

urre

nt@

low

est

freq

uecy

Enhanced Howland,labDOA,lab

Load-in-the-loop circuit driven by current conveyor,lab

Page 39: Design and implementation of an impedance analyzer based on

   

 

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.  

In Matlab, a  simple GUI was designed as  is  shown  in Figure 33. When “Plot”  is  clicked,  the 

serial port opens. Matlab reads from the serial port and stores certain number of sample points 

in a matrix. The number of samples can be changed from the code. These samples are plotted to 

the GUI after finishing reading. 

 

Figure 33 GUI interface in Matlab. 

When the “Interpolate” button is clicked, samples are fitted to a sinusoidal wave using the least‐

square method and then are displayed in the GUI. 

Page 40: Design and implementation of an impedance analyzer based on

  28

Before clicking the “Calculate” button, the value of reference resistor must be entered  into the 

software. 

 

Figure 34 An example of impedance calculation. 

Figure  34  shows  the  interpolation  result  and  impedance  analyzing  result  for  two  330 Ohm 

resisters connected in serials. However there is an obvious phase shift between two curves. This 

phase can be used as a calibration parameter for the system. 

A 2R1C model was tested (Figure 35). Results are presented in Figure 36 and Table5. 

 

Figure 35 2R1C model. 

 

Figure 36 Results for 2R1C model 

 

Table 5 Resistance and reactance values of a 

2R1C model 

  Resistance 

(Ohm) 

Reactance

(Ohm) 

Theoretical  556  ‐0.85 

Measured  719  ‐450 

Calibrated  809  75 

Page 41: Design and implementation of an impedance analyzer based on

   

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  speed  limitation of  the measurement block  is not  limited by MCP3008, but by  the  serial 

interface between Arduino and computer. The maximum port speed is 128000 bps. This means 

128000 bits of information is sent in one second. For one byte data transmission, there are data 

bits and also start bit, stop bit and possibly some other information included. In section 4.3, the 

frequency of the input was 200Hz. Seven samples were sent per second to the computer in the 

form “Channel0Value‐space‐Channel1Value” (i.e. “1 1”). The number of voltage levels received 

by the computer is 2800 points per second. 

Page 42: Design and implementation of an impedance analyzer based on

  30

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.  

Besides, problems may  occur when  the patient  is using  other medical device  like  implanted 

cardiac  defibrillator. No  accident  has  been  reported. However,  attentions  should  be  paid  in 

these situations. 

The system developed in this project generates an electrical current with Imax = 0.8mA and it is 

bipolar with no DC offset. The system requires improvements in many aspects to get satisfying 

results. So it is currently not aimed towards real life applications, but for education and research 

purpose only. 

   

Page 43: Design and implementation of an impedance analyzer based on

   

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. 

   

Page 44: Design and implementation of an impedance analyzer based on

  32

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. 

   

Page 45: Design and implementation of an impedance analyzer based on

   

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. 

And it is important to talk to supervisor or ask help from internet. When you stuck with some 

problem for too long, this will save a lot of time. 

Page 46: Design and implementation of an impedance analyzer based on
Page 47: Design and implementation of an impedance analyzer based on

   

REFERENCES

1. Van Loan, Marta D., et al. Use of bioimpedance spectroscopy to determine extracellular fluid, 

intracellular fluid, total body water, and fat‐free mass. Human body composition. 1993, pp. 67‐70. 

2. Aberg, P., et al, Skin cancer identification using multifrequency electrical impedance‐a 

potential screening tool. IEEE Transactions on Biomedical Engineering. 2004, Vol. 51, pp. 2097‐

2102. 

3. Kubicek, W. G., Patterson, R. P., and Witsoe, D. A., Impedance cardiography as a 

noninvasive method of monitoring cardiac function and other parameters of the cardiovascular 

system. Annals of the New York Academy of Sciences. 1970, Vol. 170, pp. 724‐732. 

4. Malich, A., Böhm, T., et al, Electrical impedance scanning as a new imaging modality in 

breast cancer detection—a short review of clinical value on breast application, limitations and 

perspectives. Nuclear Instruments and Methods in Physics Research Section A: Accelerators, 

Spectrometers, Detectors and Associated Equipment. 2003, Vol. 497, pp. 75‐81. 

5. Seoane Martínez, Fernando. Electrical bioimpedance cerebral monitoring. Göteborg : Chalmers 

tekniska högskola, 2007. 

6. Abtahi, Farhad. Aspects of Electrical Bioimpedance Spectrum Estimation. 2014. 

7. Ferreira, J., Seoane, F. and Lindecrantz, K., AD5933‐based electrical bioimpedance 

spectrometer. Towards textile‐enabled applications. Engineering in Medicine and Biology 

Society, EMBC, 2011 Annual International Conference of the IEEE. 2011. 

8. Ivorra, Antoni. Bioimpedance monitoring for physicians: an overview. Centre Nacional de 

Microelectrònica Biomedical Applications Group, 2003. 

9. Fluid and Electrolyte Balance. http://www.elmhurst.edu/~chm/vchembook/250fluidbal.html, 

2014‐09‐20. 

10. Schwan, P.H. Electrical properties of tissue and cell suspensions. Adv Biol Med Phys. 1957, 

Vol. 5, pp. 147‐209. 

11. Schwan, P.H.. Electrical properties of tissues and cell suspensions: mechanisms and models. 

Engineering in Medicine and Biology Society, 1994. Engineering Advances: New Opportunities 

for Biomedical Engineers. Proceedings of the 16th Annual International Conference of the IEEE. 

1994. 

12. Mohamadou, Y., et al, Performance evaluation of wideband bio‐impedance spectroscopy 

using constant voltage source and constant current source. Measurement Science and 

Technology. 2012, Vol. 23. 

13. Grimnes, Sverre and Martinsen, Orjan Grottem, Bioimpedance & Bioelectricity Basics. 2. 

Elsevier, 2008. 

14. Kinouchi, Y. , Iritani, T., Morimoto, T. and Ohyama, S., Fast in vivo measurements of local 

tissue impedances using needle electrodes. Medical and Biological Engineering and Computing. 

1997, Vol. 35, pp. 486‐492. 

15. Ivorra, A., BIOIMPEDANCE PROBES. 2005. 

http://www.tdx.cat/bitstream/handle/10803/6333/04Aic04de11.pdf;jsessionid=16471548DC9BDB

0CC249F836EFEB61CE.tdx1?sequence=4. 2014‐12‐30. 

16. Pallas‐Areny, R., and Webster, J. G., AC instrumentation amplifier for bioimpedance 

measurements. IEEE Transactions on Biomedical Engineering. 1993, Vol. 40, pp. 830‐833. 

17. Seoane, Fernando, et al, Current source design for electrical bioimpedance spectroscopy. 

Electrical Bioimpedance Cerebral Monitoring: Fundamental Steps towards Clinical Application. 

2007. 

18. Analog Devices. Fundamentals of Direct Digital Synthesis (DDS). 

http://www.analog.com/media/en/training‐seminars/tutorials/MT‐085.pdf. 2014‐12‐30.  

Page 48: Design and implementation of an impedance analyzer based on

  36

19. Bouchaala, Dhouha, et al. Comparative study of voltage controlled current sources for 

biompedance measurements. 2012‐9th International Multi‐Conference on Systems, Signals and 

Devices. 2012. 

20. Pallas‐Areny, R., Bioelectric impedance measurements using synchronous sampling. 

Biomedical Engineering, IEEE. 1993, Vol. 40. 

21. Yang, Yuxiang, et al, Design and preliminary evaluation of a portable device for the 

measurement of bioimpedance spectroscopy. Physiological measurement. 2006, Vol. 27, pp. 

1293‐1310. 

22. Steendijk, P., Mur, G., Van Der Velde, E.T. and Baan, J., The four‐electrode resistivity 

technique in anisotropic media: theoretical analysis and application on myocardial tissue in 

vivo. Biomedical Engineering, IEEE. 1993, Vol. 40, pp. 1138‐1148. 

23. Wikipedia. I²C. http://en.wikipedia.org/wiki/I%C2%B2C. 2014‐12‐30. 

24. Wikipedia. Serial Peripheral Interface Bus. 

http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus. 2014‐12‐30. 

25. Arduino Uno. http://arduino.cc/en/Main/ArduinoBoardUno. 2014‐12‐30. 

26. Download the Arduino Software. http://arduino.cc/en/main/software. 2014‐12‐30. 

27. Microchip Technology Inc. MCP4725 12‐Bit Digital‐to‐Analog Converter with EEPROM 

Memory . 2007. 

28. Atmel. ATmega48A/PA/88A/PA/168A/PA/328/P [DATASHEET] . 2013. 

29. Wire Library. http://arduino.cc/en/Reference/Wire. 2014‐12‐29. 

30. Seoane, F., Bragós, R. and Lindecrantz, K., Current source for multifrequency broadband 

electrical bioimpedance spectroscopy systems. A novel approach. Engineering in Medicine and 

Biology Society, 2006. EMBSʹ06. 28th Annual International Conference of the IEEE. 2006. 

31. Analog Devices. AD844 datasheet. http://www.analog.com/static/imported‐

files/data_sheets/AD844.pdf. 2009. 

32. Li, Zhangyong, et al, Study of Voltage Control Current Source in Electrical. Bioinformatics 

and Biomedical Engineering (iCBBE), 2010 4th International Conference on. 2010. 

33. Bertemes‐Filho, P., Brown, B. H. and Wilson, A. J., A comparison of modified Howland 

circuits as current. Physiological measurement. 2000, Vol. 21. 

34. Nawrath, Martin. Arduino Realtime Audio Processing. 

http://interface.khm.de/index.php/lab/interfaces‐advanced/arduino‐realtime‐audio‐processing/. 

2014‐12‐30. 

35. Microchip Technology Inc. MCP3004/3008 2.7V 4‐Channel/8‐Channel 10‐Bit A/D 

Converters. 2008. 

36. A Brief Introduction to the Serial Peripheral Interface (SPI). 

http://arduino.cc/en/Reference/SPI. 2014‐12‐30. 

37. MathWorks Classroom Resources Team. MATLAB Support for Arduino (aka ArduinoIO 

Package). http://se.mathworks.com/matlabcentral/fileexchange/32374‐matlab‐support‐for‐

arduino‐‐aka‐arduinoio‐package‐. 2014‐09‐05. 

38. MathWorks. Simulink Support Package for Arduino Hardware. 

http://se.mathworks.com/help/supportpkg/arduino/index.html. 2014‐12‐30. 

39. MathWorks. Open Block Library for Arduino Hardware. 

http://se.mathworks.com/help/supportpkg/arduino/ug/open‐block‐library‐for‐arduino‐

hardware.html. 2014‐12‐30. 

40. MathWorks. MATLAB GUI. http://se.mathworks.com/discovery/matlab‐gui.html. 2014‐12‐

30. 

Page 49: Design and implementation of an impedance analyzer based on

   

APPENDIX A: Schematic of VCCS 

Page 50: Design and implementation of an impedance analyzer based on

  38

APPENDIX B: PCB layout 

Page 51: Design and implementation of an impedance analyzer based on

   

Page 52: Design and implementation of an impedance analyzer based on

TRITA 2015:013

www.kth.se