In the previous simulation you saw that a voltage difference between two compartments has a strong influence on the movement of ions crossing a membrane between them. This is the first step to understanding the generation of diffusion potentials. The simulation was highly unrealistic, however, because only cations were illustrated, with no anions to balance their charge. Such a solution, if it could exist, would draw bolts of lightning to restore the balance!
Another reason that simulation was unrealistic is that normally nothing holds the voltage between the two compartments constant. Instead, as cations diffuse from inside to outside across the membrane, leaving the impermeable anions behind, a difference in charge (or eletromotive potential, measured in volts) builds up. As cations leave one side, it would have an excess of negative charge; likewise, the other side would have an excess of positive charge. It is this charge difference that produces the voltage across the membrane called the diffusion potential.
Illustrated at right is a simulation that is one step more realistic. It starts with equal number of anions and cations in the left-hand (inside) compartment, and none in the right. As these ions diffuse and fill the compartment, they approach the semi-permeable membrane. The cations can cross as before, but this time each ion that crosses leads to an imbalance in the charge and additional voltage.
As we saw in the previous simulation, voltage both hinders the crossing of more cations and promotes the reentry of those already crossed. The two tendencies - diffusion rightwards down the gradient and attraction leftwards by the voltage - oppose one another. Watch the simulation to see if they ever come into balance.
The voltage difference established between the two compartments is thus a direct result of the selective diffusion of ions across the membrane. The membrane potential becomes more negative as more cations diffuse from left to right, and the voltage in turn limits their outward diffusion. At some point the tendency of a cation to diffuse down its concentration gradient is balanced by its equal tendency to move in the opposite direction "down" the electrical gradient.
This balance of tendencies creates an electrochemical equilibrium between the opposing chemical or concentration and electrical forces. Over time, about the same number of cations diffuse into the outside compartment as diffuse in the opposite direction, and no membrane potential develops. (There may, however, be short-term fluctuations in cation concentrations in the two compartments that lead to temporary membrane potentials, for the same reasons solvent fluctuations occurred in the Osmosis simulation. See no net movement.)