Understanding iR Compensation
Some of the most common technical questions we hear at Gamry have to do with iR compensation --
- Where does uncompensated iR come from?
- Do I need to use iR compensation with my experiment?
- How should I set up the iR compensation parameters?
- Why doesn't iR compensation work on my system?
In this Application Note we shall attempt to answer these questions and to give you a basic understanding of iR compensation.
Some initial background information describes the general issue of iR errors. The later information concentrates on the specifics of “current-interrupt” iR compensation as a means for measuring and correcting for iR error. Positive-feedback iR compensation is mentioned but not discussed in detail.
This Application Note presumes that you have a basic understanding of potentiostat operation. If not, please review our primer on potentiostats. Experienced potentiostat users should skip the primer and read on.
It would also help if you know some of the fundamentals of electrochemical impedance. We have a primer on electrochemical impedance on our website. Pay particular attention to how typical chemical processes are mapped into electrical circuit elements.
When do I need iR compensation?
We'll give an approximate answer to this question here. A more complete answer requires the information discussed below and some information about the system that you are testing.
In general, iR compensation is needed when one or more of these is true:
- You are doing a quantitative test that yields a numerical result, such as a corrosion rate, equilibrium constant or a rate constant
- The solution in your cell is not very conductive
- Your currents are fairly high
- Your cell geometry is less than ideal
Unfortunately, these criteria are subjective. For example, aqueous 0.5 M potassium chloride may be considered to be very conductive in an electrochemical analysis application and poorly conductive in a plating application.
One simple run-of-thumb is often used:
Record some initial data-curves with and without iR compensation. If the shape of the curve changes significantly when iR compensation is applied, compensation is required.
IR compensation often adds additional noise to the data, so increased noise on the plot is not considered to be a significant change.
What Is the Origin of iR Error?
Let’s look at a typical three-electrode electrochemical test cell. We have labeled some reference points in the cell to which we shall refer throughout the remainder of this Application Note.
A: Counter electrode output at the potentiostat
B: Metal surface of Counter electrode
C: Electrolyte surface of Counter electrode
D: Electrolyte at the tip of the Luggin capillary
E: Electrolyte surface of the working electrode
F: Metal surface of the Working electrode
G: Electrolyte surface of the Reference electrode
H: Reference electrode input at the potentiostat
I: Working electrode output at the potentiostat
We can also think of the cell as a (simplified) network of electronic components something like this:
Almost any potentiostat will do a good job of controlling and measuring the voltage between Points H & I.
Unfortunately, we really want to control and measure the voltage between Points E & F. This is the potential difference across the electrochemical interface we are trying to study:
Vimportant = Vf — Ve
For purposes of this discussion, Point I is equivalent to Point F. Point G is equivalent to H, except for a constant offset-voltage caused by the difference in potential between Working Electrode/Reference Electrode, also known as the open-circuit voltage, Voc. And because there is no current flowing through the reference, the potential drop across Rbridge is 0 and Point G is equivalent to D. So starting from:
Vmeasured = VI — VH
we can get to:
Vmeasured = Vf — Vd + Voc
We are one step from finding the reaction potential, Vf-Ve. Point E is equivalent to Point D except for that nuisance resistor, Ru.
How is it related? By Ohm's law:
Ve — Vd = Icell X Ru
So substituting this in gives:
Vmeasured = Vf — Ve + Icell X Ru + Voc
Rearranging the result gives:
Vimportant = Vf — Ve = Vmeasured — Icell X Ru — Voc
We can measure the voltage, Vmeasured. We measure the current, Icell. We can look up or measure the open circuit voltage, Voc. But without knowing Ru, we can't find Vimportant!
And this question is at the heart of iR compensation. iR stands for Icell X Ru.
Luckily, it is possible to measure Ru and correct for it, if it is a problem.
What Kinds of Cells and Electrochemical Systems Do We Need to Worry About?
Most of the time, electrochemists can rig their experiments so that iR drop is not a problem. One simple way is to add a non-reactive salt, acid, or base (supporting electrolyte) which increases the electrolyte's conductivity.
Conductivity up → Ru down → iR error down
Another way is to minimize the distance between the tip of the Lugin capillary and the working electrode. Just design the cell so that the distance is tiny.
Obviously, if it were that simple, we wouldn't be getting so many questions.
Adding a supporting electrolyte will affect the electrochemistry even if the ions don't directly become involved in the reaction. It will change the composition of the double layer (Cf). It may affect the solubility or structure of the reactants and products. It may change the structure of the surface atomic layers. In many cases, it may be important not to monkey with the electrolyte. For example, the corrosion chemist wants to study the corrosivity of “Gloop,” not “Gloop” plus salt.
Likewise, the solution to cell design often is not a solution. Many cells designs are limited mechanically. A subtler problem is that putting the reference electrode too close to the working electrode surface changes the current density at that surface, changing the very measurements we’re trying to make.
So do you need to worry about iR error?
Yes, if your electrolyte isn't very conductive or your reference probe is far from the reacting surface. Often you can measure iR quite easily.
How is iR Error Measured?
The following circuit has some important clues for measuring iR and from it, Ru. It represents a common, simplified model of the electrical behavior of an electrochemical cell.
Model of Randles cell.
Look at Rfaradaic. It has a capacitor, Cfaradaic in parallel with it. Ru doesn't.
This should suggest that an AC experiment can differentiate between these two resistors. High frequency signals pass right through Cf with no voltage drop, while they are forced to drop Icell X Ru volts going through Ru just like low frequencies.
Indeed, if you record the Electrochemical Impedance Spectrum of this cell, its Bode representation looks like the following:
At low frequencies where Cf is effectively an open circuit, the measured impedance is the sum of Ru and Rf. At high frequencies where Cf is effectively a short circuit, the measured impedance is Ru.
So if you need to worry about Ru, you can measure it and multiply it by the cell current.
The resulting error voltage is the uncompensated iR, Ve-Vd. If iR is smaller than a few millivolts, don't worry about it.
For example: Suppose from the impedance spectrum, Ru = 100 Ω. Suppose Icell = 10 μA.
iR = 100 X 10 X 10-6 = 1 mV.
For most electrochemical phenomena, that is a small error.
Another way to think about it is - if Rf >> Ru, don't worry about Ru.
Measuring Ruusing a DC technique
Measuring Ru using AC Impedance is good in theory, but sometimes we need a quicker, less expensive way to make the measurement. And very often, we want to make the measurement while we are doing something else, such as recording a current-versus-voltage curve.
Luckily, there is an equivalent DC method. Actually a better term for it is a "transient" technique. It is know as Current Interrupt iR compensation.
Again, consider the simple Randles cell model for an electrochemical reaction with solution resistance.
Gamry Intruments' potentiostats contain a circuit that can rapidly turn off (interrupt) current flow through the cell, wait a short time (10 µs to 30000 µs), and then turn the current back on. Many other commercial instruments have the same capability.
To make the current interrupt measurement, cell voltage (Vmeasured) is measured immediately before and immediately after the current interruption. Ideally, the measured voltage of this cell would look like the graph:
Suppose we are measuring 1.0 V while current is flowing. At time 0 we interrupt the current — very quickly! The voltage immediately drops by the voltage drop across Ru. Then it starts dropping more slowly.
The decrease in voltage is caused by the slow discharge of the faradaic capacitor through Rfaradaic. This only becomes important at longer times. At short times, the capacitor can hold the voltage to Vmeasured — Vu which is our Vimportant. And this is what we seek.
As usual, things aren't so simple. Three problems interfere with this simple model:
- Sampling speed
- Output capacitance
One problem with the Idealized Current Interrupt waveform is the speed of sampling required. In the above figure, the sampling is 2 µs (very fast). We can slow down the sampling considerably if we pretend the decaying curve is a straight line and extrapolate it back to the turn-off time.
Let's try that with the same Randles cell we've been using, so we sample at 1 ms and 2 ms, and extrapolate back to 0 ms when the switch was turned off. You get something like this:
The estimated Vu is calculated by:
Vu = V1 + (V1-V2)
In this case V1 = 0.671 V, V2 = 0.481 V, and by the straight-line extrapolation, Vu is estimated at 0.862 V.
But wait, Vu is actually closer to 0.938 V. We were misled by picking too slow a time base. You can see the curvature in the turn-off trace in the picture. Of course it's curved: it's an exponential decay.
By the way, these are actual numbers from our original Randles cell model, calculated in MathCad® and plotted in Excel®.
So we've gone too far. Millisecond timing is too slow for iR measurements on this cell. Something faster (but not too fast) ought to work.
How do you tell?
Mathematically the decay time constant T is Rfaradaic X Cfaradaic. In this cell,
Tfaradaic= 3000 Ω x 1 µF = 3 ms
If you know, roughly, these values, you can pick a short time T to be RC/10. Or you can sneak up on the correct answer by decreasing tsample until the number stabilizes.
But there's another problem lurking as tsample gets shorter: Potentiostat output and cable capacitance.
Think back to the original cell model:
That innocent looking capacitor, Ccable, can cause a lot of problems. If you have a typical shielded cable, the value of Ccable can be 50 pF per foot (1.6 pF/cm). For a 5-foot (152 cm) cable that's 250 pF. Add another 100 pF or so for capacitance in the switch itself, on the circuit board, and in the driving amplifier.
We can use this circuit as a model:
The cable capacitance forms an RC section with Ru and Rsolution. This means the voltage across Ru doesn't disappear infinitely fast.
For purposes of this discussion, we must assume the counter electrode's capacitance is big and acts as a short-circuit at these time scales. Fortunately, it's a reasonable assumption.
Suppose you decided to set iR sampling at 50 µs and 100 µs. These points are shown as the open diamonds on the following graph:
Using those two measurements, obviously the iR estimate is again highly inaccurate. You must wait until the cable-capacitance transient has died out before you make the measurement.
It may be helpful to see this on a log (time) scale so you can see the cell-cable & faradaic capacitors being discharged.
You need to find a time-range between the two limiting discharge curves.
The cable capacitance must be fully discharged, but the faradaic capacitance must still be in the approximately linear region. If your faradiac capacitance is not much, much larger than the cable capacitance, current-interrupt iR compensation will not work.
Noise can be a major problem when current-interrupt iR compensation is used on a real-world system.
Basically, current-interrupt iR compensation is a differential measurement. Remember the equation we use for estimating Vu :
Vu = V1 + (V1-V2)
The differential term, V1-V2, is very sensitive to noise.
In systems suitable for current-interrupt iR compensation, the difference between V1 and V2 is small, from a few millivolts to a few hundred millivolts.
Suppose there is a positive noise contribution to V1 and a negative noise contribution to V2. The average noise is 0 but the error in Vu is twice as big!
You might say "So what? Just turn on some filtering. The noise will go away." But we are trying to measure a rapid (10-1000 µs) phenomenon. We cannot insert a 5 Hz filter, or the whole transient gets distorted - if not disappears altogether.
All of these things can help to reduce the noise:
Use a Faraday cage to keep extraneous noise out of the measurement.
Use signal-averaging to make the noise terms average out while keeping the real values.
If your noise source's frequency is known, use a synchronous sampling method so that all the noise causes errors in the same direction.
Finally, if the noise is still too large, don't use the extrapolation method. Just settle on an average, such as:Vu = (V1 + V2)/2
The noise situation is worse when you're trying to measure low currents. Under these conditions, when the current-interrupt switch is opened, the Reference electrode and Working electrode pick up more noise than under higher-current conditions.
How is it corrected?
So far we've only talked about measuring iR. If we know the value of Vu we can subtract off the Vmeasured value and get Vimportant. This is known as Post-Processing Correction.
One problem with post-processing correction is that we cannot predict the true potential prior to applying it. This is particularly problematic in experiments that sweep the potential. In these experiments, the scan rate across potential is not constant and the scan limits may be wildly inaccurate.
We would prefer that the potentiostat measure and correct for Vu continuously. After all, when you want to apply 1 V to a cell, you intend that Vimportant = 1 V, not Vmeasured = 1 V.
The situation is much simpler when you use a galvanostat. A galvanostat does not have to apply a correction for Vu, for its job is to control current, not voltage. It still has to measure Vu.
The simplest, although not the most effective way to automatically correct for iR using Current-Interrupt is to have the potentiostat add its best guess for Vu onto the applied signal. This can be stated as a formula where the indexes in brackets represent measurement points:
Vapplied[i] = Vrequested[i] + Vu[i-1]
Initially, there is no correction. The measured error from the first data point is then added to the applied potential of the second data point. This process continues, with the correction becoming more accurate as data is accumulated.
Note that this is a dynamic correction. Ru can change during an experiment, and the system will automatically compensates for that change.
Direct feedback of the error voltage into the next data point is not the most sophisticated way to apply the correction. A better approach to understanding the feedback mechanism is to treat iR correction as a control loop.
The control-loop algorithm treats the potentiostat as a loop within a loop. The inner loop is the potentiostat itself, which measures Vmeasured and controls it in a feedback mechanism. This loop is made purely from analog electronics as shown:
(We have eliminated a few components that are irrelevant to this part of the discussion.)
The potentiostat is a control loop. It measures Vmeasured and compares it to Vapplied, making corrections to the counter electrode voltage until the difference between the two is 0. All of this happens continuously.
The iR correction also happens in a control loop outside of the potentiostat loop. It is shown in this figure:
The outer loop does a very similar job to the inner loop but it is implemented digitally in a computer. Its job is to see that Vimportant = Vapplied, and now the job of the inner loop is to see that Vmeasured = Vactual. Vactual is a new value that comes from the outer loop.
We also show an interesting block that produces Vactual. It is known as a gain block or controller block, depending on to whom you talk. Its output is given by the expression:
This is known to control engineers as a PID loop. Each of the gains is individually controllable. By adjusting the gains, we can get iR compensation to perform better than the simple feedback algorithm. In practice we tend to use the integral control for IR compensation.
At Gamry Instruments, we commonly use a control-loop algorithm in our DC software. It is set using some lines from our experiment control language, Explain™, that look like this:
Pstat.SetIruptMode (IruptClfg, RuExtrap,IruptTime, POTEN.Eoc (), 0.8)
The value, 0.8, is the control loop gain, Ki. Kp is fixed at 1.0, and Kd is 0. Note that the voltage channel filter (VchFilter) is set to pass 100 kHz signals. If we're not using iR compensation, the filter is set to knock out as much environmental noise as possible.
One can modify the parameters including the control-loop mode, Vu calculation, current interrupt timing and gain to suit the dynamics of the reaction and cell under test.
Advantages of Current-Interrupt iR Compensation
Current-interrupt iR compensation offers some advantages compared to other iR compensation methods. These include:
- No prior knowledge of Ru is required
- Ru can change during an experiment without creating errors in compensation
- Compensation is independent of the current range used to measure the current so it works in auto-ranged experiments.
- Scan parameters such as ramp limits and scan rates are corrected automatically
Practical Limitations of Current-Interrupt iR Compensation
Current-interrupt iR compensation works well on some electrochemical systems, but fails to work properly when applied to other systems. The failures are generally explainable in terms of the practical limitations of the technique.
The limitations include:
- Need for a large faradiac capacitance
- Time-per-point limitations
- Rfaradiac should be larger than Ru
- Value of Ru must be less than a limit
Each of these will be explained below.
Need for a large Faradaic capacitance
As discussed above, Cfaradaic maintains a "DC" potential when the current is interrupted. If the faradaic capacitor is missing or too small, current-interrupt usually drives the system to a large potential and current. The most obvious symptom of this problem is measured current many times higher than the expected cell current. Overload indications may also be present.
Current-interrupt using Gamry Instruments' potentiostats works best with a faradiac capacitance of greater than 20 µF. For a "bare metal" electrode you can estimate the capacitance as 20 µF/cm2, so the electrode area must be 1 cm2 or greater. We do not recommend that you use current-interrupt iR compensation if the electrode is covered with any sort of insulating coating.
This requirement generally limits current-interrupt iR compensation to corrosion testing and battery and fuel cell research. Current-interrupt does not work well with the electrode sizes commonly used in physical electrochemistry cells.
Current-interrupt iR compensation assumes that you apply a DC potential and current most of the time. The interrupt time should be much smaller than the time required to measure each data point in a data curve.
By default, Gamry Instruments' software automatically selects a total current-interrupt time and sampling time for the interrupt. Theses time are adjusted whenever the current range changes, with longer interrupt times and slower sampling on more sensitive current ranges. The range of interrupt times is generally 10 µs to 64 ms.
Gamry Instruments recommends that you only apply current-interrupt iR compensation when the time per data point is 1 s or greater.
If you are sweeping the potential, this limits the sweep rate to 5 mV/s or less.
Rfaradiacshould be larger than Ru
There are also limitations on the ratio between Rfaradiac and Ru. Because the same current flows through both resistors, this is also a limitation on the ratio between the voltage across the electrochemical interface and the error voltage.
Gamry Instruments' experience with current-interrupt on model systems shows that Ru should not be more than ten to twenty times Rfaradaic. If Ru is bigger than this limit, the electronic measurement of the iR error starts to have significant errors.
Usually a more severe limitation on this ratio occurs in the cell. Most electrochemical cells have a non-uniform current distribution across the electrode surface. Some portions of the working electrode see more current than others. Under these conditions, the simple Randles cell model doesn't apply. The interface cannot be described using a single potential.
Unless your cell has a geometry designed for uniform current distribution, we believe you should keep Ru one tenth of Rfaradaic or smaller. If the ratio is greater than 1/10, we believe that any quantitative results obtained on your system will be in error. Note that this is only a "gut feel" approximation. We cannot guarantee this approximation will apply to your electrochemical system.
Value of Runot too large
There is also an limit on the value of Ru, independent of the value of Rfaradaic. Our experience has shown that errors occur when Ru exceeds some upper limit. This limit is about 10 kΩ for most Gamry Instruments systems.
Positive Feedback iR Compensation
Current-interrupt iR compensation is only useful when you are measuring slow phenomena, such as corrosion reactions or characteristics of energy-storage devices. It cannot be used when very fast measurements are needed. One example of a fast experiment is 1000 V/s cyclic voltammetry used to measure chemical kinetics.
Fortunately, there is an iR-compensation technique that works on fast systems. It is called positive-feedback iR compensation.
This technique can be thought of as an additional analog feedback path in the potentiostat. All useful potentiostats measure the cell current. When positive feedback is enabled in a potentiostat, a fraction of the current signal is fed back as an additional voltage input.
The figure below is a highly simplified schematic diagram of a potentiostat.
Simplified Potentiostat with PFIR D/A Converter
In the lower right portion of this diagram, current is measured by voltage drop across Rm. This drop is amplified to produce a voltage signal called Isig. In this diagram, Isig is 3 V at full-scale current.
In the upper right portion of the diagram we show a block labeled PFIR DAC. This is the Positive-Feedback IR digital-to-analog converter. Its output is a voltage that is a known fraction of Isig. When positive feedback iR is enabled, this voltage is applied to the control amplifier as an additional voltage input.
Note: In this diagram and the discussion, the PFIR DAC output is not scaled prior used as a source of feedback. This may not be true for all PFIR implementations, including some of Gamry Instruments' implementations.
Some simple math leads to:
Isig = 3.0 x Icell/IFS = Icell x Re ,
where Re is the equivalent current measurement resistor given by:
Re = 3.0 V/IFS
Re tells us the maximum value of Ru we can compensate on any current range.
In positive-feedback iR compensation, you need to know Ru before you can apply the correction. Gamry Instruments' PHE software includes a convenient method for measuring Ru prior to running an experiment. This method uses a simplified form of EIS and assumes that the cell impedance at high frequencies is identical to Ru.
Once you enter a value for Ru and select positive-feedback iR correction, Gamry Instruments' software sets the PFIR DAC to generate a fraction of Isig identical to the ratio of Ru to Re. Given this setting, the voltage feedback is:
PFIR out = Ru/Re x Isig
= Ru/Re x Icell x Re
= Ru x Icell
We are increasing the potential applied to the cell by the voltage across Ru. This voltage is created by the flow of the cell current.
The range of Ru values that can be corrected is 0 Ω up to Re. The resolution in the value is controlled by the PFIR DAC resolution. With a 14-bit DAC (D/A converter), the resolution is Re/16 384.
As an example, let's look as the 3 mA current range. On this range, Re is 1000 Ω. The positive-feedback correction with a 14-bit DAC has a resolution of 1000/16 834 or about 0.061 Ω per bit.
Advantages of Positive Feedback iR Compensation
Positive feedback iR compensation offers some advantages compared to other iR compensation methods. These include:
- Usable in very fast experiments
- Scan parameters such as ramp limits and scan rates are corrected
Practical Limitations of Positive Feedback iR Compensation
There are disadvantages in positive-feedback iR compensation compared to other compensation methods:
- Prior knowledge of the value of Ru is required
- Errors occur if Ru changes value during the experiment
- The current range must not change during the experiment
- Positive feedback can lead to potentiostat oscillation
Want a PDF version of this application note?
Please complete the following form and we'll mail a link to your inbox!