Interrupts triggered multiple times when pins are touched

karlo.verde.13
Posts: 8
Joined: Wed Mar 13, 2019 9:49 pm
Location: Lima, Peru
Contact:

Interrupts triggered multiple times when pins are touched

Postby karlo.verde.13 » Wed Mar 13, 2019 11:42 pm

Hello everyone,

I'm testing the gpio_example_main.c example, which indicates that some output pins must be connected to some input pins.

I've tested this example a long time ago without issues, but this time I'm having troubles when I do not connect the input pins. Every time I touch one of these input pins, their respective interrupts get triggered. This unexpected behaviour gets even worse when I connect a wire to the pins, whose interrupts get triggered when I approach my hand to the wire, just as they had some kind of capacitive nature.

First I thought it might be a matter of pull resistors so I used external ones without luck.

Is there something I'm missing here? Do you have any comment or suggestion?

Thanks a lot
Best regards
Verde :mrgreen:

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Interrupts triggered multiple times when pins are touched

Postby ESP_Sprite » Thu Mar 14, 2019 8:38 am

The first bit is expected, as the pins indeed have a high impedance and will pick up random electromagnetic waves and trigger an interrupt that way. External pullups should, however, fix that issue... what resistors did you use and how, exactly, did you connect them?

karlo.verde.13
Posts: 8
Joined: Wed Mar 13, 2019 9:49 pm
Location: Lima, Peru
Contact:

Re: Interrupts triggered multiple times when pins are touched

Postby karlo.verde.13 » Fri Mar 15, 2019 9:37 pm

Hey there! Thanks for the reply!

I've been testing with internal and external(1K and 10K) pull resistors.

what resistors did you use and how, exactly, did you connect them?
In the case of external pull resistors, I used 1K and 10K resistors for testing.
To be precise, I connected one resistor to each input pin of the example and VCC(3V3 of the dev board) or GND - pull-up and pull-down respectively.


I want to emphasize that the unexpected interrupt triggering only happens when the input signal is left disconnected. In other words, when you connect the pins just as the example indicates, there is no problem at all.

_________________________________________________________________________________
UPDATE
My finding about the correct operation of interrupts when using pull-ups was actually wrong. I tested the ESP32 in different places and its performance is not reliable when the input pins are connected to a free wire, which indicates that is indeed a capacitive behaviour.

Thanks a lot
Best regards
Verde :mrgreen:
Last edited by karlo.verde.13 on Sat Mar 16, 2019 1:56 am, edited 1 time in total.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: Interrupts triggered multiple times when pins are touched

Postby tommeyers » Sat Mar 16, 2019 12:39 am

Do you have a bounce problem? Have you looked at it on a scope? Are you debouncing?
IT Professional, Maker
Santiago, Dominican Republic

karlo.verde.13
Posts: 8
Joined: Wed Mar 13, 2019 9:49 pm
Location: Lima, Peru
Contact:

Re: Interrupts triggered multiple times when pins are touched

Postby karlo.verde.13 » Sat Mar 16, 2019 1:07 am

tommeyers wrote:
Sat Mar 16, 2019 12:39 am
Do you have a bounce problem? Have you looked at it on a scope? Are you debouncing?
Actually, that's something I haven't tried yet because I considered this issue a matter of pull resistors to ensure a known state of the input signal. Plus, considering the use of these resistors, in my experience, this "capacitive" behaviour is shown when the resistance value is quite high. However, if I am wrong, I would appreciate if someone could point out how debouncing is generating this erratic response.

Thanks a lot
Best regards
Verde :mrgreen:

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: Interrupts triggered multiple times when pins are touched

Postby tommeyers » Sun Mar 17, 2019 12:40 am

Pulling it up will make it clearly High as compared to "Floating high" .

But, if you have a switch on that pin (andit is pulled high) twhen closed will make it low (pin to switch to ground) when you make that switch the signal will bounce and finally settle at low. You need to debounce in software; you can debounce in h/w too.
IT Professional, Maker
Santiago, Dominican Republic

Who is online

Users browsing this forum: Baidu [Spider], Gaston1980 and 200 guests