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

Flashing/Plusing when pin14 is connected to ground #484

Closed
aidancrane opened this issue May 27, 2017 · 19 comments
Closed

Flashing/Plusing when pin14 is connected to ground #484

aidancrane opened this issue May 27, 2017 · 19 comments

Comments

@aidancrane
Copy link

I have just flashed and installed Sonoff-Tasmota in a lightswitch in the house. I also attached pin14 to the old light switch to also have the ability to use the old light switch to turn it on and off.

From the console, or MQTT the bug is not present, I can turn the switch on and off no trouble when the wall switch is off.

However, when I turn on or off the light from the wall switch, it pulses for less than a couple seconds all the time, and it never ends, I've tried disabling MQTT.

12:04:09 MQTT: stat/sonoff/RESULT = {"POWER":"ON"}
12:04:09 MQTT: stat/sonoff/POWER = ON
12:04:10 Config: Saved configuration (1492 bytes) to flash at FB and count 157
12:04:16 Wifi: Checking connection...
12:04:16 Wifi: Connected
12:04:16 MQTT: stat/sonoff/RESULT = {"POWER":"OFF"}
12:04:16 MQTT: stat/sonoff/POWER = OFF
12:04:16 MQTT: stat/sonoff/RESULT = {"POWER":"ON"}
12:04:16 MQTT: stat/sonoff/POWER = ON
12:04:20 MQTT: stat/sonoff/RESULT = {"POWER":"OFF"}
12:04:20 MQTT: stat/sonoff/POWER = OFF
12:04:20 MQTT: stat/sonoff/RESULT = {"POWER":"ON"}
12:04:20 MQTT: stat/sonoff/POWER = ON

12:04:09 is when I flipped the wall switch from off to on, the rest is of the switches own accord, does anyone know why this is happening?

@khcnz
Copy link

khcnz commented May 27, 2017

I have some units setup in the same fashion so it should work - I assume your light swtich is a proper toggle switch not a momentary on/off unit?

Can you confirm

  1. Switch was setup as a "Switch" (not a button)
  2. What switchmode you are running in (should be toggle)?
  3. Confirm you haven't set a pulsetime

You can do this from the console on the webportal by issuing the commands

  1. GPIO
  2. SwitchMode1
  3. PulseTime1

@aidancrane
Copy link
Author

aidancrane commented May 28, 2017

Thank you for your reply, the sonoff basic module is setup as follows.
image

This is the result from the commands you asked me to run. Since I posted the issue, I have re-flashed the sonoff to try to rectify the issue, but It still remains but the interval between flashing is much longer now sometimes minutes apart.

09:50:53 CMND: GPIO
09:50:53 RSLT: stat/sonoff/RESULT = {"GPIO1":0 (None), "GPIO3":0 (None), "GPIO4":0 (None), "GPIO14":9 (Switch1)}
09:51:09 CMND: SwitchMode1
09:51:09 RSLT: stat/sonoff/RESULT = {"SwitchMode1":0}
09:51:10 UPnP: Multicast (re)joined
09:51:10 CMND: PulseTime1
09:51:10 RSLT: stat/sonoff/RESULT = {"PulseTime1":0}

The Switch is a standard household switch that latches and follows this schematic, that I obtained from here. The setup is a little different as I live in the UK, where no neutral is present at the switch but follows the same principles as the US.

image
The sonoff is mounted above a ceiling rose in the loft, and then loops back into the room.
image

Would there be a way to add latency to the switch before doing anything, or lowering the tolerance before determining if pin14 is high or low. As it does not seem to be present on Alexa or MQTT, perhaps it is the distance to the switch or interference? The problem is reversed when the switch is high and I've turned off the light with Alexa.

Also would it be possible to just trigger MQTT, without turning on the light at the swtich, then I could filter out the blinking?

@davidelang
Copy link
Collaborator

switchmode 0 tells it that you want to toggle when it sees a connection, you probably want switchmode set to follow (1) see https://github.com/arendst/Sonoff-Tasmota/wiki/Commands

@khcnz
Copy link

khcnz commented May 28, 2017

@davidelang depends if you are likely to 'remotely' turn on/off often - as then toggle makes more sense (which makes it work similar to a 2 way switch) - a flick of the switch will always change the state - but up or down on the actual wall switch doesn't mean anything. At least that is what i have done.

@aidancrane Your diagram seems to make sense to me and rest of setup looks ok. I can only imagine here that there is some cross talk/induction due to the length of cable from the rose to the switch (how long is this?). Could mean that it floats of GND sometimes even when switch closed. Also just want to check if you disable switch one it doesn't turn on/off by itself?

@khcnz
Copy link

khcnz commented May 28, 2017

Presuming you eliminate any possibility something other than the switch is causing the on/off then suggest reading this https://electronics.stackexchange.com/questions/49824/microcontroller-with-a-long-wire-for-digital-input/49825

@aidancrane
Copy link
Author

Ok, I have been up into the ceiling and tried a dead short across the pins, low and behold the issue is gone, therefore it must be that the problem exists due to voltage drop from the switch as you had said. The distance to the switch is quite short, only 6-7 meters round trip, but seems to be enough to cause the flickering.

Now this is more of an electronics question so may not be the best place to ask, but I don't really want to re-wire the switch and would rather use the existing wire. After reading the stackexchange question, would my best bet be to run a boost converter in line with pin14? say 3v to 5v?

@khcnz
Copy link

khcnz commented May 28, 2017

No, I think you want to follow the idea of trying a capacitor first (which is mentioned in link above and also here and here). I am more of a s/w guy than a h/w guy so if that doesn't work you may need more help than i can provide.

@aidancrane
Copy link
Author

Ok, thank you, I will try a capacitor and if it fails I will try other means.

@davidelang
Copy link
Collaborator

davidelang commented May 28, 2017 via email

@DNA99
Copy link

DNA99 commented Jul 8, 2017

image

@davidelang @khcnz Hi, I am having this issue with one of my sonoff basics which I install on a 2 way circuit and the wires going around the house to both switches are probably exceeding 15 meters. sorry I need some visuals to get this right. Is the attached diagram correct for the placement of the capacitor and resistor? What size capacitor and resistor do I use?

@DNA99
Copy link

DNA99 commented Jul 8, 2017

image
@davidelang @khcnz Here is my diagram. Are those the right places to put the capacitor and resistor?

@davidelang
Copy link
Collaborator

that looks correct, the value of the resistor and capacitor don't really matter much

the resistor needs to be large enough that it doesn't eat a lot of power.

the capacitor needs to be small enough that it's charge time isn't large enough to be noticable.

@DNA99
Copy link

DNA99 commented Jul 9, 2017

@davidelang what puzzles me is that this happens only with this circuit with a 2 way switch. I have another 3 on a single gang switch and they seem to work fine. Do you think it is necessary to put the resistor and capacitor on the other sonoffs as well?

@davidelang
Copy link
Collaborator

davidelang commented Jul 9, 2017 via email

@DNA99
Copy link

DNA99 commented Jul 9, 2017

@davidelang could you give me the specification of the capacitor i need to get? I tried looking for one and there is a ton of them out there and they have voltage as well. The smallest voltage capacitors i could find was 4v and 40uF and i got a couple of 0.25w 10k om resistors. Does that sound right to you?

@davidelang
Copy link
Collaborator

davidelang commented Jul 9, 2017 via email

@DNA99
Copy link

DNA99 commented Jul 9, 2017

Thanks pal! Now to remove the sonoffs and back to the soldering iron.

@DNA99
Copy link

DNA99 commented Jul 9, 2017

20170709_171919
@davidelang I haven't got the capacitors as they were out of stock. and I just tried soldering a 10k resistor between GPIO14 and 3.3v as in the pic and it seems to be working fine now! Do you know if it makes any difference if you use 10k resistors and say 7k? Thank you for the help!

@davidelang
Copy link
Collaborator

davidelang commented Jul 9, 2017 via email

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

4 participants