PDA

View Full Version : Interupt pin sensitivity



Tallman
01-06-2013, 05:07 PM
I have a teensy 2.0 and am connecting to pin d2 with a touch capacitance chip. The pin is getting tripped too easily. *Meaning all I have to do is touch or an alternate pin D3, etc and it changes the pin value and triggers the attachinterupt function.
Is there any way to desensitize the pin so that it is only triggered by the interrupt from the chip? *I'm obviously a newbie but I have searched and not seen an answer.
Thanks.

Brent

PaulStoffregen
01-06-2013, 08:58 PM
It's impossible to give good advice without knowing the details of what you're connecting.

However, very generic advise might be to try a pullup or pulldown resistor.

Tallman
01-06-2013, 09:16 PM
It's impossible to give good advice without knowing the details of what you're connecting.

However, very generic advise might be to try a pullup or pulldown resistor.

Paul,
There is nothing in the chip specs for the int that I need anything, but even if I disconnect the chip. Just touching my finger on D2 trips the interupt. Since this is a touch capacity chip, I'm going to be touching it, and this touching is causing me the inability to read whether the interrupt is tripping it, or my finger just hitting any of the copper in the circuit.

Since I'm a newbee, any suggestion as to what value Pullup resistor would take away the touch affect I'm getting on the pin and allow only the true interrupt from the circuit?

Thanks for your assistance.
Brent

PaulStoffregen
01-06-2013, 10:09 PM
Well, try the easiest thing first, use the build-in pullup:

pinMode(PIN_D2, INPUT_PULLUP);

If that doesn't work, can you tell if the resistor made the pin less sensitive than you need, or if its effect was not great enough. For higher sensitivity, use a higher resistor. For lower sensitivity, use a lower resistor. The built-in one is probably between 20k to 50k (it varies from chip to chip, it's temperature sensitive, and it's probably not really a real resistor at all, but probably a transistor driven by a fancy circuit making it emulate a resistor). You can try using different resistors until you find one that works (if this is an analog signal type of issue where a resistor changes things), using something like 30k of the built-in at a starting point and working up or down until you find one to like.

That is, if adding a resistor helps. I still don't quite understand what you're trying to do...

When used in INPUT mode (the default on Teensy 2.0), the pins are basically "floating". Even the slightest electrical coupling can change their voltage.

Normally touch sensing is done with a library like CapacitiveSensor, or the touch sensitive pins on Teensy 3.0 (which work similarly to that library, but much faster/better). Usually a relatively large electrode is attached to the pin. You read the capacitance and detect changes over time. Here's a video I made that shows how it works.

http://www.youtube.com/watch?v=BHQPqQ_5ulc

Normally you don't use the pins in interrupt mode (eg, with attachInterrupt) to detect human input. Most ordinary mechanical things have "chatter" in the time from of 1 to 10 ms. The interrupts respond extremely fast, so chatter can be a huge problem, giving you perhaps dozens of interrupts for a single event. Usually some sort of low-pass filtering is needed.

Then again, I still don't really know what you're trying to accomplish, so this is all very generic stuff.

Tallman
01-07-2013, 12:11 AM
pinMode(PIN_D2, INPUT_PULLUP);



Paul,
That did the trick. I have a touch capacitor chip from a company called Focaltech, on an FPC board with sensors on it. They gave me specs for it, including an INT, SDA and SDL. I was trying to read the INT, but as I said just me touching the copper was triggering it anywhere, and I couldn't tell whether the chip was triggering the INT, or electrical/cap in my finger triggering the D2 pin. By using the PULLUP it reduced the sensitivity (I think), and now it's only triggering when I touch the receiving copper on the cap chip input, rather than anywhere on the circuit (including the teensy).

Anyways, I'm back working for now. Thanks for your assistance.
Brent

PaulStoffregen
01-07-2013, 10:25 AM
Maybe that chip's pin is open collector?

If you'd started by linking to a datasheet for that chip, I could have given much better advice.