As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Tuesday, May 15, 2012

Reema & Jill: Foil Capacitor Touch Sensor


Burning your mouth on hot coffee is no fun! We intend our project to sense the temperature of the coffee and, when touched, output colored LEDs to indicate if it's too hot, cold or just right. In order to achieve the touch input, we set up a foil capacitor touch sensor. A simple piece of foil will do, plus three wires, an LED, resistors and the Arduino. Our sketch reads the spike in current change from the "drinker's" touch and turns on the LED. See example and sketch below: 

#include <CapSense.h>

/*
* Reema and Jill: Foil Me Thirsty
* Adapted from CapitiveSense Library Demo Sketch by Paul Badger 2008
* Uses a high value resistor e.g. 10 megohm between send pin and receive pin
* Resistor effects sensitivity, experiment with values, 50 kilohm - 50 megohm. Larger resistor values yield larger sensor values.
* Receive pin is the sensor pin - try different amounts of foil/metal on this pin
* Best results are obtained if sensor foil and wire is covered with an insulator such as paper or plastic sheet
*/


CapSense cs_4_2 = CapSense(4,2); // 10 megohm resistor between pins 4 & 2, pin 2 is sensor pin, add wire, foil



void setup() 
{
cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
Serial.begin(9600);
pinMode(13, OUTPUT);

}

void loop() 
{
//digitalWrite(13,HIGH); //LED on
//delay(50);
//digitalWrite(13,LOW);
long start = millis();
long total1 = cs_4_2.capSense(30);
if (total1 > 100) {
digitalWrite(13,HIGH); //LED on
else {
digitalWrite(13,LOW);

Serial.print(total1); // print sensor output 1
Serial.print("\t");
Serial.println();

delay(100); // arbitrary delay to limit data to serial port 
}

No comments:

Post a Comment