Build audio and proximity devices with the Touch Board and electric paint

Floating in the Air

An interesting feature of the Touch Board is that you can adjust the threshold sensitivity of the touch sensors. The sensors are capacitative, like the sensors on modern touchscreen devices. They work by detecting changes in an electric field they generate. The electric field is not restricted to the actual physical surface of the sensor system; rather, it is projected up, beyond the surface, which is why you can have screen protector over the screen of your mobile phone and it will still respond to touch.

The standard touch threshold for the Touch Board sensors is 40, and the release threshold (the event that indicates the sensor is not being touched anymore) is 20. If you put these values down – way down – you don't actually have to touch the sensor to trigger an event; it will act more like a proximity sensor. In Listing 2, I added two lines between lines 15 and 16 in Listing 1 to adjust the sensitivity of the sensors in the previous sketch.

Listing 2

Proximity Switch

01 #include <MPR121.h>
02 #include <Wire.h>
03
04 #define switchElectrode 11
05 #define outputPin 13
06
07 void setup(){
08
09   pinMode(outputPin, OUTPUT);
10   digitalWrite(outputPin, LOW);
11
12   Wire.begin();
13   MPR121.begin(0x5C);
14
15   MPR121.setInterruptPin(4);
16
17   MPR121.setTouchThreshold(8);
18   MPR121.setReleaseThreshold(4);
19
20   MPR121.updateTouchData();
21 }
22
23 void loop(){
24   if(MPR121.touchStatusChanged()){
25     MPR121.updateTouchData();
26     if(MPR121.isNewTouch(switchElectrode)){
27       digitalWrite(outputPin, !digitalRead(outputPin));
28     }
29   }
30 }

Listing 2 is identical to Listing 1, except that touch and release threshold sensitivities are pushed down to 8 and 4, respectively, in lines 17 and 18. (Note that the release threshold always has to be lower than the touch threshold.)

MPR121.setTouchThreshold(8);
MPR121.setReleaseThreshold(4);

Bear in mind that proximity sensing is always a bit tricky and doesn't always work. For best results, use the electric paint to paint a large sensor (e.g., about 10cm square; Figure 4), and paint on a stiff surface that doesn't deform when you apply wet paint. A good choice is polished wood. The paint also must not crack (i.e., from overdrying with a heat source); otherwise, the electric field will experience interference, and the sensor will register random events.

Figure 4: My (rather ugly) proximity sensor that worked only so-so because it was painted on paper.

Once you're happy with your setup, when you pass your hand about 5cm from the painted area, the sensor will trigger, and the LED will switch on or off.

Another way you can use the threshold-adjusting feature is to spruce up your painted circuits. The electric paint only comes in black, which gets boring really quickly. If you increase the sensitivity threshold, you can paint over the electric paint with other types of paints in other colors, or you can even layer paper or cloth over the painted sensors to make them look much nicer.

Conclusion

The Bare Conductive Touch Board is an enjoyable little piece of hardware that packs tons of features in a very small space and at a very affordable price. It's easy to imagine hundreds of projects you can make for yourself or in the classroom. The electric paint is a great touch that multiplies the fun factor and avoids having to use dangerous soldering irons and hot metal. Both combined make for an excellent introductory maker set for kids and adults.

Infos

  1. Touch Board homepage: http://www.bareconductive.com/
  2. Arduino Leonardo: http://arduino.cc/en/Main/arduinoBoardLeonardo
  3. Win32 Disk Imager: http://sourceforge.net/projects/win32diskimager/
  4. Diluting Electric Paint: http://www.bareconductive.com/make/diluting-electric-paint/
  5. Hover, by Paul C. Brown, Raspberry Pi Geek, Issue 7, pg. 54, http://www.raspberry-pi-geek.com/rpi/Archive/2014/07/Using-the-Hover
  6. Arduino IDE: http://arduino.cc/en/Main/Software
  7. Bare Conductive drivers and demos download: https://github.com/BareConductive
  8. Disabling modemmanager: http://forums.linuxmint.com/viewtopic.php?f=42&t=101010
  9. The Sparkfun MP3 Player Shield Arduino library: https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library
  10. Installing extra Arduino libraries how-to: http://arduino.cc/en/Guide/Libraries
  11. Light switch example: https://github.com/BareConductive/light-switch
  12. Original program in GitHub: https://github.com/BareConductive/touch-mp3

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content