I'm trying to drive an 220 V solenoid water valve with a relay, but I'm having problems: when I turn off the solenoid, the microcontroller reboots.

I believe the source of the problem is the spike voltage generated by the solenoid switching off (an inductive load).

So I read some similar post in the internet, and they said I needed an RC snubber circuit.

So now I want to now how to size the resistor and the capacitor to make the filter.

The valve works with 220 VAC and I don't switch it frequently (typically once every several minutes, but I'd like to protect against 2 or 3 switches per second for a few seconds too). I don't know the valve inductance; it seems a necessary value to size the snubber, but I don't know.

Secondary question: do I need this filter in parallel with the valve or in parallel with the switch? I have read some conflicting information about this.

Can someone explain how can I size the filter? If you need some value I didn't tell (for example the inductance) you can leave it as a variable or guess it if it's easy to guess.

Also, other solutions for the problem are welcome.

  • 1
    \$\begingroup\$ Parallel with the valve. You can't size anything since you have no info but you aren't really trying to optimize anything. You just want it to stop resetting. Off the top of my head...try 5 Ohms and 10nF. 100nF if you can find it. You want film caps. \$\endgroup\$
    – DKNguyen
    Commented Jul 26, 2022 at 19:54
  • \$\begingroup\$ Do you have a catch diode in parallel with the solenoid? \$\endgroup\$
    – John D
    Commented Jul 26, 2022 at 19:56
  • \$\begingroup\$ @JohnD It's a 220VAC solenoid coil. Diode would burn up. Hence the search for RC snubber suitable for AC. \$\endgroup\$
    – Justme
    Commented Jul 26, 2022 at 20:08
  • 3
    \$\begingroup\$ Be really careful about using "the microcontroller didn't reset" as a measure of the effectiveness of your solution. You need to use an oscilloscope, find out what rail is being hit by the transient (could be microcontroller power, microcontroller reset, signal to a watchdog, and many other possibilities). Once you find the problem, you have a way to quantify your solution and define your margin. You need to know margin so you avoid a borderline solution that spikes just short of causing a reset, and under different conditions (hot, cold, humid, dry, low battery, etc) the problem comes back. \$\endgroup\$
    – Ben Voigt
    Commented Jul 26, 2022 at 20:34
  • \$\begingroup\$ @Justme Right, I didn't read it carefully enough, thanks. \$\endgroup\$
    – John D
    Commented Jul 26, 2022 at 21:21

2 Answers 2


220 VAC is about 320V peak. If it draws 100 mA, you want to apply that current to a resistor that will limit the voltage to something much less than 320V, say, 10V. So for 100mA, that will be 100 ohms. The capacitor should be chosen to provide a time constant long enough for the resistor to dissipate most of the energy, which depends on the inductance of the solenoid. A 220V coil drawing 100 mA would be an inductive reactance of 2200 ohms at 60 Hz, or 5.8 H. If the relay also has a resistance of 200 ohms, that would be a TC of 5.8/300 or 19.4 mS. A capacitor having the same TC would be 19.4/300 = 65 uF. However, this is an impractical value, so something like 220 nF could be chosen. Also with a large capacitor, the power dissipation of the snubber becomes excessive.

I prefer modeling the circuit with LTSpice:

Relay Snubber AC simulation

The peak voltage on the relay coil is actually about twice that of the applied voltage, which seems to be because the voltage due to inductive current is added to the supplied voltage.

A better way to control switching transients may be to use a TRIAC or SCR switch, which will remain conducting until the current is near zero. But a zero crossing TRIAC will cause a much higher initial surge current, as can be seen in the simulation. If turned on at 90 degrees, there will be minimal overcurrent.


In-depth study here: https://www.eevblog.com/forum/projects/snubber-3-different-230v-ac-motors-in-a-record-cleaning-machine/

For a basic start, try 100n+100R. Use 250VAC or higher, X1/X2 rated type, or probably 630VAC+ without X rating would be fine. You can also get ready-made parts with R and C inside.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.