A scanning tunneling microscope (STM) requires precise control of the tip–sample distance to maintain a constant set-point tunneling current. Typically, the tip–sample distance is controlled through the use of a control algorithm. The control algorithm takes in the measured tunneling current and returns a correction to the tip–sample distance in order to achieve and maintain the set-point value for tunneling current. We have developed an STM simulator to test the accuracy and performance of four control algorithms. The operation and effectiveness of these control algorithms are evaluated.