Mashed Potato Simulator — FuNII Lab
Teaching Tools

Mashed Potato Simulator

A virtual potentiostat for the classroom · CV · LSV · SWV · DPV · CA · OCP · runs in any modern browser

Cell

Solution: concentrations and redox couple

Electron-transfer kinetics

Electrode

Diffusion, double layer and noise

O + n e⁻ ⇌ R. Each run starts from a fresh, uniform solution.

Method

Waveform and sampling

Before the run

Label

Series of runs
V

drag to zoom · double-click to reset
Points
—
Time
—
Potential
—
Current
—
Surface cO / cR (mM)
—

Concentration profiles

Diffusion layer

Distance from the electrode surface. Point under the cursor: move along the curve above; the last point stays when you move away. Click a point on the curve, or choose a chosen point, to pin it and move through the run with the slider (arrow keys work too) or ▶ Play.

Runs

NameMethodRoleConc.Status

Analysis

mL

1 · Getting started

What this is

A potentiostat with a virtual cell inside, for teaching. It has the same methods, plots, analysis and exports as the Mashed Potato instrument page, but the current comes from a simulation of the electrode reaction O + n e⁻ ⇌ R instead of from a board. Students can change the chemistry, the electrode and the rate of electron transfer, and see straight away what each one does to a voltammogram, a chronoamperogram or a calibration line. Nothing is sent anywhere: the page works offline once loaded, and runs are autosaved in this browser.

Sign convention. Oxidation (R → O + n e⁻) gives a positive (anodic) current and reduction (O + n e⁻ → R) a negative (cathodic) current, as in the instrument page. In SWV and DPV the net current ΔI is taken in the direction of the scan, so a scan towards positive potentials shows an oxidation as a positive peak, and a scan towards negative potentials shows a reduction as a negative peak. The default cell contains only R, so sweeping to positive potentials oxidises it.

  1. Set up the Cell panel, or pick a ready-made cell from the menu at its top right.
  2. Choose a Method and its settings. The box under it says how many points the run has and how long the experiment lasts. The blue box below it, Theory predicts, gives the textbook values for this cell and method (peak current, peak separation, steady-state current…), so students can compare them with what they measure.
  3. Press Run at the top of the plot and watch the curve being drawn.
  4. Move the mouse along the curve to see the concentrations next to the electrode at each moment.

Running and watching a simulation

The run controls are at the top of the plot: Run, Pause (or the space bar), Step ▸, Stop, the drawing speed and Pause at. The line under them says whether the method is ready (or what needs fixing) and, during a run, where it is.

  • Speed. The simulation is calculated before the curve is displayed; the speed only sets how it is drawn: over about 3 s (Animate), 10 or 30 s (Slow), at the true experimental speed (Real time), or all at once (Instant).
  • Pause freezes the drawing. The rest of the curve stays hidden, so you can ask the class what will happen next while the profiles show the solution at that moment. Step ▸ then advances 10 mV at a time (5 pulses in SWV and DPV, 2 % of the run in CA and OCP).
  • Pause at: type potentials (for example 0.15, 0.23, 0.30: the foot of the wave, the peak, after the peak) and the drawing stops by itself at each one, on the forward sweep or on every sweep. For CA and OCP the values are times in seconds.
  • Concentration profiles. Move the mouse along the curve: the panel shows the concentrations of O and R against distance from the electrode at that moment, which is what explains the shape of the curve. The last point hovered stays there. Click a point to pin it: the slider under the panel's title then moves through the run (a marker on the curve shows where you are), and ▶ Play runs through it like a film.
  • Diffusion layer. Under the profiles, the same moment is shown as a cross-section of the cell: the electrode wall on the left (electrode dark grey, insulator light grey), the solution coloured by the concentration of R or O, distance from the surface across and position along the surface up, at the same scale. It follows the profile panel: hovering, the slider, Play and the drawing of a run. For the disc it is partly an illustration (see The three electrode shapes).

Techniques

  • CV: start → vertex 1 → vertex 2 → start, repeated for the number of scans. Set vertex 2 equal to the start for a single return sweep. Potential sweep chooses between a true linear ramp, as on an analog instrument (the double layer then gives a flat charging current Cdl·A·v), and a staircase, as on a digital instrument (the current is taken at the end of each step, when most of the charging current has decayed, and the peaks are a few per cent lower than for a ramp).
  • LSV: one sweep from start to end.
  • SWV: a staircase with a square wave on top (amplitude = half peak-to-peak). The current is taken at the end of each half-cycle; ΔI = forward − reverse.
  • DPV: each period holds the base potential, then pulses by the amplitude in the scan direction. ΔI = end of pulse − end of base.
  • CA: holds the rest potential during the quiet time, then steps to E₁ (and optionally E₂). Time zero is the step. Pulses repeats step 1 + step 2, and Change each pulse can move a potential or change a step length each time.
  • OCP: no current flows; the potential follows the Nernst equation for the bulk concentrations. If only one form is present, the Nernst equation gives no defined potential; the simulator then assumes a 0.01 % trace of the missing form. That is a numerical convention, not a property of real cells, whose open-circuit potential in that situation is set by impurities and side reactions.

Conditioning holds a potential before the run, and the quiet time holds the start potential just before it, so the surface can settle.

When the current is sampled

By default the current is taken at the end of every step (staircase CV and LSV), half-cycle (SWV) or pulse (DPV). At a set point takes it at a percentage of the step or pulse instead. Sampling earlier gives larger peaks, because the faradaic current decays during each pulse, but it also picks up more charging current. Sampling late rejects the charging current, which is the whole point of pulse methods. The DPV base current is always taken at the end of the base period. With a linear-ramp CV the current is simply the one at that instant.

Series: the same method several times

Open Series of runs under the method and tick Run as a series. Pick the parameter to change: the two concentrations are at the top of the list, then the method's settings, then everything else in the cell (n, k°, α, radius, D, Cdl, Ru…). Choose how it changes: add a step, multiply by a factor, or type a list (for example 0.01, 0.02, 0.05, 0.1, 0.2). Each run is saved as its own run, named after its value, so the runs overlay in the plot and can be analysed separately. Cell parameters that differ between runs also appear under Plot it against in Analysis. When the series changes a concentration, each run's concentration is filled in for the calibration automatically.

Analysis

The analysis works on one technique at a time, using the runs of that technique that are ticked in the Runs table. It follows the technique chosen in Method, the run you click, or the selector next to the Analysis title (shown when you have runs of more than one technique). For each run it takes one value from the curve as plotted (after blank subtraction, for the chosen scan and direction), between x₁ and x₂. Leave both empty to use the whole curve.

Roles. Give each run a role in the Runs table. Standards with a concentration build the calibration line. Samples and tests get a concentration from that line. Blanks are used for the background and the detection limit. Each run's concentration is filled in from the cell (cR if present, otherwise cO) unless you type one.

Blanks and the background. A blank is a run without the analyte (both concentrations 0, or the Blank ready-made cell): it contains only the background, here the charging current, plus the noise. There are two ways to deal with the background, and usually you pick one:

  • Subtract it. Under Background in Analysis (the same setting as Subtract blank above the plot), choose one blank or the average of all blanks. It is subtracted, point by point, from every curve of that technique, blanks included, so the blanks sit at about zero. With Blanks as 0 standards they then enter the fit at the origin, and the intercept of the line is close to zero. Use this when the background has a shape under the peak.
  • Let the baseline or the intercept take it. Peak height above baseline already removes a smooth background under each peak, and any constant offset left over ends up in the intercept of the line, which the found concentrations take into account. Use this for smooth backgrounds (the usual case in DPV and SWV).

Either way, a blank seldom reads exactly zero: with noise, the largest point of a flat curve tends to be positive. That is expected, and it is why the detection limit uses the spread of the blanks rather than their value.

Detection limit. LOD = 3.3·s/slope and LOQ = 10·s/slope, where s is the standard deviation of the blanks' values (at least three blanks), or the residual standard deviation of the fit when there are fewer. Raise the cell's Noise to see the LOD get worse.

Peak height above baseline works in two ways. For CV and LSV it uses the sweep that goes the peak's way (an oxidation peak ↑ on the sweep towards positive potentials, a reduction peak ↓ on the sweep towards negative ones), fits a straight line to the foot of the wave (10–25 % of the way through the window, which skips the transient at the start or the vertex) and measures the peak from that line extended under it, the usual textbook construction. With Direction: Both the right sweep is picked for you. For SWV, DPV and the other techniques the baseline is the straight line joining the two ends of the window (the average of the first and last few points). If the largest value sits at the edge of the window the result is shown as no peak in window: move x₁ or x₂ so that the window holds the whole peak and a bit of flat curve on each side.

Standard addition. Measure the sample, add known amounts of standard to the same cell and measure after each addition. In the simulator, run a series on the concentration of R with a list such as 0.2, 0.3, 0.4, 0.5 (the sample is the first value; each later run has 0.1 mM more). In Analysis choose Plot it against: Standard addition and type, for each run, what was added before it (0 for the sample alone). With volumes added to the cell, also enter the standard's concentration and the sample volume V₀: the page then uses x = Cs·V/V₀ and multiplies each signal by (V₀ + V)/V₀ to undo the dilution. With concentration added (each solution made up to the same volume, which is what the simulator does) the x values are typed directly. The sample's concentration in the cell is the x-intercept of the line, shown with ± 1 SD from the fit. Use Value or |Value| as y.

Plotting results against other things

Plot it against chooses the x axis of the results plot: concentration (the calibration line), standard addition, scan rate, SWV frequency, any method or cell setting that differs between the runs (k°, radius, n, Ru…), run number, time of the run, or a custom value you type into the table. The x values can be shown as x, √x, log x or 1/x, and the y as the value, its magnitude, its log, or the position of the peak. Untick Fit to leave a run out of the line; the box in the Fit header ticks or unticks them all. Some classic plots:

  • Peak current vs √(scan rate): straight through the origin for a reversible couple under planar diffusion control (Randles–Sevcik).
  • log |peak current| vs log scan rate: slope 0.5 for diffusion control.
  • Peak position vs log scan rate: no shift for a reversible couple, a shift for slow electron transfer.
  • Limiting current vs radius (microdiscs at steady state): a straight line, 4nFDc per unit radius.
  • OCP vs log concentration: 59.2/n mV per decade at 25 °C for a Nernstian couple.
  • Chronoamperometry: switch the main plot's x to t−½ for a Cottrell plot.

Taking curves to Excel, Google Sheets or Origin

Export plot… at the top right of the plot exports the curves as they are plotted, including blank subtraction, the scan selection and the x choice, in the plot's units:

  • Copy curves: paste straight into Excel, Google Sheets, Origin or LibreOffice (tab-separated, with names and units).
  • Excel workbook: the data plus a ready-made chart in the run colours, and a sheet describing each run and its cell. Google Sheets (File → Import), LibreOffice and Origin open it too.
  • Origin-ready text: header rows for Long Name, Units and Comments. Drag the file into Origin.
  • Picture: the plot as a PNG.

Export data CSV (Runs) saves every column of every ticked run (time, potential, current, E − iRu…), unaffected by the plot settings. Save session keeps all runs, with their methods and cells, in a file that Open session brings back: handy for giving students a set of data to analyse. Concentration profiles are not saved; ↻ Simulate again recreates them. In the Runs table, ⇡ loads a run's method and cell back into the forms, the box at the top of the first column shows or hides all runs, and Delete ticked removes every ticked run at once.

2 · Understanding the electrochemistry

The cell, setting by setting

The cell is a quiet (unstirred) solution containing a redox couple, O (the oxidised form) and R (the reduced form), with plenty of supporting electrolyte, and a working electrode of the shape and size you choose.

  • Concentration of R and of O (mM): what is in the bulk solution before the run. The default has only R, so sweeping to positive potentials oxidises it (positive, anodic current). Put O instead to see a reduction, or both to have a well-defined open-circuit potential. Setting both to 0 gives a blank: only the charging current and the noise remain.
  • Electrons, n: electrons transferred per molecule, in a single step. A larger n makes the wave steeper (the potential scale is RT/nF) and the current larger.
  • Formal potential E°′: the potential at which O and R at the electrode surface are present at equal concentrations when the couple is at equilibrium. Activity coefficients and other effects of the medium are included in E°′, so the model works with concentrations. For a reversible couple under planar diffusion, the CV peaks sit about 28.5/n mV either side of the half-wave potential (which equals E°′ when DO = DR).
  • Rate constant k° (cm/s): how rapidly electron transfer occurs at the electrode–solution interface at E°′. Whether a couple looks reversible does not depend on k° alone but on k° compared with mass transport, which the Theory box expresses as Λ = k°/√(DnFv/RT): the scan rate, D and n all matter. As a rough guide at 100 mV/s, with D ≈ 7×10⁻⁶ cm²/s and n = 1, k° above about 0.08 cm/s gives a reversible wave (the surface concentrations closely follow the Nernst equation and the peaks do not move with scan rate), and k° below about 5×10⁻⁶ cm/s an irreversible one (a large overpotential is needed and the return peak may be far away or missing). In between, the couple is quasi-reversible: the peaks separate more as you scan faster.
  • Transfer coefficient α (0–1, usually close to 0.5): describes how the activation barriers for electron transfer respond to changes in electrode potential. It sets the potential dependence of the reduction and oxidation rate constants: in this model α governs the reduction and 1 − α the oxidation (they are equal at α = 0.5). It matters mainly when electron transfer is slow, where it sets the width of irreversible waves and how far they move per decade of scan rate.
  • Shape and radius: see The three electrode shapes. The note under the radius gives the area and the steady-state current the electrode would reach.
  • D of O and D of R (×10⁻⁶ cm²/s): diffusion coefficients. Small ions in water are typically 5–10. The current grows as √D in CV and chronoamperometry, and as D at steady state. If DO ≠ DR, the half-wave potential moves slightly away from E°′.
  • Cdl (µF/cm²): the double-layer capacitance (typically 10–40 for metals, more for carbon). It produces the charging current: a flat offset Cdl·A·v in a CV ramp, and a spike after every potential step in staircase and pulse methods. It is constant here (independent of potential).
  • Ru (Ω): the uncompensated solution resistance between the reference electrode and the working electrode. The actual interfacial potential is E − i·Ru rather than E, so at high currents peaks move apart and flatten (they look less reversible than they are), and the charging spike decays more slowly (time constant Ru·Cdl·A). Choosing E − iRu as the plot's x axis shows the curve against the actual interfacial potential. That removes the shift of the potential axis, but it does not give back the curve that would have been measured without Ru: the interface experienced a different potential waveform (not a linear sweep), and that changed the concentrations and the currents along the way.
  • Noise (RMS): random current noise added to every point (the OCP gets 0.05 mV). Without it, blanks would read exactly 0 and the detection limit would be meaningless. Lower it for microelectrodes, whose currents are in the nA range.
  • Temperature: enters through RT/nF, so it changes the Nernst slope (59.2/n mV per decade at 25 °C) and the width of the waves. D does not change with it here; set D yourself if you want that effect.

The three electrode shapes

Planar (ideal) straight lines only Hemisphere lines converge from all sides Disc straight in the middle, extra at the edge
Purple: the electrode. Grey: the insulating material around it. Blue arrows: the paths by which O or R diffuse to the surface.

What changes between the shapes is the geometry of diffusion: from which directions fresh material can reach the electrode once the electroactive species next to it has been depleted. During an experiment a depleted region, the diffusion layer, grows out from the surface, roughly √(D·t) thick. In a CV, t is about RT/(nFv), so at 50 mV/s the layer is about 20 µm thick and at 1 mV/s about 130 µm.

  • Planar (ideal): a flat electrode where material can only come straight towards the surface, as if the electrode were infinitely large or had walls around it. The diffusion layer keeps growing, so the current keeps falling: the Cottrell decay (i ∝ t−½) in chronoamperometry and peak-shaped CVs at every scan rate. This is the case in the textbook equations (Randles–Sevcik, Cottrell, Nicholson), so use it when students should compare with them directly.
  • Hemisphere: a half ball of radius r sitting on an insulating plane, for example a mercury drop or a small electrodeposited bead. Material arrives from every direction, and the area through which it can arrive grows with distance (like the surface of a growing sphere). Once the diffusion layer is much thicker than r, a steady-state concentration profile develops and the current settles at iss = 2π·nFDc·r, with a sigmoidal CV instead of peaks. Diffusion continues; it simply supplies material as fast as the electrode consumes it. Its surface area is 2πr², twice that of a disc of the same radius. The geometric model is exact: the concentration depends only on the distance from the centre.
  • Disc: a flat disc set flush in an insulating plane, which is the shape of almost every real working electrode (glassy carbon, Pt and Au discs, screen-printed electrodes, microdisc electrodes). In the middle diffusion is planar, but at the rim material can also come in sideways, so the edge collects extra current. At short times or fast scans this edge effect is a small extra current on top of planar behaviour; at long times or for small discs it takes over, and the disc reaches the steady state iss = 4·nFDc·r. This is the default.

When does the shape matter? Compare the radius with the diffusion-layer thickness δ (the Theory box gives the ratio for a CV):

r compared with δBehaviourExample at 50 mV/s
much larger (r/δ > 10)close to planar: peaks, ip ∝ √v (a disc adds a small edge current)1.5 mm disc
similar (0.3–10)in between: peaks on a rising plateau25–100 µm disc
much smaller (r/δ < 0.3)steady state: sigmoidal wave, i ∝ r, almost independent of v5 µm microdisc

How the disc is simulated. A real disc is a two-dimensional problem: the current density is higher near the rim than in the middle. The simulator solves it as a one-dimensional problem in which the area available for diffusion grows with distance from the surface in a way fitted to the exact disc (see The mathematics, point 6). The total current it gives agrees with the exact disc results within 0.3 % in chronoamperometry and 0.15 % for CV peak currents, from microdiscs to millimetre discs (see Validation). It does not compute how the current is distributed across the face of the disc. For the same reason, the diffusion-layer cross-section of a disc is an illustration: in front of the disc it shows the simulated profile, and around the edge and over the insulator it shows that profile at the distance to the nearest point of the disc, to show how the layer wraps round the edge. For the planar and hemisphere cases the cross-section is exact.

The Theory predicts box

The box under the method gives textbook values for the cell and method you have set up. Each formula has its own assumptions, listed here; where the simulation includes something the formula leaves out, the two will differ, and explaining the difference is a good exercise in itself.

  • Λ = k°/√(DnFv/RT) compares the rate of electron transfer with the rate of mass transport during the scan (Matsuda–Ayabe): above about 15 the CV is reversible, below 10−2(1+α) irreversible, and quasi-reversible in between. Raising v lowers Λ, which is why a couple can look reversible slowly and irreversible fast.
  • Randles–Sevcik (reversible, planar, linear sweep, no Cdl or Ru): ip = 0.4463·nFAc·√(nFvD/RT); ΔEp ≈ 2.218·RT/nF (57 mV for n = 1 at 25 °C, for a sweep reversed well past the peak).
  • Irreversible (planar, diffusion-controlled, one rate-determining electron transfer): for a reduction, ip = 0.4958·nFAc·√(αnFvD/RT) and the peak moves 29.6/(αn) mV per decade of scan rate at 25 °C; for an oxidation, replace α by 1 − α: ip = 0.4958·nFAc·√((1−α)nFvD/RT) and 29.6/((1−α)n) mV per decade. The box uses the right form for the sweep you set. At α = 0.5 the two forms coincide.
  • r/√(DRT/nFv): electrode radius over diffusion-layer thickness, which tells whether the CV will be peaked or sigmoidal.
  • Cottrell (CA, planar, diffusion-limited step): i = nFAc·√(D/πt).
  • DPV: ΔIp = nFAc·√(D/πtp)·(σ − 1)/(σ + 1), with σ = exp(nFΔE/2RT), at E½ − ΔE/2 for an oxidation scan. This is an ideal limit: a reversible couple, planar diffusion, a single pulse of width tp applied to a diffusion layer in equilibrium with the base potential, and the current sampled at the end of the pulse and just before it. A complete DPV scan differs from this by a few per cent, because the step size, the pulse period and all the earlier pulses shape the diffusion layer, and because of the sampling points you choose. These are real features of the waveform, not numerical error.
  • SWV: the net peak of a reversible couple sits at E½; its height depends on the amplitude and step through a dimensionless factor (Osteryoung), so the box gives only the scale nFAc·√(D/πtp).
  • OCP: the Nernst equation, E = E°′ + (RT/nF)·ln(cO/cR).

Things to try in class

  • Why is there a peak? Default CV, Pause at 0.15, 0.23, 0.30, speed Slow. At each stop, before resuming, ask what the current will do next and why, using the profiles and the diffusion-layer view. At 0.15 V the current rises because the surface concentration of R starts to fall, steepening the gradient. At the peak (0.23 V) the surface still holds about a quarter of the bulk R (for an ideal reversible couple under planar diffusion), but the diffusion layer is now thickening fast enough to outweigh the falling surface concentration. After the peak the surface is almost depleted and the current falls as the layer keeps growing. Step ▸ walks through the peak 10 mV at a time.
  • The return sweep: pin the CV and press ▶ Play in the profile panel, with the diffusion layer coloured by O. The O made on the way up is still next to the electrode when the sweep reverses, which is where the reduction peak comes from; on the way back the region next to the electrode refills with R, leaving a depleted band that moves out into the solution. Compare with an irreversible couple, whose return peak is far away or missing.
  • Microelectrode vs macroelectrode: compare the diffusion layer of the 1.5 mm disc with that of the 5 µm microdisc (ready-made cell). In front of the big disc the layer is a flat band that keeps growing, with only a small bulge round the edge; around the microdisc it is a roughly hemispherical cloud, much larger than the electrode, and a steady-state concentration profile develops, which is why its CV has no peak.
  • Randles–Sevcik: CV, series on scan rate with the list 10, 25, 50, 100, 200. In Analysis pick Peak height above baseline (↑), Direction Both, x₁ and x₂ empty, and plot against scan rate as √x: a straight line through the origin. Or use log x with log |Value|: slope 0.5. Choose the Planar shape to compare with the equation directly; the default disc adds about 1.5 % of edge current at 100 mV/s.
  • Reversible → irreversible: series on k° × 0.1 for 6 runs, starting at 1 cm/s. Plot the peak position against log k°, or watch ΔEp grow. Or keep k° fixed and raise the scan rate: same effect, because Λ is what matters.
  • Tafel slope from peak positions: for an irreversible couple, the peak moves 29.6/((1−α)n) mV per decade of scan rate at 25 °C for an oxidation (the default cell) and 29.6/(αn) for a reduction. Try α = 0.3 with an oxidation and with a reduction: 42 and 99 mV per decade.
  • Number of electrons: compare n = 1 and n = 2. The peak is 23/2 ≈ 2.8 times higher and ΔEp falls from 57 to 28.5 mV.
  • A large electrode can behave as a microelectrode: what decides the shape of a CV is not the size of the electrode on its own but the radius compared with the diffusion layer. Run the 1.5 mm disc at 50 mV/s and then at 0.0005 mV/s (a single CV then takes about 890 hours of simulated time; use Animate). The diffusion layer grows to several millimetres, larger than the electrode, and the peak becomes a sigmoidal steady-state wave of about 4nFDcr (405 nA for the default cell); the Theory box shows r/√(DRT/nFv) dropping from 8 to 0.25. This cannot be done in a real cell: after some tens of seconds natural convection (density and temperature differences) stirs the solution and limits the diffusion layer to roughly 0.1–0.5 mm, which the simulator, with diffusion only, does not include. It is a thought experiment that separates the geometry from the electrode's size.
  • Microelectrodes: series on radius with a list of values, from 1.5 mm down to 0.005 mm (5 µm). The peak turns into a sigmoidal plateau. Plot the limiting current against radius: a straight line (4nFDcr). Compare Disc and Hemisphere at the same radius.
  • Cottrell: CA with step 1 well past E°′. Switch the plot's x axis to t−½: a straight line for Planar, bending towards a plateau for a small Disc.
  • Calibration and LOD: DPV or SWV, series on the concentration of R with a list such as 0, 0, 0, 0.01, 0.02, 0.05, 0.1 mM. Mark the three 0 mM runs as blanks and the others as standards (see Analysis).
  • Why pulse methods: DPV sampled at 5 % of the pulse versus at the end. Early sampling picks up the charging current; raise Ru to make it last longer.
  • Nernst: OCP with both forms present, series on the concentration of O (× 10). Plot against concentration as log x: 59.2/n mV per decade.
  • iR drop: series on Ru (list: 0, 100, 300, 1000 Ω) on a reversible couple. The peaks move apart and get lower. Then plot against E − iRu: the shift of the potential axis largely goes away, but the curves do not collapse onto the Ru = 0 curve, because the interface went through a different potential waveform. A good discussion of why iR compensation is done during the measurement rather than afterwards.

What the model leaves out

Adding noise, a double layer and a solution resistance makes the curves look like real data, but the simulator remains an idealised model of a cell and an ideal potentiostat. Deliberately left out:

  • Chemistry: only one redox couple and one electron-transfer step; no chemical reactions coupled to it (EC, CE, catalysis), no adsorbed species or surface films, no pseudocapacitance (oxide formation, hydrogen adsorption).
  • Transport: diffusion only, with constant D; no migration (excess supporting electrolyte assumed), no convection or stirring, no natural convection at long times. Each run starts from a fresh, uniform solution.
  • Interface: a constant double-layer capacitance (no dependence on potential, no frequency dispersion or constant-phase behaviour, no porous or rough electrodes), and Butler–Volmer kinetics with no double-layer (Frumkin) effects on the rate.
  • Electrode: planar, hemispherical or disc geometry only; for the disc, the total current is accurate but the uneven current across its face is not computed (it matters for the iR drop at high currents). A uniform Ru.
  • Instrument: an ideal potentiostat with no bandwidth limit, filtering, current ranges or converter resolution, a perfectly stable reference electrode, and Gaussian current noise; no drift, interference or ohmic heating.

3 · Numerical methods and validation

The mathematics

In short: the page solves the diffusion equations for O and R on a one-dimensional grid of points in front of the electrode, couples them at the surface through Butler–Volmer kinetics, and includes the double layer and the solution resistance in the same calculation. Nothing is looked up from tables: every curve comes out of the equations below, solved afresh for each experiment. The only fitted element is the area function used for the disc (point 6).

1. The equations. The concentrations cO and cR obey Fick's second law. For a sphere (and its half, the hemisphere) of radius r₀, with r measured from the centre:

∂c/∂t = D·(1/r²)·∂/∂r (r²·∂c/∂r)

which becomes the familiar ∂c/∂t = D·∂²c/∂x² for a planar electrode (x = distance from the surface). Initially, and far from the electrode at all times, c = c* (the bulk values you set). At the surface, the net rate of reduction (O + n e⁻ → R) is

J = kred·cO(0) − kox·cR(0)   (mol cm⁻² s⁻¹)

kred = k°·exp[−αnf(Eint − E°′)],   kox = k°·exp[(1 − α)nf(Eint − E°′)],   f = F/RT

J is positive when O is being reduced and negative when R is being oxidised. Mass balance at the surface gives DO·∂cO/∂x = J and DR·∂cR/∂x = −J at x = 0: O is consumed and R produced at the same rate during a reduction, and the reverse during an oxidation. The faradaic current is iF = −nFA·J (positive for oxidation). No Nernst equation is imposed anywhere: the reversible case is simply the limit of large k°, and quasi-reversible and irreversible behaviour come out of the same equations.

2. The double layer and the iR drop. The interface is a capacitor Cdl·A in parallel with the faradaic reaction, fed through Ru. The actual interfacial potential, Eint, satisfies

Eapplied − Eint = Ru·[ iF(Eint) + CdlA·dEint/dt ]

and the current the potentiostat measures is i = iF + CdlA·dEint/dt. This equation is solved at every time step together with the diffusion problem, so the charging current, the iR drop and the faradaic current all affect each other. With Ru = 0, Eint = Eapplied.

3. Space: finite volumes on an expanding grid. The solution in front of the electrode is cut into thin shells (control volumes) centred on grid points at distances x₀ = 0, x₁, x₂, … The first spacing is h = 0.25·√(D·Δtmin) (and at most r₀/40), and each spacing is 1.12 times the previous one, so the points are packed where the concentrations change fastest, at the surface, and spread out towards the bulk. The grid reaches 6·√(D·ttotal), beyond which the solution is still at the bulk concentration; the last point is fixed at c*. This takes typically 65–120 points. For every shell, the change in the amount of O (or R) inside it equals what diffuses in through its two faces:

Vi·(cinew − ci)/Δt = Fi+½ − Fi−½
Fi+½ = D·ai+½·(ci+1 − ci)/(xi+1 − xi)

where Vi is the volume of shell i, ai+½ the area of the face between shells i and i + 1, and F the diffusive flow through it; the surface flux J enters the first shell. The finite-volume form conserves mass: for every mole of O consumed at the electrode, one mole of R is produced, and vice versa. The conserved quantity is the total amount of the redox couple, not the amount of either species on its own.

4. Time: implicit steps with extrapolation. Each step is computed with the concentrations on the right-hand side taken at the new time (backward Euler). For the diffusion equation this step is unconditionally stable and keeps concentrations non-negative, so long steps cannot make the solution blow up; on its own it is only first-order accurate in time. To improve the accuracy, each step is done twice, once as a full step Δt and once as two half steps, and the results are combined as 2 × (two half steps) − (one full step) (Richardson extrapolation), which cancels the first-order error and makes the result second-order accurate when the solution is smooth. The extrapolated combination does not automatically inherit all the guarantees of backward Euler (it can overshoot right after a sudden change), so the page controls the step length around discontinuities and sets any slightly negative concentration to zero:

  • After every potential jump (staircase, pulses, chronoamperometry), the first step is short (1/200 of the shortest pulse, or RuCdlA/5 if that is shorter), and each following step is 1.25 times longer, up to a quarter of the pulse. This resolves the charging spike and the fast early decay without wasting steps later.
  • During a linear ramp (CV and LSV), each point is split into sub-steps of at most 0.5 mV (0.5/n mV for n > 1).

5. Solving each step. For each species, the implicit equations form a tridiagonal linear system (each point is linked only to its two neighbours), solved directly by the Thomas algorithm in a number of operations proportional to the number of grid points. The unknown surface flux J is handled by superposition: the system is solved for the known terms and for a unit flux, giving cO(0) = PO + J·QO and cR(0) = PR + J·QR. Putting these into the Butler–Volmer expression gives J directly:

J = (kredPO − koxPR) / (1 − kredQO + koxQR)

This is exact within the discretised equations for any k°, from irreversible to fully reversible, with no iteration. When Ru > 0, Eint is found by bisection on the equation in point 2 (to 1 nV), using this formula for iF(Eint).

6. The electrode shapes. The geometry enters only through the face areas a and shell volumes V, written per unit electrode area as a function a(x) of the distance x from the surface:

  • Planar: a(x) = 1.
  • Hemisphere of radius r: a(x) = (1 + x/r)². Exact for the hemisphere.
  • Disc of radius r: a(x) = 1 + 1.88·(x/r) + 2.0918·(x/r)², with electrode area πr². A real disc is a two-dimensional problem; this one-dimensional "effective area" model reproduces it as follows. Near the surface a(x) ≈ 1, so short times give the planar (Cottrell) current exactly; the two coefficients satisfy ∫₀∞ dx/a(x) = πr/4, so the steady-state current is exactly 4nFDcr; and the linear coefficient (1.88) was fitted so that the chronoamperometric current matches the accurate disc expression of Mahon and Oldham over the whole transition. The model gives the total current; it does not compute how the current density varies across the face of the disc.

7. What you see. The current is recorded at the end of each step or pulse (or at the chosen sampling point), and the potential, the interfacial potential and the time with it. Gaussian noise with the RMS value you set is added afterwards. The concentration profiles are stored every few points (up to 600 per run) for the profile plot and the diffusion-layer view. The simulation is calculated before the curve is displayed; Animate, Pause and Step only control how fast it is drawn.

Validation

All benchmarks below were run with the page's own simulation code, with Cdl = 0, Ru = 0 and no noise unless stated, at 25 °C, with D = 7×10⁻⁶ cm²/s. They establish the accuracy for the conditions listed; other combinations of settings (very large Ru, pulses much shorter than the default, extreme concentration ratios) have not each been benchmarked separately. In every case checked, the remaining numerical error is dominated by the spatial grid and is of the order of 0.1 %.

Randles–Sevcik. Linear sweeps of a reversible couple (k° = 10⁴ cm/s, planar, R only in the bulk, sweep starting well before the wave), compared with ip = 0.4463·nFAc·√(nFvD/RT) and Ep − E½ = 1.109·RT/nF:

VariedRange testedip / ip(theory)Ep − E½
Scan rate1 mV/s – 10 V/s1.0008 at every rate28.0 mV (theory 28.5; 1 mV point spacing)
Electrons n1, 2, 31.000828.0, 14.0, 9.3 mV (theory 28.5, 14.2, 9.5)
Concentration0.01 – 10 mM1.000828.0 mV
Diffusion coefficient1 – 20 ×10⁻⁶ cm²/s1.000828.0 mV
Temperature10 – 50 °C1.000827.0, 28.0, 31.0 mV (theory 27.1, 28.5, 30.9)
Electrode radius (planar)0.5 – 3 mm1.000828.0 mV
Point spacing (ramp)0.1 – 5 mV1.0005 – 1.000828.5 mV at 0.1–0.5 mV spacing
DO ≠ DR (5 and 10)1.000828.1 mV from E½

The 0.08 % excess comes from the spatial grid: refining it (about 290 points instead of 74) gives a coefficient of 0.44632 against the literature value 0.4463, and smaller time steps change nothing. With a parabola through the three highest points, Ep − E½ = 28.49 mV against 28.49 mV in theory. Because the error does not depend on scan rate, ip against √v is a straight line through the origin and log ip against log v has a slope of 0.5. A staircase sampled at the end of each step gives smaller peaks than a true ramp (0.98 at 0.1 mV steps, 0.94 at 1 mV, 0.86 at 5 mV): that is the physics of the staircase waveform, which real digital instruments show too, not numerical error.

Disc electrode. The disc model was checked against two independent results for the exact disc:

  • Chronoamperometry (diffusion-limited step), against the expressions of Mahon and Oldham (accurate to about 0.01 %; the older Shoup–Szabo formula agrees with them within 0.6 %): within ±0.3 % for every dimensionless time 4Dt/r² from 10⁻³ to 10⁴ (29 values, seven decades). For comparison, simply adding the Cottrell current and the steady state, nFAc√(D/πt) + 4nFDcr (a hemisphere of radius πr/4, the model used in earlier versions of this page), overestimates the current by up to 7.2 % (at 4Dt/r² ≈ 0.5).
  • Cyclic voltammetry (reversible, peak current of the forward sweep), against Aoki's equation for microdisc voltammetry, ip = 4nFDcr·[0.34·e−0.66p + 0.66 − 0.13·e−11/p + 0.351·p] with p = √(nFvr²/RTD): within ±0.15 % from p = 0.02 (1 µm disc at 10 mV/s, steady state) to p = 112 (1.5 mm disc at 100 mV/s, planar). For the 1.5 mm disc at 100 mV/s, the peak is 1.5 % above planar Randles–Sevcik; that is the real edge current, and it matches Aoki's equation within 0.01 %.

Electron-transfer kinetics.

  • Quasi-reversible ΔEp against Nicholson's working curve (α = 0.5, n = 1, sweep reversed 112.5 mV past E½, as in his calculation): ψ = 20, 7, 3, 1, 0.5, 0.25, 0.1 gives 61.0, 63.3, 68.0, 83.7, 104.8, 139.9, 209.9 mV against 61, 63, 68, 84, 105, 141, 212 mV; within 1 mV for ψ ≥ 0.25 and 2 mV at ψ = 0.1, close to the precision of the published table.
  • Irreversible peak current (k° = 10⁻⁶ cm/s, 100 mV/s): within 0.07 % of 0.4958·nFAc·√(α′nFvD/RT) for α = 0.3, 0.5 and 0.7, with α′ = α for reductions and 1 − α for oxidations.
  • Irreversible peak shift with scan rate (α = 0.3, 10 mV/s to 1 V/s): 42.3 mV per decade for an oxidation (theory 29.6/(1 − α) = 42.3) and 98.5 mV per decade for a reduction (theory 29.6/α = 98.6).

Other checks. The planar Cottrell current within 0.25 % from 1 ms to 100 s after the step; the hemisphere's exact transient and steady state 2πnFDcr; the charging current CdlAv in a ramp; and the position of the reversible DPV peak at E½ − ΔE/2.

Methods: D. Britz & J. Strutwolf, Digital Simulation in Electrochemistry (Springer, 4th ed., 2016); R. G. Compton, E. Laborda & K. R. Ward, Understanding Voltammetry: Simulation of Electrode Processes (Imperial College Press, 2014); A. J. Bard & L. R. Faulkner, Electrochemical Methods (Wiley, 2nd ed., 2001). Benchmarks: R. S. Nicholson, Anal. Chem. 37, 1351 (1965); K. Aoki, K. Akimoto, K. Tokuda, H. Matsuda & J. Osteryoung, J. Electroanal. Chem. 171, 219–230 (1984); D. Shoup & A. Szabo, J. Electroanal. Chem. 140, 237 (1982); P. J. Mahon & K. B. Oldham, Electrochim. Acta (2004), doi:10.1016/j.electacta.2004.06.005.

About

About the name

Mashed Potato is a homage to Oliver Rodríguez and his two potatoes. Soft Potato is his open-source electrochemical simulator and toolkit, and Hard Potato is his Python library for controlling commercial potentiostats (CH Instruments, PalmSens) and automating experiments, developed with Joaquín Rodríguez-López at the University of Illinois. Oliver did his PhD with Guy Denuault at the University of Southampton and now works on digital electrochemistry at the UK's National Physical Laboratory. Mashed Potato mixes the two: hardware you control from the browser, and simulated cells to learn and teach with. This page is the soft half. Hence, mashed.

Rodríguez, O. Soft Potato: an open source electrochemical simulator and toolkit. ChemRxiv (2022), doi:10.26434/chemrxiv-2022-4bs3w · Rodríguez, O.; Pence, M. A.; Rodríguez-López, J. Hard Potato: a Python library to control commercial potentiostats and to automate electrochemical experiments. Anal. Chem. 2023, 95, 4840–4845, doi:10.1021/acs.analchem.2c04862

Credits

The Mashed Potato instrument's hardware is derived from IO Rodeo's Rodeostat (CC BY 4.0). Theory in the summary box: Randles–Sevcik, Matsuda–Ayabe, Nicholson, Cottrell, Parry–Osteryoung (DPV), Osteryoung (SWV), as in Bard & Faulkner, Electrochemical Methods. Benchmarks for the disc: Mahon & Oldham, Shoup & Szabo, Aoki et al. (references under Validation).

License

This page is released under the MIT license: free to use, modify and share, as long as the copyright notice comes along. No warranty, no support, no refunds (it was free). If it works, great, tell your friends. If it breaks, you get to keep both pieces. The FuNII Lab logo and the Mashed Potato name are not part of the license.

Built with love for students.

Full MIT license text
Copyright (c) 2026 FuNII Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.