Quantifying the approach and retreat of objects from a solid interface using electrochemical techniques