Problems with push button , self activation
Moderators: grovkillen, Stuntteam, TD-er
Problems with push button , self activation
Hi,
i have a problem with the switch plugin.
Connecting a push button works, but i get strange self triggerings.
To get a unwanted event it is enough to connect a 20cm wire to the gpio i where the button is configured.
When i take the wire in my hand and move it a little bit or rub on it, a event is triggered.
My plan was to use Push Button active Low setting, but i get this self triggerd events.
Using pushbutton active High i have the same problem.
I tried several gpios and all settings. I always get this self event triggering.
Do i need to connect a resistor to the wire for the push button?
I have really no idea why this happens. I hope someone can help me.
Thanks and best regards,
Stefan
i have a problem with the switch plugin.
Connecting a push button works, but i get strange self triggerings.
To get a unwanted event it is enough to connect a 20cm wire to the gpio i where the button is configured.
When i take the wire in my hand and move it a little bit or rub on it, a event is triggered.
My plan was to use Push Button active Low setting, but i get this self triggerd events.
Using pushbutton active High i have the same problem.
I tried several gpios and all settings. I always get this self event triggering.
Do i need to connect a resistor to the wire for the push button?
I have really no idea why this happens. I hope someone can help me.
Thanks and best regards,
Stefan
Re: Problems with push button , self activation
The push-button switch's two wires should connect to GPIO and GND.
Switch plugin Settings:
Internal PullUp Checked (Enabled).
Inversed Logic Checked (Enabled).
Switch Type: Switch.
Switch Button Type: Normal.
If the problem persists then you should add an external 1K ohm PullUp resistor. That is to say, install the resistor with one end connected to 3.3VDC and the other end directly to the GPIO pin. And shorten all GPIO wire leads as much as practical.
If the external PullUp does not help then try a different DC Power Supply.
- Thomas
Switch plugin Settings:
Internal PullUp Checked (Enabled).
Inversed Logic Checked (Enabled).
Switch Type: Switch.
Switch Button Type: Normal.
If the problem persists then you should add an external 1K ohm PullUp resistor. That is to say, install the resistor with one end connected to 3.3VDC and the other end directly to the GPIO pin. And shorten all GPIO wire leads as much as practical.
If the external PullUp does not help then try a different DC Power Supply.
- Thomas
Re: Problems with push button , self activation
Ok, thanks Thomas.
From the place where i want to install the switch i have to use 30cm wire
I will try with another power supply and with the 1K ohm PullUp resistor.
One question to the 1k PullUp resistor.
Isn't this exactly the same as "Internal PullUp Checked (Enabled)"?
Thanks and best regards,
Stefan
From the place where i want to install the switch i have to use 30cm wire

I will try with another power supply and with the 1K ohm PullUp resistor.
One question to the 1k PullUp resistor.
Isn't this exactly the same as "Internal PullUp Checked (Enabled)"?
Thanks and best regards,
Stefan
Re: Problems with push button , self activation
The internal pull-up resistor of the ESP is having a way higher resistance value.
That one is more in the order of 20 - 100 k.
So you need a lot less interference to trigger false pushes.
Simply checking the pull up resistor may be a nice test to see if it already is some improvement.
You can also twist the wires to the push button so it will act less like an antenna.
That one is more in the order of 20 - 100 k.
So you need a lot less interference to trigger false pushes.
Simply checking the pull up resistor may be a nice test to see if it already is some improvement.
You can also twist the wires to the push button so it will act less like an antenna.
Re: Problems with push button , self activation
Use an external low pull-up/pull-down Rrsistor, around 10 KOhm.
The internal resistors of ESP are "weak" and due to my experience sometimes not sufficient.
Connect a capacitor of about 47nf...100nF from GPIO to ground (May slow down very fast switchings, usually it has no effects.).
The internal resistors of ESP are "weak" and due to my experience sometimes not sufficient.
Connect a capacitor of about 47nf...100nF from GPIO to ground (May slow down very fast switchings, usually it has no effects.).
Regards
Shardan
Shardan
Re: Problems with push button , self activation
Thanks a lot for the help.
I will try the different options.
Twisting the wires is a good idea.
Also using an external pull up resistor sounds good and i understand why.
What i do not understand, what is a capacitor doing? ("Connect a capacitor of about 47nf...100nF from GPIO to ground")
Thanks and best regards,
Stefan
I will try the different options.
Twisting the wires is a good idea.
Also using an external pull up resistor sounds good and i understand why.
What i do not understand, what is a capacitor doing? ("Connect a capacitor of about 47nf...100nF from GPIO to ground")
Thanks and best regards,
Stefan
Re: Problems with push button , self activation
A capacitor "slows down" a connection. The capacitor needs a specific amount of time to
load or unload, the time depends on the resistor you use. This combination just has a few
miliseconds changing time.
So if for examples spikes from the mains voltage line come across to your wire - it works like
an antenna for that - the capacitor makes the circuit too slow to give a reaction to these spikes.
More technically resistor and capacitor build a low pass filter, the filter frequency should be
low enough to cut off spikes, high frequency from CB, amateur radio and such.
Prefer a ceramic capacitor or a X5R or X7R type.
load or unload, the time depends on the resistor you use. This combination just has a few
miliseconds changing time.
So if for examples spikes from the mains voltage line come across to your wire - it works like
an antenna for that - the capacitor makes the circuit too slow to give a reaction to these spikes.
More technically resistor and capacitor build a low pass filter, the filter frequency should be
low enough to cut off spikes, high frequency from CB, amateur radio and such.
Prefer a ceramic capacitor or a X5R or X7R type.
Regards
Shardan
Shardan
Re: Problems with push button , self activation
Ok, now i understand.
Thank you very much for the detailed explanation!
I will try to get it working with all your hints how to do it.
Thanks,
Stefan
Thank you very much for the detailed explanation!
I will try to get it working with all your hints how to do it.
Thanks,
Stefan
Re: Problems with push button , self activation
Ok,
i drilled the cables. This already did the Job.
Crazy.
Thank you for your help!
Stefan
i drilled the cables. This already did the Job.
Crazy.
Thank you for your help!
Stefan
Re: Problems with push button , self activation
Ok drilling the cabel did not really help.
So i inserted a 1k ohm resistor between 3.3V and my pin.
But this also did not work.
Now it seems that my ESP is damaged.
It works at long as it is cold.
After plugin it in it gets warm.
When resetting when warm it does not work anymore. No Wlan, no flashing.
Is it possible that my connection with 1 k ohm destroyed my esp?
But perhaps it was also faulty at the beginning. I will try with a new one but without 1 k Ohm.
P.S.:
used a new ESP without resistor and it seems to work.
Perhaps my ESP was broken.
Strange thing was that my old rules to get the button state with a if for LongPress and DoubleClick did not work anymore.
I had to do it with on now.
Best regards,
Stefan
So i inserted a 1k ohm resistor between 3.3V and my pin.
But this also did not work.
Now it seems that my ESP is damaged.
It works at long as it is cold.
After plugin it in it gets warm.
When resetting when warm it does not work anymore. No Wlan, no flashing.
Is it possible that my connection with 1 k ohm destroyed my esp?
But perhaps it was also faulty at the beginning. I will try with a new one but without 1 k Ohm.
P.S.:
used a new ESP without resistor and it seems to work.
Perhaps my ESP was broken.
Strange thing was that my old rules to get the button state with a if for LongPress and DoubleClick did not work anymore.
I had to do it with on now.
Code: Select all
//On Boot, Fan off
on System#Boot do
pwm,12,0
endon
//Dim Value from FHEM
on dim do
TaskValueSet 1,1,%eventvalue2% //Set Dim Dummy
event,setFanSpeed
endon
//Button handling
On Button#State=11 do //Longpress
TaskValueSet 1,1,1023 //Set Dim Dummy
event,setFanSpeed
endon
On Button#State=3 do //Doubleclick
TaskValueSet 1,1,500 //Set Dim Dummy
event,setFanSpeed
endon
On Button#State=1 do //Switch always 0->1
TaskValueSet 1,1,0 //Set Dim Dummy
event,setFanSpeed
endon
On setFanSpeed do
pwm,12,[dim#dim] //Set speed of Fan
let,1,1023-[dim#dim] //Calculate brightness of onboard LED
pwm,2,%v1% //Set onboard LED
enddo
Best regards,
Stefan
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Problems with push button , self activation
Code: Select all
On setFanSpeed do
pwm,12,[dim#dim] //Set speed of Fan
let,1,1023-[dim#dim] //Calculate brightness of onboard LED
pwm,2,%v1% //Set onboard LED
enddo
Code: Select all
enddo
Must be
Code: Select all
endon
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Problems with push button , self activation
Oh yes, Thanks!
Who is online
Users browsing this forum: No registered users and 12 guests