Understanding iR Compensation
Introduction
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 Tech Tip we'll attempt to answer these questions and to give you a basic understanding of iR compensation.
Background
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 runofthumb 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.
Where does iR error come from?
Let's look at a typical 3electrode electrochemical test cell. We've labeled some reference points in the cell that we'll refer to throughout the remainder of this application note.
Reference Points: A: Counter electrode output B: Metal surface of Counter C: Electrolyte surface of D: Electrolyte at the tip of E: Electrolyte surface of F: Metal surface of the G: Electrolyte surface of H: Reference electrode I: Working electrode output

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're trying to study.
V_{important} = V_{f} — V_{e}
For purposes of this discussion, Point I is equivalent to Point F. Point G is equivalent to H, except for a constant offset voltage due to the Working Electrode/Reference Electrode potential difference, also known as the open circuit voltage, V_{oc}. And since there is no current flowing through the reference, the potential drop across R_{bridge} is 0 and Point G is equivalent to D. So starting from:
V_{measured} = V_{I} — V_{H}
we can get to:
V_{measured} = V_{f} — V_{d} + V_{oc}
We're one step from finding the reaction potential, V_{f}V_{e}. Point E is equivalent to Point F except for that nuisance resistor, Ru.
How is it related? By Ohm's law:
V_{e} — V_{d} = I_{cell} * R_{u}
So substituting this in gives:
V_{measured} = V_{f} — V_{e} + I_{cell} * R_{u} + V_{oc}
Rearranging the result gives:
V_{important} = V_{f} — V_{e} = V_{measured} — I_{cell} * R_{u} — V_{oc}
We can measure the voltage, V_{measured}. We measure the current, I_{cell}. We can look up or measure the open circuit voltage, V_{oc}. But without knowing R_{u}, we can't find V_{important}!
And this question is at the heart of iR compensation. iR stands for I_{cell} * R_{u}.
Luckily, it is possible to measure R_{u} and correct for it, if it is a problem.
What kinds of cells/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 nonreactive salt, acid, or base (supporting electrolyte) which increases the electrolyte's conductivity.
Conductivity up > R_{u} 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 (C_{f}). 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 change the electrolyte. For example, the corrosion chemist wants to study the corrosivity of his or her electrolyte, not the electrolyte plus salt.
Likewise, the cell design solution often is not a solution. Many cells designs are limited mechanically. A more subtle problem is that putting the reference too close to the working electrode surface will change 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, R_{u}. It represents a common, simplified model of the electrical behavior of an electrochemical cell.
Look at R_{faradaic}. It has a capacitor, C_{faradaic} in parallel with it. R_{u} doesn't.
This should suggest that an AC experiment can differentiate between these two resistors. High frequency signals pass right through C_{f} with no voltage drop while they are forced to drop Icell * R_{u} volts going through R_{u} just like low frequencies.
Indeed, if you record the Electrochemical Impedance Spectrum of this cell, it's Bode representation looks like the following:
At low frequencies where C_{f} is effectively an open circuit, the measured impedance is the sum of R_{u} and R_{f}. At high frequencies where C_{f} is effectively a short circuit, the measured impedance is R_{u}.
So if you need to worry about R_{u}, you can measure it and multiply it by the cell current.
The resulting error voltage is the uncompensated iR, V_{e}V_{d}. If iR is smaller than a few millivolts, don't worry about it.
For example. Suppose from the impedance spectrum, R_{u} = 100 Ohm. Suppose Icell = 10 uA.
iR = 100 * 10 * 10^{6} = 1 mV.
For most electrochemical phenomena, that is a small error.
Another way to think about it is  if R_{f} >> R_{u}, don't worry about R_{u}.
Measuring R_{u}using a DC technique
Measuring R_{u} 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 Randle's cell model for an electrochemical reaction with solution resistance.
Gamry's potentiostats contain a circuit that can rapidly turn off (interrupt) current flow through the cell, wait a short time (10 µsec to 30000 µsec), and then turn the current back on. Many other commercial instruments have the same capability.
To make the current interrupt measurement, cell voltage (V_{measured}) 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 R_{u}. Then it starts dropping more slowly.
Why?
The decrease in voltage is caused by the slow discharge of the faradaic capacitor through R_{faradaic}. This only becomes important at longer times. At short times, the capacitor can hold the voltage to V_{measured} — V_{u} which is our V_{important}. And this is what we're after.
As usual, things aren't so simple. Three problems interfere with this simple model; Sampling Speed, Output Capacitance, and Noise.
Sampling Speed
One problem with the Idealized Current Interrupt waveform is the speed of sampling required. In the above figure, the sampling is 2 µsec (very fast). We can slow down the sampling considerably if we pretend the decaying curve is a straight line and back extrapolate it to the turnoff time.
Lets try that with the same Randle's cell we've been using. Sample at 1 ms and 2 ms, back extrapolate to 0 ms when the switch was turned off. You get something like this:
The estimated V_{u} is calculated by: V_{u} = V1 + (V1V2)
In this case V1 = 0.671 V, V2 = 0.481 V, and by the straightline extrapolation, Vu is estimated at 0.862 V.
But wait, Vu is actually closer to 0.938 V. We've been misled by picking too slow a time base. You can see the curvature in the turnoff trace in the picture. Of course it's curved — it's an exponential decay.
By the way, these are actual numbers from our original Randle's 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 is R_{faradaic} * C_{faradaic}. In this cell,
tau_{faradaic}= 3000 Ohm * 1 µF = 3 ms
If you know, roughly, these values, you can pick a short time tau 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 & Cable Capacitance.
Cable Capacitance
Think back to the original cell model:
That innocent looking capacitor, C_{cable}, can cause a lot of problems. If you have a typical shielded cable, the value of C_{cable} can be 50 pF per foot. For a 5foot 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 R_{u} and R_{solution}. This means the voltage across R_{u} doesn't disappear infinitely fast.
For purposes of this discussion, we have to assume the counter electrode 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 µsec and 100 µsec. 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
Noise can be a major problem when current interrupt iR compensation is used on a realworld system.
Basically, current interrupt iR comp is a differential measurement. Remember the equation we use for estimating V_{u} :
V_{u} = V1 + (V1V2)
The differential term, V1V2, is very sensitive to noise.
In systems sutiable 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 V_{u} is twice as big!
You might say "So what. Just turn on some filtering. The noise will go away".
But we're trying to measure a rapid (101000 µsec) phenomenon. We can't put on a 5 Hz filter or the whole transient will be distorted, if not disappear 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 be settle an average, such as:
V_{u} = (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 pickup 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 V_{u} we can subtract off the V_{measured} value and get V_{important}. 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 potential scan rate is not constant and the scan limits may be wildly inaccurate.
We would prefer to have the potentiostat measure and correct for V_{u} continuously. After all when you want to apply 1 V to a cell, you intend that V_{important} = 1 V, not V_{measured} = 1V.
The situation is much simpler when you use a Galvanostat. A galvanostat doesn't have to apply a correction for V_{u} since its job is to control current, not voltage. It still has to measure V_{u}.
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 V_{u} on to the applied signal. This can be stated as a formula where the numbers in brackets represent measurement points:
V_{applied}[i] = V_{requested}[i] + V_{u}[i1]
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. R_{u} can change during an experiment, and the system will automatically compensate for that change.
Control loop algorithm
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 V_{measured} and controls it in a feedback mechanism. This loop is made purely from analog electronics as shown:
Again, we've eliminated a few components that are irrelevant to this part of the discussion.
The potentiostat is a control loop. It measures V_{measured} and compares it to V_{applied}, 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 V_{important} = V_{applied}, and now the job of the inner loop is to see that V_{measured} = V_{actual}. V_{actual} is a new value that comes from the outer loop.
We've also shown an interesting block that produces V_{actual}. It is known as a gain block or controller block, depending who you talk to. 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, we commonly use a the control loop algorithm in our DC software. It is set using some lines from our experiment control language, Explain, that look like this:
if (IRToggle) Pstat.SetIruptMode (IruptClfg, EuExtrap, IruptTime, POTEN.Eoc (), 0.8) Pstat.SetVchFilter (100000.0) else Pstat.SetIruptMode (IruptOff) Pstat.SetVchFilter (5.0)
The value, 0.8, is the control loop gain, K_{i}. K_{p} is fixed at 1.0, and K_{d} 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, V_{u} 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 R_{u} is required
 R_{u} 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 autoranged 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
 Timeperpoint limitations
 R_{faradiac} should be larger than R_{u}
 Value of R_{u} must be less than a limit
Each of these will be explained below.
Need for a large Faradaic capacitance
As discussed above, C_{faradaic} maintains a "DC" potential when the current is interrupted. If the faradaic capacitor is missing or too small, current interrupt will usually drive 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's 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/cm^{2}, so the electrode area must be 1 cm^{2} 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.
Timeperpoint limitations
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's 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 µsec to 64 msec.
Gamry recommends that you only apply current interrupt iR compensation when the time per data point is one sec or greater.
If you are sweeping the potential, this limits the sweep rate to 5 mV/sec or less.
R_{faradiac}should be larger than R_{u}
There are also limitations on the ratio between R_{faradiac} and R_{u}. Since 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's experience with current interrupt on model systems shows that R_{u} should not be more than ten to twenty times R_{faradaic}. If R_{u} 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 nonuniform current distribution across the electrode surface. Some portions of the working electrode see more current than others. Under these conditions, the simple Randle's 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 R_{u} one tenth of R_{faradaic} 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 R_{u}not too large
There is also an limit on the value of R_{u}, independent of the value of R_{faradaic}. Our experience has shown that errors occur when Ru exceeds some upper limit. This limit is about 10 kΩ for most Gamry systems.
Positive Feedback iR Compensation
Current interrupt iR compensation is only useful when you are measuring slow phenomena, such as corrosion reactions or energy storage device characteristics. It cannot be used when very fast measurements are needed. One example of a fast experiment is 1000 V/sec cyclic voltammetry used to measure chemical kinetics.
Fortunately, there is an iR compensation technique that will work 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. 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 volts 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 to follow, the PFIR DAC output is not scaled prior to being used as a source of feedback. This may not be true for all PFIR implementations — including some of Gamry's implementations.
Simplified Potentiostat with PFIR D/A Converter
Some simple math leads to:
Isig = 3.0 x I_{cell}/I_{FS} = I_{cell} x R_{e ,}
where Re is the equivalent current measurement resistor given by:
R_{e} = 3.0 V / I_{FS}
R_{e} tells us the maximum value of R_{u} we can compensate on any current range.
In positive feedback iR compensation, you need to know R_{u} before you can apply the correction. Gamry's PHE software includes a convenient method for measuring R_{u} prior to running an experiment. This method uses a simplified form of EIS and assumes that the cell impedance at high frequency is identical to R_{u}.
Once you enter a value for R_{u} and select positive feedback iR correction, Gamry's software sets the PFIR DAC to output a fraction of Isig identical to the ratio of R_{u} to R_{e}. Given this setting, the voltage feedback is:
PFIR out = R_{u}/R_{e} x Isig = R_{u}/R_{e} x I_{cell} x R_{e} = R_{u} x I_{cell}
We are increasing the potential applied to the cell by the voltage across R_{u}. This voltage is created by the flow of the cell current.
The range of R_{u} values that can be corrected is 0 Ω up to R_{e}. The resolution in the value is controlled by the PFIR DAC resolution. With a 14bit DAC (D/A converter), the resolution is R_{e}/16384.
As an example, let's look as the 3 mA current range. On this range, R_{e} is 1000 Ω. The positive feedback correction with a 14bit DAC has a resolution of 1000/16834 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 R_{u} 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