Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
by
Ashwini Vittal Gopinath
A thesis
September, 2004
The thesis presented by Ashwini Vittal Gopinath entitled “Micro-controller based
____________________________________
Advisor Date
____________________________________
____________________________________
____________________________________
ii
DEDICATION
parents Sri V. Gopinath and Smt. C.N. Nagalakshmi for giving me the opportunity to
iii
ABSTRACT
electrode set-up and determine the current through the cell. In this work, the potentiostat
triangular voltage is imposed on the electrochemical cell and the current through the cell
is analyzed. The current versus voltage curve of an electro-active chemical species that
undergoes red-ox behavior displays two prominent peaks, one in each direction of the
sweep voltage. The current peaks are indicative of the concentration of the chemical and
also provide other useful information. An embedded potentiostat system that extracts
the concentration of the chemical from the peak measurements was built. The entire
correlation factor between concentration of chemical and current peak using the
iv
TABLE OF CONTENTS
DEDICATION.................................................................................................................. III
TABLE OF CONTENTS................................................................................................... V
LIST OF FLOWCHARTS................................................................................................ IX
CHAPTER 2: OVERVIEW................................................................................................ 3
v
CHAPTER 5: MICRO-CONTROLLER SETTINGS AND SOFTWARE ...................... 16
CHAPTER 7: RESULTS.................................................................................................. 38
APPENDIX A: CODE...................................................................................................... 52
REFERENCES ................................................................................................................. 65
vi
LIST OF FIGURES
Figure 2: i-E curve of cyclic voltammetry measurements with varying scan rates ............ 6
Figure 6: Baseline current and anodic peak current measurement with respect to baseline
current........................................................................................................................... 4
Figure 14: Calibration curve of anode peaks for potassium ferri cyanide........................ 49
Figure 15: Calibration curve for cathode peaks of potassium ferri cyanide ..................... 50
Figure 16: i-E curves for potassium ferri cyanide at 100 mV/s....... Error! Bookmark not
defined.
vii
LIST OF TABLES
viii
LIST OF FLOWCHARTS
ix
CHAPTER 1: INTRODUCTION
various shapes on an electrochemical cell and measures the resultant current through the
cell. A potentiostat uses a three or four electrode interface. In a three electrode system the
potentiostat controls the potential between the reference electrode and the working
electrode; the counter electrode provides the current through the cell but the amount of
current is limited by the electrochemical activity at the working electrode. The current
species, the voltage at the working electrode (with respect to reference electrode) and the
area of the working electrode. In this work, the potentiostat was used to carry out cyclic
voltage waveform is applied between the reference and working electrodes. An electro-
each scan direction; the peaks are called anodic and cathodic peaks. The current versus
voltage graph of a cyclic voltammamogram for a red-ox species resembles a duck curve;
the current builds to a peak, falls and levels off in each direction of voltage sweep. The
location of the current peak along the voltage axis is unique to a chemical and the height
of the current peak gives a measure of the concentration of chemical, provided the scan
large footprints, bulky and costing thousands of dollars. There has been a lot of research
to miniaturize potentiostats in the last decade. Richard & others [REAY94] have built an
integrated CMOS potentiostat , which they later used to determine heavy metal
concentration in animals; a similar effort was carried out by Richard & others [BEAC99].
In all these cases, data has been processed offline and in some cases off-site, there has not
transmits an 8-bit word corresponding to the concentration of the chemical is built in this
2
CHAPTER 2: OVERVIEW
electro-chemically active red-ox chemical species was designed and built. The block
VOLTAGE
CONTROL
CURRENT
MONITOR
The micro-controller provides the control system for the potentiostat. There are two
interfaces between the micro-controller and sensor electrodes; the first interfaces is used
to apply the triangular voltage waveform to the electrochemical cell and the second
interface is used to apply analyze the current through the electrochemical cell. The op-
amp circuitry provides the interface between the micro-controller and sensor electrodes.
3
2-1 Micro-controller & Op-Amp circuitry
The micro-controller controls the voltage applied between the reference and
working electrodes and takes periodic current measurements. The current values are
averaged to improve signal to noise ratio. The micro-controller extracts the baseline
measurement”) by determining the knee of the curve between the beginning of sweep in
each direction and the respective peak in that direction. The micro-controller then
determines the peak of the curve with respect to the baseline current in each direction, the
concentration of the chemical is determined from the calibration tables stored in the
micro-controller.
triangular voltage. The 10-bit counter value is fed to a serial D/A converter using the
serial peripheral interface (SPI) of the micro-controller. The triangular voltage is level-
shifted to the requisite range [-0.1 to +0.4V for potassium ferri cyanide] by an op-amp
circuit and then applied to the electrochemical cell. The current through the
electrochemical cell is fed to a current to voltage converter and then level-shifted and
amplified/attenuated to meet the input voltage ratings of the analog port of the micro-
controller. For every increment in voltage (every increment in the 10 bit up-down
4
The op-amp circuits provide the signal processing necessary to interface the
voltage waveform from the micro-controller to the electrode interface. They also provide
the necessary signal processing to interface the current from the electrochemical cell to
electrode and a silver reference electrode. The reference electrode is used to establish an
unchanging, constant potential in the electrochemical cell, against which other potentials
may be determined with relatively high precision. This is critical because the delta
system. The working electrode is where the electron transfer of interest occurs. The
counter is usually a somewhat “sacrificial” electrode that merely serves to complete the
circuit. As long as the products of any electron transfer at this electrode do not interfere
at the working electrode, we don’t care what happens at this electrode. The counter
prevent the limiting of current at the working electrode by the counter electrode. The
red-ox behavior observed during cyclic-voltammetry looks like a duck curve and is
shown in figure 2.
5
Figure 2: i-E curve of cyclic voltammetry measurements with varying scan rates
6
The location of the peak along the voltage axis is unique to a species; the height
of the peak correlates to the concentration of the electro-active species. The current peak
where
For a given set-up and electro-active species if the number of electrons, the area
of the working electrode and the diffusion co-efficient remain constant, then the peak
current can be varied either by varying scan rate or by varying concentration of electro-
active species. In this work, only the effects of change in concentration of electro-active
1
CHAPTER 3: PEAK CURRENT MEASUREMENT
current due to capacitive charging between the electrodes and the bulk solution. The
impedance due to the solution and due to the interface between the electrodes and bulk
where
Cd – double-layer capacitance
2
The charging current does not derive from any electron transfer process involving
the electro-active species and hence must be subtracted for proper estimation of anodic
and cathodic peak currents. The charging current also limits the detection limit of cyclic
voltammamogram to about 10-5M [KATZ04]. The baseline current and the anodic peak
3
Figure 4: Baseline current and anodic peak current measurement with respect to
baseline current
4
3-1 Extrapolation of base line current
The baseline current in both anodic and cathodic sweeps is found by finding the
point of maximum curvature between the beginning of sweep and the corresponding
peak; a line is then fit through all the points on the left hand side of the point of
maximum curvature. The L-method [SALV__] is used to find the point of maximum
In the L-method, the knee of a curve is determined by fitting a pair of lines to the
data that produces the least root mean square error. The point at which the two lines
Let the total number of data points be ‘b’; the partitioning the of the data points be
‘c’, i.e., the left hand set of data points are described by the points 1,..c and the right hand
set of data points are described by the points c+1,..b. The total root mean square error is
given by equation 2.
5
RMSEc = 1/b {c * RMSE (Lc) + (b-c) * RMSE (Rc)} Equation 1
Where
RMSE (Lc) is the total root mean square error of the left hand side line
RMSE (Rc) is the total root mean square error of the right hand side line.
Since only the minimum of the root mean square value is used, root mean square
can be replaced with mean square error and since the divisor ‘1/b’ is a constant this also
Where
MSE (Lc) is the total mean square error of the left hand side line
MSE (Rc) is the total mean square error of the right hand side line.
6
The steps involved in finding the knee of the curve are described below.
• Fit the left hand line to points 1,..c and the right hand line to points c+1,..b
• Calculate the total mean square error for each value of ‘c’
The least mean square error gives the point of maximum curvature or ‘knee’ of the
curve. Regressive line fitting is used to fit a line to the given data set.
7
3-2 Regressive line fitting
In regressive line fitting, the slope and y-intercept of the line is found by
minimizing the mean square error between the data points and the line describing the data
points.
To find the slope and y-intercept of the best fit line through the given data points
The mean square error between expected and obtained values of data points has to
be minimized; i.e. (y - ỹ)2 has to be minimized, where ‘y’ is the given data set and ‘ỹ’ is
the expected data points or the values of the best fit line through the data points and is
given by equation 4.
ỹ = ax + b Equation 3
Where
‘a’ is the slope of the line
To find the best fit line, we have to solve the set of simultaneous equations given below.
∂z / ∂b = 2 {a ∑x + ∑b - ∑y) = 0 Equation 5
8
solving for ‘a’ and ‘b’ from the above simultaneous equations
The peak with respect to the baseline current is calculated in both directions. The
concentration of the electro active chemical species is then extracted from the calibration
curve. The calibration curve is formed using a set of standard solutions covering the
9
CHAPTER 4: INTERFACE DESIGN
4-1 Schematic
cell using op-amp circuits. The op-amp circuitry provides the necessary signal
processing before feeding the triangular voltage signal to the electrode set-up as well as
the voltage equivalent current to the micro-controller. The schematic diagram of the
potentiostat showing the interconnections between the micro-controller and the op-amp
circuitry and between the op-amp circuit and the electrode set-up is shown in Figure 3.
10
Figure 3: Schematic of interface between micro-controller and electrochemical cell
11
A list of the components and a brief description of the components used in the
schematic are presented in table 1. The components can be acquired through Digikey and
U7 PIC18F452 Micro-controller
12
4-2 Circuit Operation
This section is divided into two parts, the voltage control between the micro-
controller and the electrode set-up is presented in the first part and the current monitoring
between the electrode set-up and the micro-controller is presented in the second part.
electrochemical cell using a 10 bit up-down counter. The digital output word from the
micro-controller is fed to a serial D/A converter using serial peripheral interface of the
micro-controller. The output voltage swing of the serial D/A converter is variable and
depends on the voltage on the reference pin (Vref pin of the MAX5354). A
potentiometer is connected to the Vref pin and the output voltage swing of the D/A
converter is controlled by changing the potentiometer settings. The output voltage of the
where
cnt – 10 bit up-down counter value loaded in the serial D/A register
13
4-2.1 Interface with serial D/A converter
The serial D/A converter used in this work is MAX5354. The MAX5354 is a 10
bit serial D/A converter and uses a 16 bit serial word to update its registers. The 16 bit
serial word can be loaded in one block or it can be transmitted as two 8 bit words. The
16 bit serial word configuration is presented in table 2 from the MAX 5354 datasheet.
14
When the MAX5354 register contents are being updated, the CS pin needs to be
held low. The control to the serial DAC is provided by the port C pins of the micro-
controller. The RC3 pin of the micro-controller provides the serial clock, the RC5 pin
provides the serial data and the RC0 provides the CS for the MAX5354 DAC. The
micro-controller sends out the 16 bit configuration as two 8-bit words. The CS signal is
held low during valid data transmission. The detailed software interface with the serial
The output of the serial D/A is unipolar; to change the output voltage to bipolar an
op-amp level shifter circuit is used. A buffer is inserted between the counter electrode
and the level-shifted voltage; the buffer prevents loading of earlier op-amp stages by the
current drawn by the electrochemical cell. The reference electrode is connected to the
non-inverting terminal of a voltage follower circuit. The voltage follower circuit helps in
maintaining a constant potential at the reference electrode without drawing much current.
converter; this in effect keeps the working electrode tied to ground and also produces a
voltage equivalent of the electrochemical current at the output of the voltage converter.
attenuated/amplified to bring the voltage into the 0-5V range acceptable by the micro-
15
CHAPTER 5: MICRO-CONTROLLER SETTINGS AND SOFTWARE
chosen to provide the control system for miniaturized sensor systems under this grant in
controller with 10 bit A/D converter and some of the features of the PIC18F452
[MICR04 b] are
• 32 KB program memory
16
The micro-controller uses the timer-capture module to provide interrupts at
periodic intervals, during an interrupt the 10 bit up-down converter values are updated;
the A/D measurements are taken and the serial D/A contents are updated. The heart of
this project is the determination of the anode and cathode peaks with respect to baseline
current (explained in detail in Chapter 3). The micro-controller takes periodic current
measurements, extracts baseline current and determines peak of the current curve and
then extracts the concentration of the chemical. A flow-diagram of the control system for
CONFIGURE TIMER
MODULE
(Section 4-1.2)
17
The modules used and the algorithms implemented to design this functionality in
The special events mode of the timer compare module is used for taking periodic
analog to digital measurements. The time period between two consecutive A/D
measurements is changed by loading different values into the compare register. When
the timer count equals the contents of the compare register, the go/done bit of the analog
to digital converter is set, thus initiating an A/D measurement. After the completion of a
A/D conversion, a high-level interrupt is generated. In the interrupt service routine, the
analog to digital value is read from the A/D conversion registers; 8 contiguous values are
averaged to remove noise and are stored in an array of length 256. After completion of a
scan (2048 counts, 1024 up counts and 1024 down counts), the interrupt is disabled and
the peak in both directions is computed. The knee of the curve [SALV__] in each
direction is computed and the slope of the left hand side of the curve is calculated. The
peak with respect to slope in each direction is calculated. The micro-controller stores the
calibration data of the curves in terms of slope and y-intercept of the best-fit line. The
concentration corresponding to the peak current value is determined by using the slope
and y-intercept of the calibration curve and an 8-bit data bit value corresponding to the
current is generated. The settings of the analog to digital module, timer module, compare
capture pulse width modulation module and master synchronous slave module are listed
here.
18
5-1.1 ADC settings
ADCON0 and ADCON1 are the control registers used to power up the analog to
digital conversion circuitry, select the analog input port and initiate analog to digital
conversion. The ADRESH and ADRESL registers hold the upper and lower bytes of the
19
The ADCON0 register bit settings used in this work are as shown in table 3, the bit
definition in detail can be found in the PIC18F452 datasheet [MICR04 b]. ADCON0
register powers up the A/D circuitry, selects the analog port for conversion and selects
Bit position 7 6 5 4 3 2 1 0
Function of bit ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE — ADON
Setting 0 1 0 0 1 — 1
The go/done bit is set at the start of a new analog to digital conversion; the bit is
The ADCON1 register settings are as in table 4. The ADCON1 configures the
reference voltage for the A/D module and selects the output format of the 10 bit A/D
result.
Bit position 7 6 5 4 3 2 1 0
Function of bit ADFM ADCS2 — — PCFG3 PCFG2 PCFG1 PCFG0
Setting 1 0 — — 0 0 0 0
20
The ADC conversion result is only 10 bits long and two formats are available to
store it – most significant 8 bits in ADRESH register and two least significant bits in
ADRESL register or 2 most significant bits in ADRESH register and the least significant
bye in the ADRESL register. The ADFM selects the format in which the ADC result is
stored; a ‘1’ indicates that the first 6 most significant bits in ADRESH are zeros. The
ADC result is stored in the registers ADRESH and ADRESL in the format shown below:
7 6 5 4 3 2 1 0 ADRESH
0 0 0 0 0 0 b9 b8
7 6 5 4 3 2 1 0 ADRESL
b7 b6 b5 b4 b3 b2 b1 b0
21
5-1.2 Timer and CCP Module settings
The micro-controller 16 bit timer is an up counter which can be run either with
the internal (micro-controller) oscillator or from an external trigger source. The timer is
used in conjunction with the compare facility of the compare capture pulse width
modulate (CCP) register to generate a “special event trigger”. The “special event trigger”
sets the GO/DONE bit in the ADCON0 bit that starts an A/D measurement; it also resets
the timer. The TIMER3 register settings are shown in table 5. T3CON register powers
up the timer, chooses the trigger source for the time and also pairs the timer with capture
3 module.
T3CON
Bit 7 6 5 4 3 2 1 0
position
Function RD16 T3CCP2 T3CKPS1 T3CKPS0 T3CCP1 T3SYNC TMR3CS TMR3ON
of bit
Setting 1 0 1 1 0 X 0 1
The compare/capture/pulse width module register settings are shown in table 6. The
CCP2CON
Bit position 7 6 5 4 3 2 1 0
Function of - - DC2B1 DC2B0 CCP2M3 CCPM2 CCP2M1 CCP2M0
bit
Setting X X X X 1 0 1 1
Table 6: CCP2CON register settings
22
5-1.3 SPI (Serial Peripheral Interface) module settings
The serial peripheral interface is used to send the 10 bit up-down counter values
to the serial analog to digital converter. The Master Synchronous Serial Port (SPI/I2C
module) has three registers – two control registers (SSPCON1 and SSPCON2) and a
status register (SSPSTAT). In SPI mode, the Master Synchronous Serial Port has four
accessible). The settings of SSPCON1 and SSPSTAT register settings are detailed in
tables 7 and 8.
The SSPSTAT sets the clock edge for data transfer and other control information
SSPSTAT
Bit position 7 6 5 4 3 2 1 0
Function of SMP CKE D/A P S R/W UA BF
bit
Setting X 0 X X X X X X
Table 7: SSPSTAT register settings
The SSPCON1 register settings presented in table 8 selects the master/slave mode of
SSPCON1
Bit 7 6 5 4 3 2 1 0
position
Function WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0
of bit
Setting 1 X 1 1 0 0 0 0
23
5-2 Algorithms
The configurations of the different modules, the interrupts, the algorithms used to
implement the potentiostat control system in the micro-controller are detailed in this
section. The algorithms are presented in the form of flowcharts with a brief description
24
5-2.1 Control Flow for the system (the Main Subroutine)
The main sub-routine provides the control flow for the entire program. The
PIC18F452 micro-controller has one analog port – PORTA and four general digital
input/output (I/O) ports – PORTA, PORTB, PORTC and PORTD. Some of the ports
have special functions - PORTA is used for A/D conversions, PORTB is used for
hardware interrupts and PORTC is used for serial communications. For each cyclic
voltammetric measurement, the (I/O) ports of the micro-controller are configured. The
PORTC pins are configured as outputs, the serial peripheral interface uses PORTC pins
1, 3 and 5 for communication with the serial D/A converter. The PORTA pins are
configured as inputs, PORTA pin 1 is used for A/D conversion by the micro-controller.
The A/D conversions at periodic intervals are activated by enabling the special
events mode of the timer/capture module. The settings of all the modules - A/D module,
SPI module, and timer & capture modules are configured and then the interrupts for the
control system are enabled. The interrupt is disabled by the interrupt handler upon
reaching 2048 counts; the control is passed from the main program to the slope and peak
calculation sub-routine. Upon calculating the peaks in both directions and determining
the concentration of chemicals, the micro-controller switches off all the modules and
goes into sleep mode. In the sleep mode the micro-controller consumes less power and
thus helps conserve battery charge. The micro-controller configuration and the control
Configure Timer
Configure ADC
Configure SPI
Load variables
26
2
Slope_area_peak
Close ADC
Close Timer3
Close SPI
Sleep
Start
Stop
27
5-2.2 Enable High Priority Interrupts
the global interrupts, configures different levels of priority and enables both low and high
priority interrupts.
Start
Stop
28
5-2.3 High Level Interrupt
The high level interrupt vector is located 0x008. Upon receiving an interrupt, the
program counter is loaded with the value of the interrupt service sub-routine; the control
Start
ADC_handle
Stop
29
5-2.4 Interrupt service sub-routine (ADC handle)
The ADC handle sub-routine updates the contents of the 10 bit up-down counter
used to generate the triangular voltage waveform. The ADC handle also averages 8
contiguous current values and stores the result in a 256-byte array. Upon filling all the
elements in the 256 byte array, the ADC handle disables the interrupt. The control for the
30
Start
Is cnt % 8 =0?
Is cnt < 8?
Is cnt =2048?
Stop
The Slope and Peak Calculation sub-routine calculates the peak in both anodic
and cathodic directions and finds the knee of the curve in both directions. It then
calculates the anodic and cathodic peak in both directions with respect to the left hand
32
Start
Declare
variables
Is i = 0?
an_peak_loc <= i
an_peak <= y_data[i]
Is i = 256?
cat_peak_loc <= i
cat_peak <= y_data[i]
33
2
Knee
Loop i
Loop j
34
3
Is j = i-1?
Loop j
Is incr = 0?
Stop
For testing the potentiostat, potassium ferri cyanide solution was used. The
potassium ferri cyanide solution was formed by dissolving potassium ferri cyanide
crystals in 0.1M potassium nitrate solution; a 1mL 0.1mM sodium hydroxide was added
to it. The potassium nitrate solution acts as an electrolyte to suppress migration so the
electron transfer in the electrochemical cell is only by diffusion. The potassium ferri
reagent grade, the sodium hydroxide was manufactured by Fischer Scientific and was a
certified A.C.S. grade, the potassium nitrate was manufactured by Mallinkrodt supplies
and was of analytical reagent grade. Acid wash was used to clean the glassware and was
manufactured by Fisher Certified ACS plus grade and was diluted with 10:1 de-ionised
water. The silver electrode was manufactured by Alfa Aesar and was 0.5 mm Premion,
99.9985% metal basis, the platinum used for counter and working electrodes were 0.004
inches (0.1 mm) thick Premion manufactured by Alfa Aesar and has 99.998% metal
basis. All dilutions were carried out using de-ionised water and the solutions were stored
36
The micro-controller was programmed using the MPLAB ICD2 in-circuit debugger
[MICR03]. The in-circuit debugger was also used to observe variables and extract data
37
CHAPTER 7: RESULTS
cyanide was used as it exhibits a reversible one electron red-ox process with rapid
kinetics. The potentiostat was tested with 100µM, 200µM, 500µM, 1mM, 2mM and
5mM solutions. The solutions were tested at 100 mV/s (milli volts/second) scan rate and
the triangular voltage was varied between +0.4V and -0.1V. The i-E curves for the
different concentrations and the baseline currents in anode and cathode directions are
presented in figures 7 - 12. The figures 7 - 12 are not true current versus voltage curves,
they are actually the plots of the data points for voltage and current stored in the micro-
controller and hence the axes are named equivalent voltage and equivalent current. There
are 256 data points for current with values in the range 0 to 1023. The A/D converter in
the micro-controller has 10 bit resolution; hence the range of current data points is
between 0 and 1023. The triangular voltage waveform applied between the reference and
working electrode is updated 1024 times and the current readings are taken every time the
voltage is updated. 8 contiguous current data points are averaged in the micro-controller
to improve signal to noise ratio; hence there are 256 current data points. The current data
points stored in the micro-controller were extracted by using the MPLAB ICD2 In-
38
1200
1000
800
600
39
equivalent current
400
200
5mM duck curve
0
0 20 40 60 80 100 120
equivalent voltage
1200
1000
800
600
40
equivalent current
400
200
2mM duck curve
anode slope
cathode slope
1000
900
800
700
600
41
500
400
equivalent current
300
0
0 20 40 60 80 100 120
equivalent voltage
500 uM concentration
800
700
600
500
42
400
equivalent current
300
200
0
0 20 40 60 80 100 120
equivalent voltage
200 uM concentration
700
600
500
43
400
300
equivalent current
200
0
0 20 40 60 80 100 120
equivalent voltage
580
560
540
520
500
44
480
equivalent current
460
420
this is because the current through the electrochemical cell is high enough to saturate the
op-amp circuits. To cover a wide range of concentrations, the potentiostat needs to have
different ranges is presented in Figure 13. The important change in this schematic from
figure 3 is the insertion of a digitally controlled current switch [EG&G93]. The output
voltage of the current to voltage follower circuit depends on the value of the resistor
between the inverting terminal and the output of the op-amp. The digitally controlled
current switch, in effect changes the value of the resistance, thus providing the
potentiostat with different current ranges. The switch control is handled by the micro-
controller; the micro-controller has to determine current saturation and then switch to the
lower resistance.
45
Figure 11: Alternate circuit
46
The anode and cathode peaks for the 0.1mM concentration are masked by the
charging current of the electro-chemical cell; hence the lower limit for this potentiostat is
10-4 M concentration. The minimum detectable limit for cyclic voltammetric technique is
10-5 [KATZ04].
The potentiostat in this work has been optimized to work for the range between
0.1mM and 2mM (excluding extreme data points). The anode and cathode peaks after
baseline current extraction are tabulated in tables 3 and 4. The calibration curve for the
anode peak currents in the range 0.2mM to 1mM is presented in figure 14. The cathode
peak for the 2mM concentration does not result in saturation; hence the cathode peak for
the 2mM concentration is also included in the calibration curve for the cathode peak
currents in the range 0.2mM to 2mM range and is presented in figure 15. The correlation
factor between the current peaks and concentration of chemical for both anodic and
47
Concentration of chemical Anode peak with respect Anode peak location
to baseline
100 uM 36 127
200 uM 70 80
500 uM 179 81
1 mM 351 81
2 mM 504 81
1 mM 433 191
2 mM 507 191
48
Anode peaks versus concentration
350
300
250
200
150
49
equivalent current
100
50
0
0 0.2 0.4 0.6 0.8 1 1.2
concentration in mM
Figure 12: Calibration curve of anode peaks for potassium ferri cyanide
Cathode peaks versus concentration
600
500
400
300
50
equivalent current
200
100
0
0 0.5 1 1.5 2 2.5
concentration in mM
Figure 13: Calibration curve for cathode peaks of potassium ferri cyanide
CHAPTER 7: FUTURE WORK
same into calibration curves. A calibration look-up table can then be constructed with
51
APPENDIX A: CODE
//author: ashwini
//filename: potentio.c
#include "potentio.h"
#include <adc.h>
#include <timers.h>
char x_data[256];
#pragma idata
52
void ADC_handle(void); /*function prototype needed for goto below*/
void slope_area_peak(void);
void high_ISR(void)
_asm
goto ADC_handle
_endasm
#pragma code
void slope_area_peak(void)
int i, j, k, l;
float x,y, x_mean, y_mean, cov_xy, var_x, slope, y_int, left_slope, left_y_int,
right_slope, right_y_int;
53
//calculate anode peak
x_data[i] = i + 1;
if (i == 0)
an_peak_loc = i;
an_peak = y_data[i];
else
an_peak_loc = i;
an_peak = y_data[i];
x_data[i] = 255 - i;
if (i == 128)
cat_peak_loc = i;
54
cat_peak = y_data[i];
else
cat_peak_loc = i;
cat_peak = y_data[i];
knee:for (i = (2 + incr); i < peak_loc; i++) //the first co-ordinate of right line runs through
2 and (peak_loc - 1)
for (j = (0+incr); j <= peak_loc; j++) //calculate left and right slopes
x = x_data[j]; y = y_data[j];
cov_xy += x*y;
if (j == (i-1))
{
55
x_mean /= (i - incr); y_mean /= (i - incr); var_x -= (i -
left_slope = cov_xy/var_x;
else
if (j == peak_loc)
right_slope = cov_xy/var_x;
0.0;
{
56
if (k < i)
else
rms_err_right/(peak_loc+1 - i);
if (i == (2 + incr))
rms_err_least = rms_err;
y_int = left_y_int;
else
rms_err_least = rms_err;
slope = left_slope;
57
y_int = left_y_int;
if (incr == 0)
peak_loc = cat_peak_loc;
incr = 128;
an_slope = slope;
an_y_int = y_int;
goto knee;
else
if (incr == 128)
cat_slope = slope;
cat_y_int = y_int;
58
#pragma interrupt ADC_handle
void ADC_handle(void)
ad_temp = ReadADC();
//------------------------------------------------------------------
//------------------------------------------------------------------
PORTCbits.RC1 = 0;
putcSPI(data_out);
putcSPI(data_out);
PORTCbits.RC1 = 1;
PORTCbits.RC2 = 0;
putcSPI(data_out);
putcSPI(data_out);
PORTCbits.RC2 = 1;
//------------------------------------------------------------------
avg_ad_temp += ad_temp;
59
cnt++;
avg_ad_temp = 0;
else
if (cnt == 2048)
mem = 0x1ff8;
PIE1bits.ADIE = 0;
}
60
void main(void)
start:
input
CCPR2L = 0xC4;
CCPR2H = 0x04;
OpenTimer3(TIMER_INT_OFF &
T3_16BIT_RW &
T3_SOURCE_INT &
T3_PS_1_4 &
T3_SYNC_EXT_OFF &
putcSPI(data_out);
putcSPI(data_out);
PORTCbits.RC1 = 1;
//Delay10KTCYx(256000);
//Delay10KTCYx(256000);
//Delay10KTCYx(256000);
//Delay10KTCYx(256000);
//Delay10KTCYx(256000);
//Delay10KTCYx(256000);
//Delay10KTCYx(256000);
//Delay10KTCYx(256000);
while(PIE1bits.ADIE == 1);
slope_area_peak();
Delay10KTCYx(256000);
goto start;
62
APPENDIX B: PCB LAYOUT
63
APPENDIX C: PARTS LIST
Resistors
Potentiometers
Capacitors
64
REFERENCES
BEAC99 Richard D. Beach, Falko v. Kuster, and Frances Moussy, December 1999.
"Subminiature Implantable Potentiostat and Modified Commercial Telemetry
Device for Remote Glucose Monitoring." IEEE Transactions of
Instrumentation and Measurement , 1999, pg.no. 937-942 Vol. 48, No.6.
BOCK23 John O.M. Bockris, Amulya K.N. Reddy, Maria Gamboa-Aldeco. Modern
Electrochemistry. second edition, 1923.
KATZ04 “Biosensors & Bioelectronics Home page of Eugenii Katz”. Available at:
http://chem.ch.huji.ac.il/~eugeniik/faq.htm
KAKE95 Ralf G. Kakerow, Holger Kappert, Egbert Spiegel and Yiannos Manoli.
"Low-Power Single-Chip Cmos Potentiostat." The 8th International
Conference on Solid-Sate Sensors and Actuators, and Eurosensors IX.
Stockholm, Sweden, 1995. pg. no. 142-45. Vol. 1.
65
MAXI97 MAXIM, “MAX5354 10-Bit Voltage-Output DACs in 8-Pin μMAX”, 1997.
Available at:
http://ww1.microchip.com/downloads/en/DeviceDoc/39564b.pdf
MICR04
a) Microchip Technology, Inc. "Microchip Mplab C18 C User's Guide".
2004. Available at:
http://ww1.microchip.com/downloads/en/DeviceDoc/51288c.pdf
66
PROU03 Wesley A. Prouty, “Embedded system design for multi-purpose sensors to
detect and analyze environmental contaminants”, 2003.
67
SALV__ Stan Salvador and Philip Chan. Determining the Number of
Clusters/Segments in Hierarchical Clustering/Segmentation Algorithms.
Florida: Florida Institute of Technology.
TEXA01 Texas Instruments, "PT5060 Series, 9-W, +5V Input Dual-Output Integrated
Switching Regulator", 2001. Available at:
http://dkc3.digikey.com/PDF/T042/1247.pdf
68