Sonoff 4CH Pro strange behavior

Tags: #<Tag:0x00007f0582379bf8>


Hi all,
I’ve been facing a really weird behavior with the Sonoff 4CH Pro, both R2 and not.
I’ve been using one single device to control three lights: living_room, garden1, garden2.
Garden1 and garden2 share the same magnetothermic switch, while living_room is under the main one.
This is the scheme of my case:

As you can see, I’ve been also using relays to remotely control the device button using my pre-existing wall push buttons.

What happens is that the Sonoff living_room channel starts to randomly turn off and on the light, after some days of good work.
On the first occurrence with a Sonoff CH4 Pro R2, I tried moving from ch1 to the unused ch4 but I only managed to have some more days of it working.
Then I thought it was a device issue and tried with a simple Sonoff 4CH Pro, but again, after some days the living_room channel started to randomly toggle the light.
It’s always the living_room channel, that’s strange!

With a test light, I’ve found the presence of AC tension in buttons pin of the device, and this is not owing to my external relays (I can also detach them).
So I’m now thinking that the device insulation among buttons, relays and power supply could be not so well and that an electrical dispersion is in some way ruining the ESP pin.

Could someone confirm or bust this idea? I really have no more clues of what’s happening.

In a while, I’ll replace the 4CH with one Sonoff Basic to control the living_room alone, and a Sonoff Dual to control the garden lights, but I’d like to explore this issue to eventually find out a problem with the device if anyone could be interested in.


How long are the lines from the relay to the device button?

They could be picking up noise (much more likely than insulation breakdown). You’ll need an RC low pass filter.


The noise was my really first thought, I was also going to put an RC filter near the Sonoff buttons.

  • The lines between Sonoff buttons and my external relays are only 1m long
  • It’s alwais the channel connected to the living_room light, no matter what I do or what device I use
  • Other channels have never had a single problem
  • Once the channel starts to “go crazy”, also without wires connected to the button it will continue to toggle randomly (it’s no more connected to anything but I know it by looking at the device leds)

For example, if I just turned on the old R2 device, with nothing connected, it would start toggling ch1 randomly (let’s say about less than once per hour).

Thus, I think that some current flow may have damaged the ESP…


Yeah ok. That’s a bit weirder.

Check the ch1 circuit for dry solder joints around the button pullup resistor.


It could be a connection problem with the mqtt server (or even with wifi) + retain values not set correctly.
Is it flashed with tasmota? If so try checking the console log on the webserver.


Did you “unlrearned” the RF codes? I had this kind of behaviour and it was solved after doing the cleaning procedure. From the ITEAD page:

“Clear 433MHz Coding: S5 is 433MHz code clearing button, please press and hold it until the 4 LEDs lit up green and off.”


@tom_l I thought it was owing to the solder joints but I have two different devices with the same behavior.
Furthermore, with the first one I’ve tried moving from CH1 to CH4 (it was empty, I just need 3 channels by now) and the problem happened.
Also, every time, the problem happens after some week and then it keeps happening few times a day.
It really seems that something breaks after some days of stress.

@infiniteloop initially I used Tasmota and from the console I saw the button pressed log lines (but no one was pressing it). Now I’ve been using Espurna for a while, since it has some more features for my needs, but the issue is still there.
Other channels are ok, the only one is this damned living_room.

@clyra indeed I never tried this. I don’t know if this could solve, the problem appears after days in the channel connected to living_room circuit and then that channel will always be broken, and when I move to another channel (with no issue up to that moment) I can bet that it’ll go crazy after some days.
Anyway, I think I could give it a try…

In the meantime, an update: I’ve moved from CH1 (went crazy) to the unused CH4 and disconnected the living_room relay (the one connected to the wall push buttons).
Now I cannot control the light using the wall push buttons but only using MQTT or the button on the device.
After 10 days I’ve had no issues, while the CH1 is still turning on and off randomly, but with nothing connected.

Now I have two ideas:

  • 10 days are a too short period and in a while it’ll start with its crazy stuff
  • the relay is defective and let some tension reach the button pin (and thus the ESP pin)

I’ve got a Sonoff Basic ready for installation, with Espurna and the pushbutton extracted with two wires but I’m waiting just to exclude point 1.
Then I’ll try with this new device and the relay connected, to see if it really is the problem…


The only other thing I can think of is that perhaps you have damaged the inputs due to flyback voltage spikes from the relay. When a relay is turned off the rapidly collapsing magnetic field around the coil can generate quite high negative voltage spikes. The solution is to put a reverses biased diode (1N4007 or similar) in parallel with and close to the relay coil. This clamps the negative flyback voltage spikes to about 0.7V.

See here for more (don’t worry about the 2nd and 3rd options, the delay time from using a diode alone is minimal):


Yes, that’s a good point; I didn’t think about it!
I should try your solution.

Maybe that relay has more spikes while closing than the others two.


Just a thought about the flyback diode.
Originally I had a step relay controlled by various wall push-buttons.
I simply replaced it with a 220V AC relay, the coil circuit is not DC.

Maybe I could put a capacitor in parallel with the Sonoff button, to have a low-pass filter against the spikes.