Electromechanical level measurement