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.

Saturday, June 13, 2020

Capsense Library

Capacitive Sensing


This was quite interesting as I got to understand the value of capacitive sensing and can recognize the technologies that possibly use this type of sensing. I used a 1M ohm resistor and connected it to my x-acto knife. The serial monitor was still confusing to read because of the unstable grounding but I was able to witness the changes in the readings so I'm happy it was evidently working. 

My code:

#include <CapacitiveSensor.h>

CapacitiveSensor cs_4_2 = CapacitiveSensor(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);

}

void loop(){

long start = millis();

long total1 = cs_4_2.capacitiveSensor(30);

Serial.print(millis() - start); // check on performance in milliseconds

Serial.print("\t"); // tab character for debug window spacing

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

delay(10); // arbitrary delay to limit data to serial port

}

No comments:

Post a Comment