Close

Capacitive force sensors?!

A project log for SMidi - Soft MIDI Pedals

Full function, class compliant MIDI pedals you can roll up.

daren-schwenkeDaren Schwenke 06/26/2017 at 05:420 Comments

I was thinking that's a pretty big bit of AL foil there, I wonder what it's capacitance would be (relatively speaking).

I still have no idea as my meter sucks, but I was able to measure it changing with the Teensy.

Code:

void setup() {
  Serial.begin (115200);
  pinMode(A4,OUTPUT);
  pinMode(A0,INPUT);
  analogReadResolution(12);
}
void loop () {   
  digitalWrite(A4,HIGH); // Charge external capacitance
  delay(2);
  digitalWrite(A4,LOW); // Discharge through resistor.
  delay(0.1);    // Delay   
  int c = analogRead(A0); //Measure change.
  Serial.print(c);
  Serial.print("\n");
  delay(100);
}

Yeah, I'm using the analog alias of A4 instead of 'pin 18' for digital stuff... shoot me.

How it's working:

The Teensy toggles A4 between high/low states. There is a 100k resistor tied between A0 and A4. A0 is connected to my test pad, with the other foil connected to digital ground. This forms a simple RC network where R is constant and C is my two bits of aluminum foil separated by mylar. Reading the change in charging speed allows me to know C, which corresponds to how close the two bits of foil are to each other.

I'm obviously not compressing the mylar very much. The reason I think it's working so well is one of my contact surfaces is curved and the pressure flattens it out. The bottom of my original FSR test contact pad was a row of cylinders. As my pad is made from sparse infill TPU, it can compress which brings the valley areas of the foil closer.

My ultra precise test rig:

I'm getting about 2% deviation with a static load, and better than a 50% of full scale swing under pressure. That's a lot better performance than when I was using it as a resistor.

I'll take it. I think I'll be exploring this direction now.

There is also the possibility of multiplexing the inputs too by changing my charging source dynamically.

I'll need to experiment with the pad shape and see if I can get a linear response out of this.

Discussions