AFM is a branch of microscopy that forms images of surfaces using a physical probe that scans the specimen. An image is obtained by mechanically moving the probe in a raster line by line (probe-surface interaction as a function of position)
The STM is based on the concept of quantum tunneling. When a conducting tip is brought very near to the surface to be examined, a bias (voltage difference) applied between the two can allow electrons to tunnel through the vacuum between them. The resulting tunneling current is a function of tip position, applied voltage, and the local density of states (LDOS) of the sample. Information is acquired by monitoring the current as the tip's position scans across the surface, and is usually displayed in image form.