The new touch sensing function is pretty neat. I get a very noticeable capacitance change when I bring my finger within 1 cm from a length of 22-gauge hookup wire, and then move it away. This data is from the below program (which averages many readings together, for a 500 msec update rate).
[attachment=0]
moving finger to 1 cm from wire, and then away
val,n,p-p,stdev
#Teensy3.0 Touchprogram Oct.232012
688.03,4315,7,1.465
688.07,4318,7,1.461
687.99,4317,8,1.477
687.95,4318,7,1.454
687.81,4319,7,1.468
689.23,4315,9,1.786
691.18,4307,6,1.307
690.99,4309,6,1.302
690.90,4310,7,1.275
690.84,4308,7,1.281
690.81,4309,8,1.287
690.82,4309,7,1.290
690.58,4309,7,1.291
690.69,4309,7,1.284
688.76,4312,10,1.865
687.82,4318,7,1.458
687.78,4318,7,1.457
687.77,4317,8,1.465
687.85,4318,7,1.469
687.93,4318,7,1.466
687.94,4317,7,1.465
687.81,4319,7,1.459
687.77,4317,7,1.451
687.87,4318,7,1.460
687.77,4317,7,1.477
688.02,4318,8,1.478
687.93,4318,7,1.472
Grabbing the insulated portion of the wire, then the bare end of the wire- a big signal. The pk-pk reading change and standard deviation also goes through the roof when touching the wire, I assume that is 60 Hz pickup. The T3 is connected to my computer via its USB cable during these tests.
val,n,p-p,stdev
# Teensy 3.0 Touch program Oct. 23 2012
908.20,3713,18,2.854
910.23,3708,22,2.910
912.22,3704,23,3.007
831.56,3901,233,102.050
689.36,4312,8,1.458
689.57,4313,9,1.502
1230.76,3084,2859,877.954
3574.54,1376,981,155.670
3795.12,1308,941,170.153
3923.82,1272,1118,186.593
4035.86,1242,1058,194.914
2393.54,1911,3912,1677.471
688.00,4315,8,1.540
687.82,4318,7,1.438
687.85,4317,7,1.445
Touch sensing example code:
/* Test capacitive touch sensor function on Teensy 3.0
using Teensy 3.0 beta 6 (Windows) release J.Beale Oct. 23 2012
*/
#define SAMPLES (5000) // maximum number of separate readings to take
#define TIMEOUT (500) // maximum sample integration time in milliseconds
int led = 13;
void setup() {
pinMode(led, OUTPUT);
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for user to start up logging program
Serial.begin(115200); // baud rate is ignored with Teensy USB ACM i/o
delay(2000);
Serial.println("val,n,p-p,stdev");
Serial.println("# Teensy 3.0 Touch program Oct. 23 2012");
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
}
void loop() {
int t1;
long tStart; // starting time
long datSum; // reset our accumulated sum of input values to zero
int sMax;
int sMin;
long n; // count of how many readings so far
double x,mean,delta,sumsq,m2,variance,stdev; // to calculate standard deviation
datSum = 0;
sumsq = 0; // initialize running squared sum of differences
n = 0; // have not made any ADC readings yet
mean = 0; // start off with running mean at zero
m2 = 0;
sMax = 0;
sMin = 65535;
tStart = millis();
for (int i=0;i<SAMPLES && ((millis()-tStart)<TIMEOUT);i++) {
x = touchRead(A1);
datSum += x;
if (x > sMax) sMax = x;
if (x < sMin) sMin = x;
// from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
n++;
delta = x - mean;
mean += delta/n;
m2 += (delta * (x - mean));
}
variance = m2/(n-1); // (n-1):Sample Variance (n): Population Variance
stdev = sqrt(variance); // Calculate standard deviation
Serial.print(mean);
Serial.print(",");
Serial.print(n);
Serial.print(",");
Serial.print(sMax-sMin);
Serial.print(",");
Serial.println(stdev,3);
}