DIY Capacitive Proximity Sensors for Interactive Prototyping With Everyday Objects

by ShaneCunningham in Circuits > Arduino

10262 Views, 73 Favorites, 0 Comments

DIY Capacitive Proximity Sensors for Interactive Prototyping With Everyday Objects

DSC_2584.JPG
DSC_2551.JPG
DSC_2592.JPG
Shane Cunningham's Interactive Audio Visual Installation at DAWN 2017

This Instructable explores interactive potential of electrical field sensing by the means of Capacitive technology. It is because of the technologies low-cost and versatility that it is relatively easy to apply the technology into everyday objects, an area that can be explored by using off-the-shelf materials.

It is the simplification of the technology that makes it inclusive to all and paves the way for exploring easy to apply prototyping tools. The goal of this project was to create an interactive audio visual installation that explores low tech solutions for prototyping with interactive technologies. This project used used serial communication between an Arduino Uno board and a PC, sending sensor data from the Arduino board, and receiving it on the Processing IDE on a computer.

This project used the Arduino CapSense Library by Paul Badger, and the SerialCallResponse sketches by Tom Igoe and Scott Fitzgearld.

This Instructable will show how

  • to make proximity sensors from tin foil and cardboard
  • to read sensor data and manipulate the data on your computer for controlling graphics or audio

To make this Instructable you will need:

  • Crocodile Clips (3 per sensor)
  • Tin Foil
  • Cardboard
  • Stick Glue (Pritt Stick), Spray Glue or double sided tape
  • Shielded Cable (3 per sensor)
  • 1M Resistor (1 Resistor per sensor)
  • Break away header pins
  • Solder
  • Soldering Iron
  • Arduino Uno
  • Computer (windows, Mac, Linux)
  • Software : Arduino IDE, Processing IDE, Pure Data (all free software)

Step 1: Make Proximity Sensors

DSC_2545.JPG
DSC_2596.JPG
Dawn Poster 4.jpg

1. Cut 1 piece of cardboard roughly at 300 x 300 mm and paste a sheet of foil to one side.

2. Cut a second piece of cardboard at roughly 100 x 100 mm, and paste foil on one side. let dry and engrave a stator pattern into the foil, and then cut with a craft knife. adding this pattern will increase the sensitivity of the sensor

3. Place the larger piece of cardboard, connected to GND, beneath the smaller piece of cardboard. keep foil separate.

Step 2: Connect to Arduino and Run Code

capSense Sketch_bb.jpg
DSC_2537.JPG
DSC_2584.JPG
DSC_2546.JPG
DSC_2547.JPG

Connect Arduino to computer and run the Arduino code.

This code uses CapSense Library by Paul Badger, and the SerialCallResponse sketches by Tom Igoe and Scott Fitzgearld.

In order to calibrate a sensor, use Serial.print and map the values of the corresponding pin:

///////////////////////////////////////

void loop() {
long total1 = cs_4_2.capacitiveSensor(30);

Serial.println(total1);

/////////////////////////////////////////

Code for Communicating with Processing over Serial

*/

int val1 = 0;

int val2 = 0;

int val3 = 0;

int inByte = 0;

CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2); // 1M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired

CapacitiveSensor cs_4_6 = CapacitiveSensor(4,6); // 1M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil

void setup() {

cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example

cs_4_6.set_CS_AutocaL_Millis(0xFFFFFFFF);

Serial.begin(9600);

pinMode(2, INPUT);

pinMode(6, INPUT);

// pinMode(8, INPUT);

establishContact(); // send a byte to establish contact until receiver responds

void loop() {

// if we get a valid byte, read inputs:

if (Serial.available() > 0){

// get incoming byte:

inByte = Serial.read();

//long start = millis();

long total1 = cs_4_2.capacitiveSensor(30);

long total2 = cs_4_6.capacitiveSensor(30);

//long total3 = cs_4_8.capacitiveSensor(30);

//delay(10);

val1 = map(total1, 700, 2300, 0, 255); // sensor values from calibration are mapped to here - begins to detect human proximity at 700 (4" away) , hand nearly touching sensor at 2300

val2 = map(total2, 30, 175, 0, 255);

//val3 = map(total3, 0, 13000, 0, 255);

Serial.write(val1);

Serial.write(val2);

//Serial.write(val3);

//Serial.print(val1);

//delay(50);

}

void establishContact() {

while (Serial.available() <= 0) {

Serial.print('A');

delay(300); }

Step 3: Manipulate Sensor Data in Processing

Screenshot (9).png
Screenshot (19).png
Screenshot (20).png
Screenshot (21).png
Screenshot (22).png
Screenshot (23).png
Screenshot (24).png
Screenshot (25).png
Screenshot (14).png
Screenshot (1).png