Touch screens have become an increasingly popular input method over the last decade, and it’s easy to see why. Touch inputs allow users to employ their fingers to interact with an electronic device. This leads to input methods that are very easy to understand, and even children can quickly understand them and learn how to interact with an electronic device. This article discusses two ways of adding capacitive touch inputs to any of your Arduino-based DIY projects.
Capacitive sensors are proximity sensing devices that can detect a user’s finger, for example, without the need for physical contact. Prominent examples are touch screens and various touch controls - one popular recent example is on modern cooktops. However, that’s just a handful of visible applications. Capacitive sensors can be hidden in other devices so that they aren’t inherently visible to the user.
As the name implies, a capacitive sensor acts like a simple capacitor. A piece of metal internally connects to an oscillator circuit. Unlike a pre-built capacitor, the target to be sensed (for example, a user’s finger) acts as the second plate of the capacitive sensor. In this article, an Arduino takes the role of the previously mentioned oscillator circuit. The Arduino periodically sends out pulses and measures how much time elapses until it receives a response. When the target comes closer to the piece of metal that forms the first plate of the sensor, the Arduino can detect a change in the timing and use that information to determine whether a user made a touch input.
Note that this is a short and simplified description of the working principle of such a sensor. Furthermore, many aspects determine how well the sensing works - two of which are the size of the first metal plate and the surface area of the target object.
We only need a conductive object to form one plate of the sensor, an Arduino, a relatively large value resistor, and a few jumper wires to build a simple capacitive proximity sensor. The resistor connects D2 and D12 of the Arduino. Additionally, pin D2 also connects one side of the resistor to a metal object such as a paperclip, a piece of aluminum foil, or a tool: