4 Questions about making an ESP32 relay switch with snubber circuit

What is your mains voltage?

240V

The snubber should go across the switching contacts:
image
Th snubber is there to absorb/dissipate the energy that would otherwise create an arc between the relay contacts. If you place the snubber across the relay contact AND the load, the load effectively is placed in series with the snubber circuit; the impedance of the load at those transient conditions will be in series with Rsnub, increasing its value to whatever-your-best-guess-may-be in the split second the arcing would occur.

Some more good info here about relays: Relays Part 2

I agree with the others above that a solid state solution (triac, SSR) is ultimately a more elegant solution altogether.

I will definitely read the article today to gain a broader knowledge of the topic.
The reason I put it between the NO contact and the load was this post #6 of another thread:
Help a newbie pls! RC snubber values for 240v ac. - Using Arduino / General Electronics - Arduino Forum
saying:
Fortsetzung der Diskussion von Help a newbie pls! RC snubber values for 240v ac.:

And ideed, putting it to the load did solve all the issues so far:
It prevented the spark and relay not turning of because of the welding together
AND it solved the issue of leaking current when switched off, causing my LED strip to blink

So I was kind of hoping I could go with the connection like it is right now, since it solved all the issues. Would there be a disadvantage if I left it connected to the load?
Otherwise I would really need to fix that blinking LED strip by figuring out which components I have to change (higher or lower resistor value for example).

Okay, I get the point. I will add the SSR to my project list and might go with that in the long term. But the relay project is still the one I wanted to learn and "get done", so I would like to finish a working relay project first before going into the SSR, since if not, it will always bug me to have not finished the relay project

If it works, it works!

The argument that was offered elsewhere that 'it belongs to the load because it scales with the load' I don't follow. The fact that choices in different parts of a system are interdependent doesn't necessarily mean one thing is part of another. You could argue on that basis that your wall socket is part of your power drill, but does that actually mean anything?

Besides, the idea of the snubber circuit is to offer charge (in the load) a way back to the supply that has a lower impedance than the just-opened relay contact. As such, it's clear that the snubber is functionally a part of the contact, not of the load.

There's always the issue of what happens if Csnub fails short. It shouldn't and that's why you should use an appropriate type, but in all honesty, fireworks are likely to emerge from Rsnub anyway in that scenario, regardless of how you connect the snubber.
Like I said, what you essentially did by mounting the snubber across the contact + the load is increase Rsnub (by putting the impedance of the load in series with it) and that's probably why it now works.

One other disadvantage is that you're basically now wasting power since current always flows through the snubber circuit and it's not attenuated (in practice, with proper dimensioning: stopped) by the load. Your snubber circuit is a little heating element and its dissipation depends on the value of Rsnub and the AC reactance of the capacitor. The reactance of 100nF at 50Hz is about 32k, so 7mA runs all the time through your snubber, dissipating a tiny amount of energy in Rsnub (0.007^2 * 100). Is that bad? Well, the planet isn't going to melt for it. You decide.

I thought it is the other way round?
Since one side of the snubber is connected to the NO of the mostfet and the other side to the return path, the snubber is only powered once the NO is being closed, so while I'm using the TV for 2 hours a day. The rest of the day the relay is off so there is no connection between the NO and the blue return cable should have no current too, so the snubber would be completly cut off?

Can you show how U1 is connected to the load? Given that there's 4 contacts on that connector, there's inherent lack of clarity in the circuit diagram even in the improvements in #10.

Sure
COM is connected to the brown phase cable of the wall that carry the 240V current
NO (normally open) is connected to the load. Since it is "normally open", the TV is not powered when the coil of the relay is not powered. As soon as I switch the relay on, the connection is made and the TV has power. It is also connected to one side of the snubber. So the snubber is only connected when the relay is on.
NC is not connected to anything
Snubber is connected to the blue return cable of the 240V

Sorry, I should have included it to the schematic or remove the NC alltogether since it is not used and leads to confusion as I just noticed

OK, so you've connected it like this:
image

So you indeed have only a leakage current if the relay is closed.

There's a brief discussion of a snubber across contacts vs. across load in this brief but accessible Littlefuse whitepaper.
From that source:

Placing the RC snubber
across the switch contact is preferred, but this has the
disadvantage of providing a current path to the load through
the snubber when the switch is open. Placing the snubber
across the load eliminates the current, but wiring and source
impedance variation may change the effectiveness of the arc
suppression.

If you feel the present circuit is a better compromise, then that's evidently fine. I wouldn't worry too much about source impedance variation and wiring in this particular case. Source impedance can be assumed to be "pretty darn low" and since this is apparently part of a TV/home entertainment setup, I don't expect you're working with very long and coiled up wiring either.

1 Like

The datasheet for your MOV shows a max voltage of 300, the peak voltage of 240VAC RMS is 240 * 1.414 = 340.

https://wmsc.lcsc.com/wmsc/upload/file/pdf/v2/lcsc/2403080959_RUILON-Shenzhen-Ruilongyuan-Elec-RL3225A431K_C2935520.pdf

Thank you, i will change the varistor to one with a higher voltage rating

Doesn't matter, varistors wear out after a while, I wouldn't use one in a snubber circuit.

Do you think it is safe without one? So can I just remove it?
I read that Multilayer Ceramic Capacitors wear out fast too, what is your opinion about that?

For an RC snubber for AC you need to use a film capacitor rated for your AC voltage.
Polypropylene are best.
Ceramics are the worst type to use

ok, so not the small MLCC smd one... then I would take this capacitor:
MPP224KA16AS6025A1 JOEY | C18185885 - LCSC Electronics
so you made me drop the varistor, change the capacitor... only component thats left is the resistor :grinning:
I have this in the schematic right now, do you think thats okay? SMF3W100RJ TyoHM | C395118 - LCSC Electronics

1 Like

Resistor is OK
For the cap use a 630V
Is there a reason why you chose 220nF and not 100nF, although I don't think it will make much of a difference.

I did not find an AC rated capacitor with more than 250V and 100nF, where can I find one with 630V AC and 100nF?
The only ones that I see are DC ones

630V is the DC rating, which is good for 250V AC
LCSC lists them by the DC rating so pick any 100nF polypropylene with 630VDC rating

It's rated for 300V according to the datasheet. It'll probably survive alright, but technically it's not the right choice.

Think I would use a bidirectional TVS diode across the load, not across the relay contacts.
https://www.digikey.com/en/products/detail/littelfuse-inc/P6KE440CA/556947