Finding a finger on glass
A touchscreen has two jobs. The display shows an image, and a separate sensing layer works out where on the surface something is touching. The sensing layer usually sits on or in the display. Several technologies can do this, and the one in most phones and tablets today is called capacitive sensing.
Capacitive sensing
A capacitor, in simple terms, is a pair of conductors separated by an insulator, able to store a small amount of electric charge. The ability to hold charge is called capacitance. It changes if a conductive object comes close.
A capacitive touchscreen has a very thin, transparent conductive layer, often made of a material such as indium tin oxide, patterned into a grid of rows and columns beneath a protective layer of glass. The controller chip applies small electrical signals to this grid, creating a weak electric field at each point where a row crosses a column.
The human body is a decent conductor, since we are mostly water containing dissolved salts. When a fingertip touches the glass, it draws a little of the electric field into itself and changes the local capacitance. The controller measures the change at the grid crossings, and the pattern of changes reveals where the finger is. Because the finger does not need to press hard, a light touch works.
Many screens use mutual capacitance, where each row-column crossing is measured separately. This lets the controller detect several touches at once, which is why multi-touch gestures such as pinching to zoom are possible. A simpler self-capacitance scheme measures each row and column as a whole and can be faster, but it is less able to separate multiple touches on its own.
Finding the exact spot
A finger covers an area much larger than one grid crossing. The controller does not just pick the strongest crossing. It compares readings from the nearby crossings and estimates the center of the touched area, and this lets it report positions more finely than the spacing of the grid. Software then filters out accidental touches, such as a palm resting on the screen, and interprets taps, swipes and holds.
Why gloves and pens often fail
Ordinary gloves are insulators, so they keep your finger from disturbing the electric field enough. A plain pen or fingernail also fails to change the capacitance. Some gloves have conductive thread in the fingertips, and some styluses have a conductive tip, designed specifically to imitate a fingertip. Wet screens can cause trouble too, because water drops also conduct and can confuse the readings. Manufacturers use various techniques to reduce this, with mixed results.
Resistive touchscreens
An older and simpler design is the resistive screen. It uses two thin, flexible conductive layers separated by a tiny gap. When you press on the top layer, it bends and touches the one below. The point of contact changes the electrical resistance measured at the edges, and the controller calculates the position from the voltages.
Since this works by physical pressure, rather than by sensing the body, a resistive screen can respond to a gloved finger, a stylus or a fingernail. The trade-offs are that it needs some pressure, it is typically less clear because of the extra layers, and it is generally poorer at multi-touch. They have been used in devices such as some ticket machines, older handheld devices and industrial equipment, though capacitive screens have taken over most consumer devices.
Other methods
There are additional approaches. Infrared touch frames place rows of invisible light beams across the surface and detect which beams a finger blocks. Surface acoustic wave screens send ultrasonic waves across the glass and notice where a touch absorbs some of them. These appear mostly in larger or specialty displays. Some styluses also use a separate system of their own, which lets them sense pressure or tilt and reject the resting palm.
From touch to action
The whole process is fast. The controller scans the grid many times a second, so the response feels immediate. It passes the touch coordinates to the operating system, which decides what to do with them based on what is shown at that spot. Behind it all is a lot of digital processing: the sensor readings are converted into numbers, in the form of binary code, then filtered and compared by software.
Other considerations
The sensing layer must be transparent, thin and tough, which has driven the development of specialized glass. Touchscreens can be less convenient for some tasks and users, so many devices also offer voice control or physical buttons. How well any specific screen works depends on its design, calibration and the conditions it is used in.