Capacitance is a really useful way of embedding interactions onto and into physical materials like paper and also glass. Capacitance sensing is central to multi-touch screens and is surprisingly simple to recreate with an Arduino or Raspberry Pi (other controllers apply).
For more in depth information on capacitive sensing, click here.
We are not going to worry too much about the science but take a hands on look at how we can make use of these principles.
Some examples of previous interaction experiments can be found here.
Paper clips on the left and copper wire on the right
Any solid conductive material (images above) can be used to create a capacitance sensor. This means copper wire/tape, paper clips, or nails. So long as you can connect a wire to it. Many of these materials can also be fused into glass.
Carbon powder touch sensor
Some powders can also be fused and work fairly well, carbon powder works (images above), but not copper powder. The copper powder becomes heavily oxidised and no longer forms one solid conductor. The challenge with powders is getting enough in and making a clean connection with a copper wire to connect it to a circuit.
Bare Conductive ink works nicely, this can only be used cold. This ink is an acrylic based paint with a high carbon powder content. It works really well with capacitance and has a degree of resistance alo depending on the pattern created, this means it can also detect distance from the printed image.
Filling sand-blasted grooves with bare conductive ink
Previous glass examples involved creating grooves in the glass to fill with bare conductive paint (image above) and adding a wire to the paint, or using a crocodile clip (bulldog clip or paper clip) on one end to make contact. These grooves can be patterned of course and or you can put it on the back and it will be sensed from the other side. By increasing the sensitivity, bare ink will work through materials like glass as I will demonstrate in the examples below.
Bare Ink on Paper Connected with Paper Clips
In the first examples we are going to use conductive paint and paper. First thing, we need to set up the MPR121 board in order to detect touch. This is a breakout board module for the Arduino that we can use to detect touch or release. MPR121 allows us to change the sensitivity so we can detect proximity and it can work through some materials up to around 5mm (important to test this first). For greater sensitivity, or as an alternative, we can also use a combination of resistors and a special library for the Arduino. For now we will stick with the MPR121 as it is more reliable.
Some useful parameters for designing conductive patterns can be found here.
In simple terms, large shapes work better for proximity and small work best as touch points. If you are making a large shape then hatching results in a better proximity reading than a solid shape.
Wiring the MPR121
Arduino IDE: Sketch > Include Library > Add .ZIP Library > Browse to zip file
Libraries come with useful examples that can act as simple starting points for working with sensors.
We will start with a built in example: File > Examples > MPR121 > Simple Touch
Note: You must change the following line:
The sensitivity can be altered by changing the following two lines:
For bare conductive ink, depending on the pattern, the following should work for touch:
And for proximity sensing at a distance:
If you are experimenting note that the setTouchThreshold is always higher than the release otherwise it will not work at all.
MPR121 with bare conductive ink can also let us detect distance values that can be used to control outputs in an analog way, so you can control brightness for example based on how far your hand is from the piece of paper. The setup is the same, we just need the following example code to do this.
This is usefully demonstrated by going to the Serial Plotter and showing the change in values visually. Larger areas of Bare Conductive Ink work best for sensing distance.
Tools > Serial Plotter
Another way of detecting touch is with large resistors and a capacitance touch library for the Arduino. This tends to be much more sensitive and you can easily get form values from the sensors allowing some basic and sometimes unreliable distance sensing.
Capacitance with resistors
The library can be found here.
Example code and further information can be found here.
If your capacitance touch pins to the resistors are not wired up, or wired incorrectly, then the code will run extremely slowly. If you have this problem check your wiring.