12
On the use of a real time application interface under Linux in the electrochemistry laboratory. Application to chronopotentiometry Francisco Martı ´ nez-Ortiz Departamento de Quı ´mica Fı ´sica, Universidad de Murcia, E-30071 Murcia, Spain Received 2 March 2004; received in revised form 29 July 2004; accepted 29 July 2004 Abstract The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry laboratory, owing to the development of experimental devices that allow us to take decisions or actions in situ, and also provide feedback. This device was successfully applied to the particular case of chronopotentiometry to stop experiments or to invert the sign of the applied cur- rent, in order to minimise the undesirable effects of charge of the double layer capacitance and to compensate the uncompensated ohmic drop. Moreover, digital simulation of double layer charge effects was also carried out. A schematic description of the software driving the device is given. Ó 2004 Elsevier B.V. All rights reserved. Keywords: Real time; Linux; Digital simulation; Chronopotentiometry; Double layer capacitance; IR drop 1. Introduction The use of a real time operating system (RTOS) is of- ten necessary in computer driven electrochemical exper- iments; in particular, when the response to a given perturbation influences the perturbation itself. There are two main alternatives when using RTOS: a commer- cially available operating system, or an RTOS based on an open source operating system. Linux is a widespread extended Open Source Operating System. Linux itself is not a RTOS; however there are some extensions of Li- nux, which convert it into a RTOS. Among these exten- sions we have selected the real time application interface (RTAI) [1]. RTAI was developed mainly at the Dipart- amento di Ingenieria Aerospaziale (Politecnico di Mila- no) by Professor Paolo Mantegazza and co-workers. RTAI provides a deterministic and pre-emptive per- formance in addition to allowing the use of all standard Linux drivers, applications and functions. RTAIs per- formance is very competitive with commercial RTOSs. Moreover, like standard Linux, RTAI is open source and can be downloaded from the Internet [1]. RTAI offers many applications in the electrochemis- try laboratory. Among these we would point out: (1) the construction of versatile medium-speed computer driven general-purpose electrochemical devices with the implementation of standard electrochemical tech- niques; (2) the design of techniques in which decisions on actions are taken in situ, depending on the experi- mental response; (3) the implementation of techniques requiring feedback actions in the applied perturbation driven by the responses obtained. In spite of the interest of (1), this paper focuses on options (2) and (3), applied to chronopotentiometric techniques, which are greatly improved with the procedures given here. Fifty years ago, chronopotentiometry underwent an optimistic rise in its expectations as an electroanalytical and kinetic technique [2,3], owing to the relative simplic- ity (under some conditions) of its theoretical back- ground and the simpler instrumentation required, 0022-0728/$ - see front matter Ó 2004 Elsevier B.V. All rights reserved. doi:10.1016/j.jelechem.2004.07.034 E-mail address: [email protected] (F. Martı ´ nez-Ortiz). www.elsevier.com/locate/jelechem Journal of Electroanalytical Chemistry 574 (2005) 239–250 Journal of Electroanalytical Chemistry

On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

Journal of

www.elsevier.com/locate/jelechem

Journal of Electroanalytical Chemistry 574 (2005) 239–250

ElectroanalyticalChemistry

On the use of a real time application interface under Linux in theelectrochemistry laboratory. Application to chronopotentiometry

Francisco Martınez-Ortiz

Departamento de Quımica Fısica, Universidad de Murcia, E-30071 Murcia, Spain

Received 2 March 2004; received in revised form 29 July 2004; accepted 29 July 2004

Abstract

The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry laboratory, owing

to the development of experimental devices that allow us to take decisions or actions in situ, and also provide feedback. This device

was successfully applied to the particular case of chronopotentiometry to stop experiments or to invert the sign of the applied cur-

rent, in order to minimise the undesirable effects of charge of the double layer capacitance and to compensate the uncompensated

ohmic drop. Moreover, digital simulation of double layer charge effects was also carried out. A schematic description of the software

driving the device is given.

� 2004 Elsevier B.V. All rights reserved.

Keywords: Real time; Linux; Digital simulation; Chronopotentiometry; Double layer capacitance; IR drop

1. Introduction

The use of a real time operating system (RTOS) is of-ten necessary in computer driven electrochemical exper-

iments; in particular, when the response to a given

perturbation influences the perturbation itself. There

are two main alternatives when using RTOS: a commer-

cially available operating system, or an RTOS based on

an open source operating system. Linux is a widespread

extended Open Source Operating System. Linux itself is

not a RTOS; however there are some extensions of Li-nux, which convert it into a RTOS. Among these exten-

sions we have selected the real time application interface

(RTAI) [1]. RTAI was developed mainly at the Dipart-

amento di Ingenieria Aerospaziale (Politecnico di Mila-

no) by Professor Paolo Mantegazza and co-workers.

RTAI provides a deterministic and pre-emptive per-

formance in addition to allowing the use of all standard

0022-0728/$ - see front matter � 2004 Elsevier B.V. All rights reserved.

doi:10.1016/j.jelechem.2004.07.034

E-mail address: [email protected] (F. Martınez-Ortiz).

Linux drivers, applications and functions. RTAIs per-

formance is very competitive with commercial RTOSs.

Moreover, like standard Linux, RTAI is open sourceand can be downloaded from the Internet [1].

RTAI offers many applications in the electrochemis-

try laboratory. Among these we would point out: (1)

the construction of versatile medium-speed computer

driven general-purpose electrochemical devices with

the implementation of standard electrochemical tech-

niques; (2) the design of techniques in which decisions

on actions are taken in situ, depending on the experi-mental response; (3) the implementation of techniques

requiring feedback actions in the applied perturbation

driven by the responses obtained. In spite of the interest

of (1), this paper focuses on options (2) and (3), applied

to chronopotentiometric techniques, which are greatly

improved with the procedures given here.

Fifty years ago, chronopotentiometry underwent an

optimistic rise in its expectations as an electroanalyticaland kinetic technique [2,3], owing to the relative simplic-

ity (under some conditions) of its theoretical back-

ground and the simpler instrumentation required,

Page 2: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

240 F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250

along with its unique characteristic to control directly

(current fixing) the rate of the charge transfer reaction.

However, this optimistic rise in expectation was quickly

followed by a very pessimistic fall [4,5] with the final

outcome being a minor presence in the electrochemical

laboratory, as compared to potentiostatic techniques.The main reason for this fall was, from the kinetic point

of view, undoubtedly, the disturbing effects of the capac-

ity current [6,7].

However, theoretical and experimental work was

developed using several variants of current-programmed

chronopotentiometry [8–27], which have been applied

under favourable conditions (high concentrations and

long time scale).In this paper, important experimental improvements

of chronopotentiometry are obtained through the use

of RTAI. These improvements lie in the diminishing of

undesirable double layer charge and IR drop effects,

allowing the development of experimental studies using

chronopotentiometry under, until now, unfavourable

conditions (low concentrations and short time scale)

which makes the productive use of the large theoreticalbackground available in the literature possible. The soft-

ware developed has been checked and tested in the lab-

oratory using well-known experimental systems.

Digital simulation of the effect of the double layer

charge has also been carried out in this paper, in order

to describe the expected behaviour of the real systems

undergoing this effect, and to evaluate some of the pro-

cedures proposed to improve the technique.

2. Experimental

Experiments were carried out with a computer driven

potentiostat–galvanostat specifically designed and con-

structed by D. Fernando Ruiz Abellan (SACE, Univer-

sity of Murcia). The AD and DA converters with 25 lsconversion time, were incorporated into the potentio-

stat–galvanostat in such a way that the transmission of

the data to/from the computer was carried out in digital

format by means of a home made board plugged into

the ISA-bus of the computer. This board contains coun-

ters and digital input–output. In this work neither the

clock of the counters nor other artifacts, such as direct

memory access (DMA), usually incorporated into com-mercial ADDA boards, were ever used because the

acquisition–perturbation cycles were driven by the soft-

ware tools provided by RTAI. The digital transmissions

greatly decrease the noise of the signals measured and of

the perturbations sent. All computer programs were

written in our laboratory, as explained in Appendix A.

A static mercury drop electrode was constructed using

a dropping mercury electrode, EA 1019-1 (Metrohm),to which a homemade valve was sealed. Electrode radii

in the range 0.006–0.05 cm were obtained depending on

the DME used, the mercury pressure and the length of

time the valve was open. The drop size was measured

by weighing a large number (100–1000) of equal drops.

In the experiments presented in this paper, the electrode

radius was fixed at 0.02 cm. An Ag|AgCl|1 M KCl elec-

trode and a platinum electrode were used as referenceand auxiliary electrodes. Chemicals were analytical

grade from Merck and were used as received. In all

experiments the temperature was kept constant at

25 ± 0.2 �C.

3. Results and discussion

There are several procedures provided by RTAI to

implement the real-time routines. Among these possibil-

ities one can select the loading of real time routines as

Kernel modules or the developing of applications in

standard user space using the module Linux Real Time

(LXRT). Due to its better performance qualities, the di-

rect loading of real time routines as Kernel modules was

preferred, while the user interface was developed withKDevelop [28] and the Qt library [29] for use in standard

user space. Communication between the real time Ker-

nel modules and the user interface was performed using

the services provided by RTAI. Details of the implemen-

tation are given in Appendix A.

Several steps were carried out in the experimental

study. First, a simple and economical multipurpose

electrochemical device was constructed and some stand-ard electrochemical techniques (chronoamperometry,

chronopotentiometry and several kinds of voltammetric

techniques) were implemented and checked for perform-

ance. The software developed under RTAI works

appropriately at high rates. Typically, cycles of measure-

ment/calculations/application of the perturbation can be

carried out at frequencies higher than 100 kHz. These

results are obtained with a modest single processor Pen-tium II 64 Mb computer at 350 MHz, using the ISA bus

to drive the potentiostat/galvanostat digitally. Hence,

these results will be improved when using more up to

date machines (according to RTAI specifications [1];

the use of a dual processor computer for timing and a

PCI card for communication with the instrument) will

be particularly useful. The final experiments presented

in this paper were restricted to cycles with frequenciesof 33 kHz, owing to the limit imposed by the rate of con-

version of the ADDA converters used in the instrument;

this experimental construction is however fast enough to

obtain transition times down to 5 ms, which is the prac-

tical limit imposed by the time constant of the cell em-

ployed. In order to achieve a shorter time scale it is

necessary to use microelectrodes, which is far from the

aim of this paper.Once the general-purpose apparatus works properly,

the second step was to implement routines taking deci-

Page 3: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

Fig. 1. Cyclic chronopotentiogram of 2 mM Cd(II) in 0.2 M KNO3. In

the cathodic scans I0 = 20 lA, in the anodic scans I0 = �20 lA.

Compensated for double layer charge with Ccomp = 0.125 lF.

Fig. 2. Influence of the parameter K on the dimensionless potential–

time curves calculated for a fast (reversible) charge transfer process.

g0 = 30, G = 1. The values of K are: (a) 0; (b) 0.0005; (c) 0.001; (d)

0.0025; (e) 0.005; (f) 0.0075; (g) 0.01; (h) 0.015.

F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250 241

sions in situ. As a simple example, in Fig. 1, an experi-

ment of cyclic chronopotentiometry is shown (this

experiment also contains compensation for the double

layer charge, as explained later). In this experiment,

the change in sign of the current was achieved when

the potential reached prefixed values. To avoid erratic

behaviour owing to spurious noise, the current was in-

verted only if two consecutive values of the measuredpotential accomplished the imposed condition. The

experiment was also automatically stopped when the

programmed numbers of cycles were completed.

The third step (and the main aim of this paper) was

the development of a procedure to diminish the undesir-

able effect of double layer charging in chronopotentiom-

etry. In constant current chronopotentiometry (and in

many other variants of the technique) the main distor-tion of chronopotentiograms takes place in the regions

where jumps of potential occur (typically at the begin-

ning of the electrolysis and near the transition time).

At the beginning of the electrolysis, a potential jump oc-

curs because the electrochemical cell at open circuit re-

mains at a potential value, determined by the chemical

nature of the cell, and frequently some hundreds of

mV from the E0 value of the redox couple. This distor-tion can be minimized by keeping the cell in potentio-

static mode, at a potential close to the E0 value (but

sufficiently distant to avoid appreciable electrolysis), be-

fore galvanostatic electrolysis. The rest of the chrono-

potentiogram can be improved with the feedback

addition to the cell of a current proportional to dE/dt.

Prior to the experimental implementation of the

above procedures to improve the experimental response

to galvanostatic perturbations, we carried out, by means

of digital simulation, an evaluation of the effect of the

double layer capacitance and of the application of an

initial potential to chronopotentiograms.

In the simulations, dimensionless variables are al-

ways used (see Appendix B for definition of variables

and for details on implementation of the simulation).

In Fig. 2 we have plotted the dimensionless poten-tial–time curves (dimensionless potential was g = nF/

RT(E � E0) and dimensionless time was X = t/sS, withsS the transition time given by Sand�s equation) for a

fast (reversible) charge transfer reaction, beginning at

g0 = 30, and for several values of the parameter

K ¼ RTnF

� �Cd

nFD1=2c�As1=2S

. Fig. 2 represents a typical experi-

mental situation with chronopotentiometric experi-

ments starting from open circuit, showing the

distortion from ideal behaviour which can be expected

by increasing the double layer capacitance (Cd), and

by decreasing the bulk concentration or the time scale.The effect of changing the initial potential at which

the galvanostatic experiment is started is shown in

Fig. 3. The simulation of the previous potentiostatic

mode can be performed in a direct way or, in a simpler

form, by fixing a value of the bulk concentration of the

reduced species in such a manner that the resulting equi-

librium potential is the starting potential. After some

numerical experiments, the second, easier, procedurewas selected, because the resulting curves constructed

by the two procedures are indistinguishable; moreover,

this procedure was also used in previous attempts to ob-

tain chronopotentiograms, starting at a finite potential

Page 4: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

Fig. 3. Influence of g0 on the dimensionless potential–time curves

calculated for a fast (reversible) charge transfer process. G = 1.

K = 0.015. The values of g0 are: (a) 3; (b) 4; (c) 6; (d) 8; (e) 10; (f)

15; (g) 20; (h) 30.

242 F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250

and with the consideration of the influence of the dou-

ble layer capacitance [30–33]. In spite of the great influ-

ence of the initial potential with the consideration of the

double layer charge, in the absence of double layer ef-

fects, the potential–time curves starting from infinite

potential and those starting at finite potential are indis-

Fig. 4. Influence of the parameter K on the dimensionless potential–

time curves calculated for a fast (reversible) charge transfer process.

g0 = 4. Other conditions as in Fig. 2

tinguishable for bulk concentration values, such that

c�B < 0:01c�A.As can be seen in Fig. 3, the selection of appropriate

lower initial potential values (the condition of negligible

electrolysis in the potentiostatic step must always be

accomplished) clearly improves the first stage of thechronopotentiogram. This feature is also evident in

Fig. 4, constructed under the same conditions of Fig.

2, but with a dimensionless initial potential g0 = 4.

Once the convenience of the previous potentiostatic

step has been established and the distortion of the

potential–time curves caused by double layer charge

evaluated, the next step is to select a procedure to meas-

ure dE/dt to feedback the current. This is a very relevantaspect, because the derivative is very sensitive to the

presence of noise, with a large tendency to produce oscil-

lations. Indeed, there are some previous attempts in the

literature to feedback the current with a quantity pro-

portional to dE/dt by means of electronic circuits

[34,35]. However, the instability of the resulting systems

has been the main cause of failure of these attempts,

which have been operative only in strongly damped sys-tems with compulsory long time scales.

There are two main problems in calculating the

derivative from experimental data in the real time

mode: (1) only points previous to that in which the

derivative has to be evaluated are available and (2) it

is necessary to use some noise reduction procedure

to avoid oscillations, but without damping the full

system.Three procedures have been assayed to calculate the

derivative dE/dt and to apply the real time positive

feedback.

(1) The derivative is calculated by using backward dif-

ferentiation formulae [36], taking m previous exper-

imentally determined potential values and the

potential actually measured. This is the approachusually used in flux calculations from one-sided

derivatives in electrochemical digital simulation

[37], but it does not contain any noise reduction

procedure. Taking as an example, the m = 4

approximation, the derivative is given by

dEi

dt�� 1

12Dt�25Ei þ 48Ei�1 � 36Ei�2ð

þ16Ei�3 � 3Ei�4Þ; ð1Þ

where Ei is the actual value of the measured poten-

tial and Ei�1, Ei�2, Ei�3, Ei�4 are the values of the

potential measured in previous steps. Dt is the time

elapsed between two consecutive samples.

(2) A ‘‘mean derivative’’ obtained following a one-

sided Savitzy–Golay [38] like procedure, in whichthe derivative is evaluated, taking m + 1 points

(the actual and m previous), as

Page 5: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250 243

dEi

dt� 1

mDt

Xmj¼1

Ei � Ei�j

j: ð2Þ

(3) By fitting the actual and m previous experimentally

obtained potential-values to a second order polyno-

mial like

E � a0 þ a1t þ a2t2; ð3Þ

Fig.

m =

taking t = 0 in the actual point, and negative time

values for the m previous measurements. In this

way, the derivative is simply

dEdt

� a1: ð4Þ

An illustrative example of the result of the applica-

tions of these procedures to a weakly noisy signal isshown in Fig. 5. The derivatives obtained by procedures

2 and 3 (Figs. 5(B) and (C)) are of similar quality and

much better than that calculated by procedure 1 (Fig.

5(A)). Both procedures 2 and 3 are of interest and have

been used in our laboratory. However, owing to the low-

er m value needed to achieve a similar noise reduction,

we have preferred the ‘‘mean derivative’’ method. As ex-

pected, the use of backward differentiation formulaegives rise to high amplitude oscillations only damped

by coupling a severe electronic low pass filter.

Once the effect of the double layer capacitance has

been calculated, the effect of a previous potentiostatic

step has been evaluated and a procedure to calculate

the one-sided derivative (which will make possible the

5. Calculated one-sided derivatives of ‘‘Signal’’, obtained by means of d

4. (B) Mean derivative with m = 9. (C) Parabolic fit with m = 19.

application of the positive feedback) has been selected,

we are ready to show experimentally the enhancements

that can be obtained in the chronopotentiometric re-

sponse when using these procedures.

The inclusion of a previous potentiostatic step was

suggested by Bos and Van Dalen [35] as a method toeliminate contaminants in chronopotentiometry with

the mercury pool electrode, but it is also useful in dimin-

ishing the double layer charge effect at the beginning of

the chronopotentiogram. In all the experiments shown

in this paper, the cell was kept at the initial potential se-

lected for 3 s. After this time the cell was switched off,

the instrument switched to galvanostatic mode, the cell

switched on again, and the galvanostatic experimentstarted. The simple inclusion of the previous potentio-

static step gives rise to an important improvement of

the first part of the chronopotentiogram and to a signif-

icant shortening of the transition time, as is shown in

Fig. 3.

Once the appropriate initial potential has been se-

lected, the next step is to impose to the cell a positive

feedback current, Ifb proportional to the value of dE/dt calculated in situ (by means of the ‘‘mean derivative’’

procedure). As can be seen in Fig. 6 (which is very sim-

ilar to Fig. 4), the increase of the proportionality con-

stant, Ccomp gives rise to a compensation of the double

layer capacitance effect. The comparison of experimen-

tal curves with those obtained by digital simulation indi-

cates that full compensation is achieved in curve f in Fig.

6. The stability of the calculated derivative enables over-compensated chronopotentiograms, as correspond to

ifferent procedures. (A) With the backward differentiation formula and

Page 6: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

Fig. 6. Influence of the compensation for the double layer charge in experimental potential–time curves of 0.25 mM Cd(II) in 0.2 M KNO3.

E0 = �0.525 V. I0 = 6 lA. The values of Ccomp (lF) are: (a) 0; (b) 0.025; (c) 0.050; (d) 0.075; (e) 0.100; (f) 0.125; (g) 0.200.

Fig. 7. Ratio of the feedback current to the programmed current corresponding to the experiments in Fig. 6.

244 F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250

curve g in Fig. 6. However, note that in over-compen-

sated curves a clear tendency to oscillate is evident.

The use of the previous potentiostatic step constitutes

an interesting complementary profit when using feed-

back current, because it strongly reduces the need for

high feedback in the first stage of the experiment, where

calculation of feedback is difficult in nature (there are no

points to calculate the derivative).Fig. 7 is a representation of the feedback current (in

relation with the programmed current, I0) applied to ob-

tain Fig. 6. Note the high values of the feedback current,

sometimes larger than the programmed current near the

transition time. The tendency to oscillate is also evident

in the compensation current when overcompensation

occurs (curve g in Fig. 7), and it is much more evident

than in the potential–time curves. Consequently, the

monitoring of the feedback current can be used as a

diagnosis for overcompensation. However, the appear-

ance of oscillations can be dependent on either the kinet-ics of the charge transfer reaction or other experimental

circumstances. Consequently, when the comparison of

compensated curves with digitally simulated curves is

Page 7: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

Fig. 8. Influence of I0 on the experimental potential–time curves of 2 mM Cd(II) in 0.2 M KNO3. E0 = �0.525 V. Ccomp = 0.125 lF. The values of I0(lA) are: (a) 15; (b) 17; (c) 20; (d) 25; (e) 30; (f) 40; (g) 50. A and B without compensation for ohmic drop. C with a compensation Rcomp = 150 X.

F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250 245

not possible (for example due to the influence of un-

known kinetic parameters), the direct determination of

the double layer capacitance is recommended to be used

in compensation, instead of relying on the appearance of

oscillations.

The next step is focused on checking the quality of

the experimental response obtained with the use of the

previously described procedures. For this purpose wehave to study the transition time and the complete

potential–time curves. The transition time is the main

Fig. 9. Influence of I0 and concentration on the transition time of

solutions of Cd(II) in 0.2 M KNO3. Ccomp = 0.125 lF. Rcomp = 150 X.The concentration values are: (�), 0.25 mM; (�), 0.50 mM; (.), 1.00

mM; ($), 2.00 mM.

observable magnitude in a chronopotentiogram. For a

given electrode and composition of the solution, the

transition time is determined (in constant current chron-

opotentiometry) by the magnitude of the applied cur-

rent. Fig. 8(A) shows seven chronopotentiograms

corresponding to a 2 mM solution of Cd(II) for values

of I0 between 15 and 50 lA, corresponding to transition

times in the range 0.245–0.0216 s. Owing to the sharpjump observed in the potential–time curves, the transi-

tion time was simply taken as the time at which the

potential E = �1.2 V. According to theoretical predic-

tions (Sand�s equation), a linear dependence of s�1/2

on I0, with the slope increasing as the concentration de-

creases, is expected. Fig. 9 matches these expectations

completely.

For a fast (reversible) charge transfer reaction underplanar diffusion, the plot of E vs t/s for several values ofI0 should give rise to a superimposed set of curves [39].

In Fig. 8(B) it is evident that this superposition is not

complete for the curves obtained in Fig. 8(A). A more

detailed observation of Fig. 8(B) reveals that the curves

corresponding to upper I0-values are shifted to more

negative potentials. In the absence of kinetic effects,

the shift must be due to uncompensated ohmic drop.With the experimental ensemble developed here, uncom-

pensated ohmic drop is not a serious problem. In fact,

the only artefact needed consists of the, always in situ,

subtraction from the measured potential (before deriva-

tive calculation) of a quantity proportional to the

known applied current (including the feedback current),

and being the proportionality constant Rcomp. Once this

compensation is carried out, a perfect superposition ofpotential–time curves is obtained (Fig. 8(C)). The opti-

mal value of Rcomp in Fig. 8(C) was evaluated by a trial

and error procedure; however the direct measurement of

the corresponding value is also possible.

Page 8: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

246 F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250

4. Final remarks

The use of RTAI under Linux is very interesting in

the electrochemistry laboratory, allowing the develop-

ment of experimental devices adapted to a wide variety

of situations, and introducing the calculation power ofa personal computer in the innermost part of electro-

chemical experiments. This paper is focused on the

improvement of classic chronopotentiometry with the

static mercury electrode. The improvements are very

important, with a strong diminishing of the main prob-

lem associated with the use of chronopotentiometry: the

disturbing effect of double layer charging. Compensa-

tion of ohmic drop has also been considered. In theexperiments carried out, it was assumed that, in the

feedback current proportional to dE/dt, the proportion-

ality is given by a constant value. However, it is possible,

with very few changes, to modify the software, to take

into account a dependence on the potential or, even, a

dependence on time, of the electrode area, as occurs in

growing electrodes. Moreover, the application of the

procedures developed to current-programmed chrono-potentiometry or to chronopotentiometry with solid

electrodes is immediate (indeed, experiments with sev-

MasterRoutine

KERNEL MOD

USER SPAC

User Inte

F

FIFO

FIFO 0

START

STOP

Fig. 10. Working scheme of the full application: FIFO 0: (W) Used to Start/S

experiment. FIFO 1: (R) Used to receive messages from Real Time Applicat

FIFO 3: (R) Used to receive the experimentally recorded data. FIFO 4: (W

perturbation branch. FIFO 5: (R) Used to notify the end of the experiment

from user interface. (R): To read from user interface.

eral kinds of current-programmed chronopotentiometry

and with platinum and carbon paste electrodes have

been developed in our laboratory, but they are not pre-

sented here for the sake of simplicity). Of course, similar

software can be developed under RTAI to improve

potentiostatic techniques.

Acknowledgements

The author greatly appreciates the financial support

provided by the Direccion General Cientıfica y Tecnica

(Project No. BQU2003-04172), and by the Fundacion

Seneca (Project PB/53/FS/02).

Appendix A. Details on implementation of the real time

routines and user interface

RTAI works using a small real-time hardware

abstraction layer (RTHAL), which intercepts all hard-

ware interrupts and routes them to either standard Li-nux or to a real time task. The RTHAL provides a

framework onto which RTAI is mounted, with the abil-

TechniqueSpecific Routine

ULE

E

rface

IFO 2

FIFO 31

FIFO 4

FIFO 5

top the experiment by user actions and to transfer the parameters of the

ion: FIFO 2: (W) Used to send data of the perturbation to be applied.

) Used to send the indexes corresponding to the beginning of each

and the total number of experimentally acquired points. (W): To write

Page 9: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250 247

ity to pre-empt Linux fully, thus allowing the develop-

ment of user interfaces and data storage systems under

Linux; networking capabilities are maintained and the

pre-emptive real time operation is not interfered with.

This scheme clearly separates real and non-real time

operations but avoids a tight interaction between them,allowing adequate communication between the two sep-

arate execution lanes.

The RTHAL shows some additional advantages: it

leads to minimal change to the standard Linux Kernel,

the real-time extensions can be easily removed by replac-

ing the interrupt function pointers with the original Li-

nux routines; moreover it is efficient and flexible.

Following the RTAI philosophy, hard real time rou-tines and the user interface have been developed sepa-

rately. Real time routines have been written as C

programs and compiled according to Linux Kernel

requirements, giving rise to a loadable kernel module

which has to be loaded before operation. The user inter-

face was developed as a C++ program with KDevelop

2.1.4 [28]. KDevelop is an Integrated Development

Environment using the Qt library [29], which providesa powerful Graphical User Interface. For communica-

tion between these two parts, first in first out (FIFO)

channels provided by RTAI have been used. In the ac-

tual implementation, a total of six channels were in

use. The even channels (0, 2, 4) are used to send data

Fig. 11. Display of the main window in the user interface an

to and the odd channels (1, 3, 5) to receive data from

the user interface.

Both, the Kernel-module and the user interface are

available, free of charge, as source code from the author

by direct E-mail request.

The Linux Kernel 2.4.18 has been used and patchedwith RTAI 24.1.9, giving rise to Kernel 2.4.18-rthal5

Fig. 10 is a diagram of the working scheme of the full

application. In the Kernel-module there are two main

routines. Once the module is loaded, a master routine

is always running (at 20 Hz frequency) and waiting for

user-actions. To start an experiment, the user interface

writes the perturbation to be applied to the electrode

in the FIFO 2 channel. In some complex perturbations(for example in cyclic chronopotentiometry with pro-

grammed current) constituted by a set of independent

branches, the indices corresponding to the beginning

of each branch are also written in the FIFO 4 channel.

Through FIFO 0, the user interface sends the details

of the experiment to the master routine. Then, the mas-

ter routine starts the technique-dependent routine, pro-

gramming in a proper way the rate at which theexecution must occur. At each execution cycle, the tech-

nique-dependent routine performs data acquisition, cal-

culations (if necessary) and perturbation application.

The technique-dependent routine can send messages to

the user interface by means of FIFO 1, while the results

d of the window responsible for graphics manipulation.

Page 10: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

248 F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250

of the experiment (the recorded current and/or potential

and time) are sent by FIFO 3. FIFO 5 is reserved to no-

tify the end of the experiment if the ending condition is

achieved, and to give the total number of cycles exe-

cuted. Simultaneously, this notification is sent to the

master routine in the Kernel module, which returns toits waiting state for new actions from the user, and the

technique-dependent routine is auto-ended. In slow

experiments, the user can send a signal to interrupt the

experiment, using FIFO 0.

The user interface contains a set of visible and non-

visible C++ classes and is responsible for the experimen-

tal and instrumental configurations as well as for data

manipulation and storage. All classes are designed towork with the potentiostat/galvanostat and with the

electrode described in Experimental, but they can easily

be adapted to other configurations. Fig. 11 shows the

appearance of the main window of this user interface

and of the window used in graphics manipulation.

Appendix B. Digital simulation of double layer capaci-tance effects

We will consider a simple charge transfer reaction

Aþ ne� ¢kf

Kb

B; ðB:IÞ

where the forward and backward rate constants for each

charge transfer reaction are

kf ¼ kse�ag;

kb ¼ kseð1�aÞg;ðB:1Þ

with

g ¼ nFRT

E � E0� �

: ðB:2Þ

To obtain dimensionless variables the transition time

given by the Sand equation (sS) was taken as the refer-

ence time,

X ¼ tsS

;

Ck ¼ckc�A

ðk ¼ A;BÞ;

X ¼ xffiffiffiffiffiffiffiffiDsS

p ;

GF ¼ IFs1=2S

nFAeD1=2c�A;

KS ¼kSs

1=2S

D1=2;

ðB:3Þ

where t is time, ck is the concentration of species k. IFis the current employed in the faradaic process (an un-

known quantity, because it is the total current minus

the current employed in the charge of the double layer

capacitor), Ae is the electrode area and D is the diffu-

sion coefficient (which we will suppose as equal for

both species). Other symbols retain their usual

meanings.

With these variables the boundary value problem canbe written for a plane electrode as

dCA ¼ dCB ¼ 0; ðB:4Þ

with

d ¼ o

oX� o2

oX 2; ðB:5Þ

X ¼ 0; X P 0

X > 0; X ! 1

�CA ¼ 1; CB ¼ C�

B; ðB:6Þ

X > 0; X ¼ 0 : GF ¼ oCA

oX

� �X¼0

¼ � oCB

oX

� �X¼0

¼ KSðCAe�ag � CBe

ð1�aÞgÞ; ðB:7Þ

oCA

oX

� �X¼0

þ oCB

oX

� �X¼0

¼ 0; ðB:8Þ

The double layer charge is considered by

G ¼ GF þ KogoX

; ðB:9Þ

where G is the dimensionless current applied to the

cell; in the usual chronopotentiometric experiment it

will be constant (obviously, it can also be any arbi-

trary function of the dimensionless time), K is the

dimensionless double layer capacitance, which may

be constant or potential dependent. The dimensionless

capacitance is related to the usual capacitance per unit

of area, Cd by

K ¼ RTnF

� �Cd

nFD1=2c�As1=2S

: ðB:10Þ

To solve Eq. (B.4) numerically, it is necessary to dis-

cretise the dimensionless time, distance and concentra-

tions. To show the procedure applied, simple schemes

to discretise time and distance have been selected, and

a simple implicit time-integration scheme has also been

selected, although more sophisticated spatial grids (for

example unequally spaced grids) or integration schemes

(for example, Crank–Nicolson or extrapolation) can beeasily implemented.

Let us suppose

X ¼ X i ¼ hi; 0 6 i 6 imax;

Xmax ¼ himax ¼ 6;ðB:11Þ

Page 11: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250 249

X ¼ Xw ¼ wdX; 0 6 w 6 wmax; ðB:12Þi and w are integer values and wmax is unknown a priori,

because it depends on the achievement of a end-condi-tion, for example the depletion of species A at the elec-

trode surface.

With a two-point discretisation for time intervals and

a three-point scheme for spatial discretisation, we obtain

for each species (A and B) and each time step

C0i�1 þ bC0

i þ C0iþ1 ¼ fi; 1 6 i 6 imax � 1; ðB:13Þ

with

b ¼ 1�2kk ;

fi ¼ � Cik

ðB:14Þ

and

k ¼ dX

h2: ðB:15Þ

Because this is an initial value problem, the values of

concentrations at time Xw are known quantities and are

noted at spatial point i as Ck, i, whereas the values of

concentrations at time Xw+1 are unknown quantities

and are represented by C0k; i. For simplicity, the index k

has been suppressed in Eq. (B.13).

The set of Equations (B.13) constitutes a tridiagonallinear system (incomplete) of equations, which can be

solved by means of the Thomas algorithm [37]. Thus,

a bulk value of concentration ðC0imax

¼ C�Þ must be

provided. Successive substitution in Eq. (B.13) from

upper to lower indices leads to the recursive

relationship

C0i�1 þ b0iC

0i ¼ f 0

i ; 1 6 i 6 imax � 2; ðB:16Þ

with

b0imax�1 ¼ b;

f 0imax�1 ¼ fimax�1 � C�;

b0i ¼ b� 1

b0iþ1

;

f 0i ¼ fi �

f 0iþ1

b0iþ1

;

ðB:17Þ

which constitutes a didiagonal linear system of equa-tions which can be solved completely by providing a va-

lue for C00. When complex boundary conditions, such as

those given in Eqs. (B.7)–(B.9) are present, a convenient

procedure to calculate surface concentration is the use of

the u–v procedure [40]:

First, we will rewrite Eq. (B.16) in the more appropri-

ate form

C0i ¼ ei þ aiC

0i�1; 1 6 i 6 imax � 2; ðB:18Þ

with

ei ¼f 0i

b0i;

ai ¼ � 1

b0i:

ðB:19Þ

Eq. (B.18) relates the values of concentration at two

adjacent points in the profile and its successive applica-

tion allows us to express any given concentration as a

function of the surface concentration. Moreover, theone-sided gradient approximation at the electrode sur-

face, for each participant species, can be written as

[37,40–42]

oCoX

� �X¼0

¼Xq

i¼0

riC0i: ðB:20Þ

The coefficients ri depend on q and are given explicitly in

[37] for a uniform grid and in [41] (for q 6 4) for a gen-eral grid. In [42] a general method to evaluate these coef-

ficients numerically is given.

The application of the u–v method [40] gives rise to

oCoX

� �X¼0

¼ bþ dC00; ðB:21Þ

with

b ¼Xq

i¼1

Xi

m¼1

riemYi

p¼mþ1

ap;

d ¼Xq

i¼0

ri

Yi

m¼1

am:

ðB:22Þ

It is necessary to recover the index k (k = A, B), be-

cause the known coefficients b and d are different for

each species. Hence, these coefficients will be noted as

bk and dk. Once the format given in Eq. (B.21) is as-

sumed, the boundary value conditions (at the electrode

surface) can be combined to give an easily solved one-unknown equation.

For the consideration of the double layer charge we

take

G ¼ GF þ Kg0 � gdX

; ðB:23Þ

where g represents the known potential at Xw and g 0 the

unknown potential at Xw+1. The combination of Eqs.

(B.6)–(B.9), taking into account Eqs. (B.21) and(B.23), leads to

G� Kg0 � gdX

� �1

KS

� e�ag

dA� eð1�aÞg

dB

� �

þ bA

dAe�ag � bB

dBeð1�aÞg ¼ 0; ðB:24Þ

where the only unknown is g 0 and the rest of the var-

iables, including the total dimensionless current, G, are

known. g 0 was obtained by application of the bisection

Page 12: On the use of a real time application interface under ...2005)239.pdf · The use of a real time application interface (RTAI) under Linux is very advantageous in the electrochemistry

250 F. Martınez-Ortiz / Journal of Electroanalytical Chemistry 574 (2005) 239–250

method to Eq. (B.24). Once g 0 is known, GF can be

evaluated with Eq. (B.23), and the surface concentra-

tions with Eq. (B.21). The recursive application (from

lower to upper values) of Eq. (B.18) leads to the cal-

culation of all the values of the concentration in the

profile, finishing the calculations of the time step inquestion and leaving the system ready for the next

time step.

Note that to solve Eq. (B.24) appropriately for the

first time, an initial value (at X = 0) of the potential,

g0, must be provided. The best procedure to obtain a fi-

nite value of g0 and preserve the initial equilibrium con-

ditions is the assignation of a non-null value to C�B, with

g0 ¼ � lnðC�BÞ: ðB:25Þ

A change in the value of C�B, when C�

B < 0:01, does notcause appreciable modifications in the chronopotentio-

gram when the double layer charge is ignored, but its

influence is marked when K > 10�3.

Eq. (B.24) is applicable for any value of a and KS, un-

der fast and slow charge transfer reactions. To simulatefast (reversible) charge transfer reactions, we have taken

KS = 10,000 and a = 0.5, although the results are inde-

pendent of a and KS for KS > 100.

In all the simulations presented in this paper 500

points are taken to simulate each concentration profile,

taking dX = 0.0001. Computer programs for simulations

were written in C++ using Borland C++ Builder and

run in the console mode of Windows 98, using a per-sonal computer with an AMD XP 1700+ processor with

256 MB RAM.

References

[1] Available from: <www.aero.polimi.it/projects/rtai>.

[2] P. Delahay, New Instrumental Methods in Electrochemistry,

Interscience, New York, 1954.

[3] P. Delahay, C. Mamantov, Anal. Chem. 27 (1955) 478.

[4] J. Lingane, Anal. Chem. 39 (1967) 485.

[5] R.S. Nicholson, Anal. Chem. 44 (1972) 478R.

[6] D.H. Evans, Anal. Chem. 36 (1964) 2027.

[7] L. Nadjo, J.M. Saveant, J. Electroanal. Chem. 91 (1978) 247.

[8] S.K. Rangarajan, J. Electroanal. Chem. 62 (1975) 31.

[9] H.L. Kies, J. Electroanal. Chem. 76 (1977) 1.

[10] L. Hadjo, J.M. Saveant, J. Electroanal. Chem. 75 (1977) 181.

[11] T. Gueshi, K. Tokuda, H. Matsuda, J. Electroanal. Chem. 89

(1978) 247.

[12] P. Deenen, M. Lindstrom, G. Sundholm, J. Electroanal. Chem.

101 (1979) 291.

[13] M. Skyllas, B.J. Welch, J. Electroanal. Chem. 98 (1979) 59.

[14] J. Galvez, J. Electroanal. Chem. 132 (1982) 15.

[15] Z. Galus, J.O. Schenk, R.N. Adams, J . Electroanal. Chem. 135

(1982) 1.

[16] A. Molina, F. Martınez-Ortiz, J. Albaladejo, J. Electroanal.

Chem. 251 (1988) 249.

[17] R. Kant, S.K. Rangarajan, J. Electroanal. Chem. 265 (1989)

39.

[18] A. Molina, M. Lopez-Tenes, C. Serna, J. Electroanal. Chem. 278

(1990) 35.

[19] A. Molina, C. Serna, M. Lopez-Tenes, J. Electroanal. Chem. 284

(1990) 21.

[20] F. Martınez-Ortiz, A. Molina, C. Serna, J. Electroanal. Chem.

308 (1991) 97.

[21] A. Molina, M. Lopez-Tenes, C. Serna, J. Electroanal. Chem. 346

(1993) 53.

[22] A. Molina, F. Martınez-Ortiz, M. Lopez-Tenes, C. Serna, J.

Electroanal. Chem. 369 (1994) 15.

[23] C. Serna, J. Gonzalez, A. Molina, J. Electroanal. Chem. 399

(1995) 223.

[24] A. Molina, F. Martınez-Ortiz, R. Ruiz, M. Lopez-Tenes, Collect.

Czech. Chem. Commun. 62 (1997) 709.

[25] J. Gonzalez, A. Molina, F. Martınez-Ortiz, C. Serna, J. Electro-

anal. Chem. 440 (1997) 111.

[26] L.M. Abrantes, J. Gonzalez, A. Molina, F. Saavedra, Electro-

chim. Acta 45 (1999) 457.

[27] A. Molina, J. Gonzalez, J. Electroanal. Chem. 493 (2000) 117.

[28] Available from: <www.kdevelop.org>.

[29] Available from: <www.trolltech.com>.

[30] M.L. Olmstead, R.S. Nicholson, J. Phys. Chem. 72 (1968) 1650.

[31] R.S. Rodgers, L. Meites, J. Electroanal. Chem. 16 (1968) 1.

[32] W.T. De Vries, J. Electroanal. Chem. 17 (1968) 31.

[33] W.T. De Vries, J. Electroanal. Chem. 19 (1968) 55.

[34] W.D. Shults, F.E. Haga, T.R. Mueller, H.C. Jones, Anal. Chem.

37 (1965) 1415.

[35] P. Bos, E. Van Dalen, J. Electroanal. Chem. 45 (1973) 165.

[36] W.G. Bickley, Math. Gaz. 25 (1941) 19.

[37] D. Britz, Digital Simulation in Electrochemistry, Springer, Berlin,

1988.

[38] A. Savitzy, M.J.E. Golay, Anal. Chem. 36 (1964) 1627.

[39] A.J. Bard, L.R. Faulkner, Electrochemical Methods, Wiley, New

York, 2001.

[40] D. Britz, J. Electroanal. Chem. 352 (1993) 17.

[41] D. Britz, J. Strutwolf, Comput. Biol. Chem. 27 (2003) 327.

[42] D. Britz, Electrochem. Commun. 5 (2003) 195.