Multi-Touch Sensor and Arduino
Skin contains several electrically conductive elements that permit the flow of electricity through animal bodies (for in-depth reasoning, read this academic paper). This phenomenon is the primary reason why electric shock is so dangerous to living things, and is the primary reason behind electrical safety in everyday human life. The conductive nature of skin also enables humans to employ resistive and capacitive sensing in technology. For example, most modern smart phones register a change in capacitance from a finger touch, which then carries out a specific task. In this experiment, I will touching an exposed wire that is connected to a voltage comparator. This will result in a HIGH value on a digital pin of the Arduino board, indicating a touch has occurred.
Video 1 below shows the conductivity of human skin. Notice that when the leads are in open air or touching the wood, the resistance reading on the multimeter is overloaded (which indicates not enough electricity is flow between them). Conversely, when the leads are touching a finger, but not each other, the multimeter reads a resistance, albeit a large one of several MegaOhms, indicating that electric is flowing between the leads. Video 2 below shows the output from the touch sensor (KY-036, find one here, or in a kit here). Notice that when the exposed wire is touched, the voltage reads upwards of 2 V. This causes the Arduino to register an interrupt on the digital pin, indicating the sensor has been touched.
The steps for wiring this project are very straightforward. Below in Figure 1 is the wiring diagram. This experiment uses a very simple digital pin wiring scheme. There is only one digital output, so I have wired it to pin D2 on the Uno board. The LEDs can also be wired in any way to any digital pin (or even analog pin for variable brightness).
This was a fairly short tutorial because of the simplicity of the wiring and the sensor. If I were to build this sensor from scratch, it would be somewhat didactic and call for more elaboration on the electrical side of things, however, with the low cost of these sensors, I see no need here. I wanted to take the classic touch sensor and spice it up a bit (with the three different touches and the different LEDs), and even with the simplicity of things this particular projects has many applications. For example, you could build a classic touch lamp with this method. You could use the different speeds of touch to alter the brightness of the lamp. Another application could be in controlling your music player: you could use one touch to turn the music on and off, two touches to turn the volume up, three touches turns the volume down, etc.
The difficulty in this project lies in the code. Above, I used a time-out of 400 ms, which means if the user touched the sensor once in 400 ms, then only the red light will show. If the user manages to touch the sensor three times in 400 ms, then the blue will show. I also made the decision to limit the touches, so if the user touches the sensor more than 3 times, nothing happens. The code above has a lot of flexibility depending on the desired application. One could raise the timeout, or increase the number of possible states (touches within the timeout period), or even use the analog signal from the KY-036 to vary the tasks depending on amplitude. This was a short project that I thought would be educational and fun for anyone interesting in touch sensing and timeout states.
Products from our Shop relevant to this project:
See more in Arduino: