Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonoff basic with external switch, randomly switching on/off #850

Closed
GuyBruens opened this issue Sep 8, 2017 · 18 comments
Closed

Sonoff basic with external switch, randomly switching on/off #850

GuyBruens opened this issue Sep 8, 2017 · 18 comments

Comments

@GuyBruens
Copy link

Hi,

First of all let me say that I am a great fan of tasmota!

I connected a light and an external switch (push button) to a sonoff basic using the gpio14.
However the light randomly goes on and off when I use the 9. switch option under module.
Without the option set, there is no problem.

I already checked the troubleshooting page, mosquitto logs but cannot seem to find the issue. I am using 5 other sonoffs but the client ids are all unique: sonoff1 sonoff2 sonoffs3 sonoff4 and sonoff10. Sonoff10 is the one causing trouble. I already upgraded to version 5.7.0 firmware version.

I use switchtopic 0 and switchmode 4.
Also the console mentions these lines when it is switching on/off:
 
19:29:23 MQT: stat/sonoff/RESULT = {"POWER":"ON"}
19:29:23 MQT: stat/sonoff/POWER = ON
19:30:01 MQT: stat/sonoff/RESULT = {"POWER":"OFF"}
19:30:01 MQT: stat/sonoff/POWER = OFF

Any help or pointers in a direction would be greatly appreciated!

@ionciubotaru
Copy link

This happens when the switch is in an open state (circuit is open) from #665 , #484, #100 and others,
Solution: add a pullup resistor and capacitor (pF size).

@lobocobra
Copy link
Contributor

lobocobra commented Sep 10, 2017

Some (like me) might think..... floating pin? what the heck...
Go to that link and get it perfectly explained...
https://programmingelectronics.com/floating-pins-pull-up-resistors-and-arduino/

But here comes my real point..... why can't we overwrite per software a floating pin? We just learned that the LOW state is stable, when grounded, but the HIGH state is fluctuating.
=> can't we simply assume that its ALWAYS HIGH, unless you get like 10x LOW in a row?

Could someone kindly point me to the place in the code, where it reads out HIGH/LOW, so that I can do a hack?

@davidelang
Copy link
Collaborator

davidelang commented Sep 10, 2017 via email

@GuyBruens
Copy link
Author

Hi, just wanted to confirm that adding an external pullup resistor and a bypass capacitor fixed the problem. It is now switching perfectly and only by my command ;)

Thanks again for the help and keep up the good work!

@aspitznyc
Copy link

Where do you put the bypass capacitor and which size?
I've already added a pull up capacitor but I keep having issues.
Thanks!!

@davidelang
Copy link
Collaborator

davidelang commented Oct 23, 2017 via email

@artek458
Copy link

Hi everyone,
That is my first post on this forum.
I read all of the posts in this topic and seen videos explaining pull up resistors and still don't understand one think.
Why do we need to include capacitor as well as the resistor. All of the pull up resistor instructions says just about resistor and there is nothing about capacitor - do I need one?
At the moment I had to disconnect my light as it's playing too often.

@artek458
Copy link

Hi again,
If capacitor is required, can you also help me with the size of capacitor and resistor please? I know these questions may be silly for you, but I really don't know and don't want to do something wrong...

@davidelang
Copy link
Collaborator

davidelang commented Dec 21, 2017 via email

@artek458
Copy link

Thank you very much for the response. I will play with it after the xmass and hopefully will work at last :)

@mrohner
Copy link

mrohner commented Jan 16, 2018

davidelang's tip helped me to get the sonoff stable again. I used a 10K Ohm resistor and a 33pF capacitor.
resistor goes from GPIO to 3.3v
the capacitor goes from GPIO to ground

@wisebear21
Copy link

@davidelang: I had 4.7 KOhm pull up resistor and 10 pF capacitor on a Sonoff Basic that was used to control ceiling light. GPIO14 and GND were connected to 3-gang wall switch circuit. Everything worked fine untill I replaced 60W indescent light with 40W LED light (220V AC to 130V DC) when Sonoff relay started toggling. I have even fried ESP module when I took Sonoff out of wall box! Don't really understand why it died as I haven't created any short? Looks like I have created some additional noise in the ciruit when I replaced ceiling light.

Should I try to use bigger capacitor in the mentioned circuit?

@nereidum
Copy link

@wisebear21 the 3 gang switch isnt connected to a 2 way light is it as i have blown a sonoff that way, i wired the sonoff to the hallway light switch which was a 2 gang with the other switch for the landing. when flicking the landing switch it blew the sonoff.

@omegasa
Copy link

omegasa commented May 19, 2018

Specification on ESP 8266 says, that all GPIOs has pullup resistor. May be some whay to activate it in firmwary when GPIO used in switch/button mode?

@nereidum
Copy link

I'm sure if there was it would work as default without having to do anything or it isn't strong enough.
I had to use a 10k resistor and a 33uf (micro farad) capacitor. To fix it. Fyi thanks to all the comments above that advised how to do it.

@schumi2004
Copy link

@nereidum
Did you tried pf capacitor also ?
I'm not sure when to pick pf or uf, is it linked to the lenght of the switch cable?
Long cable uf and short pf or vice versa ?

@vaz83
Copy link

vaz83 commented Jul 5, 2018

Hi everyone! I have recently flashed a sonoff to add a external switch and added a 10k resistor from GPIO14 to +3.3v, and a 100pF capacitor between GPIO14 and GND. the length of the wires to the switch is about 1,5 meters, and from time to time i still get the light turning on and of by itself. Can anyone help me out on what should i do more? I have read everything i could regarding this issue but haven't found a solution yet.

@danpadure
Copy link

you can increase ButtonDebounce from default 50ms to a higher value, but you'll have to keep pressing more the wall button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests