Surface potentials and their measurement by the diode method