Introduction: DIY Capacitive Proximity Sensors for Interactive Prototyping With Everyday Objects

Picture of DIY Capacitive Proximity Sensors for Interactive Prototyping With Everyday Objects

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: Step 1: Make Proximity Sensors

Picture of Step 1: Make Proximity Sensors

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: Step 2: Connect to Arduino and Run Code

Picture of Step 2: Connect to Arduino and Run Code

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: Step 3: Manipulate Sensor Data in Processing

Picture of Step 3: Manipulate Sensor Data in Processing

Comments

gada888 (author)2017-10-17

Nice share

ShaneCunningham (author)gada8882017-10-18

thanks

MTKapp27 (author)2017-10-13

can I use this tech to sense approximately how much food is left in a dog's bowl

ShaneCunningham (author)MTKapp272017-10-13

not too sure about food, but capacitive sensing technoloy is used to measure liquid levels though. there's plenty of videos on youtube, this guy is doing it with pellets, check this out, https://youtu.be/SsvjxnN8ZUk

Swansong (author)2017-09-26

That's a neat setup :)

ShaneCunningham (author)Swansong2017-09-27

thanks

About This Instructable

1,743views

44favorites

License:

Bio: Artist, Sculpture and combined media, phototography, Video and Audio editing, UX design, Web Design, Interactive Design, electronic prototyping Shane Cunningham's Art https://shanecunninghamblog.wordpress ... More »
More by ShaneCunningham:DIY Capacitive Proximity Sensors for Interactive Prototyping with Everyday Objects
Add instructable to: