Engineering Roundtable - Chris Taylor and Capacitive Sensing

Check out today's edition of "Engineering Roundtable."

Favorited Favorite 0

Today we have another episode of "Engineering Roundtable!" Today's host is Chris Taylor, SparkFun Engineer and hacker extraordinaire. In this edition, Chris talks about capacitive sensing. Check it out:


Vimeo version here.

To download the code Chris mentions in the video, down this ZIP file. As always, please leave any questions in the comments section below. We'll see you in two weeks with our next edition of "Engineering Roundtable." Enjoy!


Comments 19 comments

  • You must have the most original website in the world by now! Im just so glad i stumbled upon this website.

  • customer207 / about 12 years ago / 3

    Thanks Chris, very informative! What did you find out for the differences in material? Very interested in the Bare paint. Would it work well in your friend's application?

    • All of the materials worked great. For my friend's application I recommended the copper tape, just because it's cheaper and much easier to use. The paint comes in small jars and must be spread very thick, whereas the tape works just like...tape, and can cover more area quickly. The only significant difference I found in the materials was that the ink has it's own resistance, which you have to take into account because it can increase the time delay for the circuit to charge. Specifically, across the length of the strip, the large ink strip had a resistance of 134 Ohms, the medium showed 242 Ohms, and the small 476 Ohms. The strips halve in size each time, so the increase in resistance is about linear to the area depending on how thick the paint is spread.

  • Oh Man... We're all gonna be really good at this video stuff in a few months.

  • Member #115584 / about 12 years ago * / 2

    The description includes the words "exponential decay" and the equation is exponential decay, but the voltage is growing to an asymptotic value, not decaying to zero. The equation for the red line should be V(t)=V_in[1-exp{-t/RC}]. The equation Vt)=V(0)exp{-t/RC} will work for the second half of the source signal cycle. Very nice presentation.

    • Pelican / about 12 years ago / 1

      It is still exponential decay. What is decaying is the difference between the input signal and the output signal.

    • jon.whitten / about 12 years ago / 1

      yup. Smaller the capacitance, the larger the resister needs to be to detect the change (when you only get a few microseconds to measure, you may need to 'stretch' the time-constant). The time constant may not actually be reached when you detect 'high'... it's really the value at which the digital I/O detects a 'high' value, which is going to be less than the VCC value by virtue of the innards of the IC. Time constant value is at t/RC = 1.

      You will get better response if the time-constant is shorter (and your sample frequency is good enough to detect the timing change).

      I'm just glad that someone is giving the hardware example. Thanks Sparkfun Friend, Chris.

  • Question for Chris, or anybody else who knows the answer. I'm trying to use capacitive touch sensing with a small array of pads, as part of an Arduino-controlled LED/audio mixer. Right now, I'm working through the basics of the capacitive touch stuff, and this tutorial was a great help.

    I'm running into issues when more than 2 of the sensing pads are touched at once. I've modified your code slightly so that I can see feedback when multiple pads are being touched. What I've noticed is that the code slows way down, and even seems to stop (or at least, the Serial data stops coming in) while I have more than two pads touched, and then as soon as I stop touching the third pad, it goes back to working fine. In other words, it can sense one pad being touched and two pads being touched simultaneously just fine, but as soon as I touch a third pad, it crashes.

    I would guess that some voltage is leaking through my hand between the pads. To test this, I got some volunteers, and each person pressed only two pads. In that case, everything worked fine - it detected all 6 pads being touched simultaneously. But when I then pressed all 6 pads with my own fingers, it crashed as usual.

    What could be causing this issue? I don't know much about capacitor theory (just what you had in the video), but my best guess is that the leaking voltage is somehow letting the 'capacitors' discharge into each other, affecting the readings. The only symptom that goes against this is that the code on the Arduino is actually stopping - something I've only ever seen when one of the Arduino's pins, outputting some voltage, is shorted to ground.

    I'm quite confused, any help or ideas would be appreciated. Thanks! -Bob

    • Here's the modification to the code - the only changes are in loop():

      void loop()
      {
      // SAMPLE SENSOR CAPACITANCE 
      // These functions sample the receive pins of the sensors 30 times. The largest
      // sample is subtracted from the smallest sample and returns the total. This
      // number is in arbitrary units. 
      long total1 =  copperLarge.capacitiveSensor(30);
      long total2 =  copperMedium.capacitiveSensor(30);
      long total3 =  inkLarge.capacitiveSensor(30);
      long total4 =  inkMedium.capacitiveSensor(30);
      long total5 =  steel.capacitiveSensor(30);
      
      // CHECK THRESHOLD AND REACT
      // If the returned value is greater than a threshold (I chose 500), light the 
      // LED and print which substrate was touched. 
      if(total1 > 500) { Serial.print(" Blue "); digitalWrite(LED, HIGH); }
      if(total2 > 500) { Serial.print(" Green "); digitalWrite(LED, HIGH); }
      if(total3 > 500) { Serial.print(" Red "); digitalWrite(LED, HIGH); }
      if(total4 > 500) { Serial.print(" Strobe "); digitalWrite(LED, HIGH); }
      if(total5 > 500) { Serial.print(" Clear "); digitalWrite(LED, HIGH); }
      //   else { digitalWrite(LED, LOW); }
      
      Serial.println(" ");
      
      delay(10); // Delay so we don't print TOO fast
      

      }

  • icyfyer / about 12 years ago / 1

    The wealth of human knowledge, at my finger tips, and brought to me by the good people at SparkFun Electronics. Thank you very much.

  • sci / about 12 years ago / 1

    If you did not stand as in float so there was no ground on you the cap would it still have a capacitive load ? Or more to my idea if i wanted to design a rat trap on capacitive load would it still work even if it did not stand on the ground but feet of the rat hit the lines ?

    • Pelican / about 12 years ago / 1

      Think about the physics of a capacitor: It is two conductors separated by a non-conductor, and your body (or the rat's) is a pretty good conductor. So, unless you are in a Faraday cage, your body (or the rat's) is always "capacitively coupled" to the local ground. Even if that ground is not explicitly a part of your circuit, the gap between your body and the ground will "fill up" with an electric field (of infinitesimally small magnitude,) causing the voltage at the sensing end of the resistor to exhibit that exponential decay.

      • sci / about 12 years ago / 1

        Thanks makes a lot of sense time build a rat trap to sense then have another set of copper strips turn on high voltage!

    • Member #118891 / about 12 years ago / 1

      It works whether or not you're grounded.

  • Check out "On/Off" tactical paint, it is made specifically for painting your walls. I don't know if it is available to buy yet though.

  • engineerbynight / about 12 years ago / 1

    Very nice! Thanks for theory + working demo!

  • HP / about 12 years ago / 1

    Nice presentation! Just gave me a couple of ideas for a wall-based toy for my kid :) I always imagine the capacitor as a bucket that has to be filled with water (current). The resistor adjusts how quickly the bucket can be filled and the treshold is the size of the bucket (where it overflows). putting a finger on the cap increases the bucket size.. well, it is just me :)

  • Jon Mayer / about 12 years ago * / 1

    Very good video. If you want a more in depth look at capacitive sense, I suggest this video - http://youtu.be/vAJWtbp9kA8 It's a very similar idea and explanation, but just a bit more animated as to what is happening. (Pretend the Arduino is the Microchip MCU)

  • Ichbinjoe / about 12 years ago / 1

    Great video. I guess another way of explaining a capacitive touch system is that it is literally a RC oscillator with a variable capacitive load. (I don't think you stated this, but I apologize if you did.)

Related Posts

Recent Posts

Tags


All Tags