Help with snubber circuit and microcontroller locking up - Page 1
Forum section: electronics / beginners

author: aaron94
author_rank: Newbie
timestamp: November 06, 2022, 02:14:24 am
content: Hi guys,I'm wondering if someone can help me. I have a problem that is driving me crazy. Basically I built a box containing a relay that's switching a 240vac load. The load is a big 60W air pump and it works the same as the aquarium pumps, it basically uses the 50Hz AC and vibrates a diaphragm.But about... 20% of the time, when the relay contacts open or close, the microcontroller either reboots, or more likely it locks up.I added a 1uF X2 capacitor and 320R resistor in series between the always active mains side of the relay contact and the neutral. That didn't seem to do anything.I did a bit of research and lots of people seem to put the capacitor and resistor in series across the contacts of the relay. I tried this and it seemed to work. I toggled the relay probably 50 times and had no reboots or lock ups. But the problem I had is that the snubber leaks current and the air pump continues to vibrate. It's hard to hear it, but it definitely does.So I'm not too sure where to go from here or what to Google, but if anyone could offer some advice it would be great.Other relevant details:I have a diode across the relay coil. I have 100uF filter cap and also a bypass capacitor on the input of the microcontroller.Originally I was using an Arduino Nano Atmega328p but I switched to an ESP32 just to see if that had any effect. The ESP32 is much more sensitive it seems so I decided to keep it since it makes it easier to troubleshoot if I have fixed it.Relay has a 12V coil and I'm using a TIP122 to control it.Thanks for any advice.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: November 06, 2022, 02:33:13 am
content: Move the snumbber to your load and use a DPST relay, maybe?

author: aaron94
author_rank: Newbie
timestamp: November 06, 2022, 02:36:00 am
content: I think I fixed it...Had a closer look at some of the schematics online, such as this one:The first schematic on the left, I was attempting this but had the capacitor on the mains side, not the load side of the relay contacts.I just swapped it over so it matches the schematic and cycled it 100 times without any faults.Could this have been it?

author: pcprogrammer
author_rank: Super Contributor
timestamp: November 06, 2022, 06:58:50 am
content: Having the filter on the mains side of the switch does not do a thing when the switch is opened. The problems is on the load side. As soon as the switch opens the coil in the pump produces a high voltage and sparks across the switch contacts. This flips of the MCU. Having the filter across the contacts or the load solves this problem.Another option is to use a solid state relay with zero crossing switching.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 06, 2022, 09:44:56 am
content: Across the contacts is the technically-correct way, as far as transients are concerned. The key is, the switch is the dynamic element that generates the nastiness. Everything else is just wiring around it -- and that includes the motor itself, it's no more than a bunch of wiring spooled up in a particular way. Likewise the mains is a lot of wiring, and transformers and etc.Wiring has inductance so all of it is relevant. It might not be very much, not very relevant: 10s or 100s of uH will matter here, and the motor is 1000s or more, meanwhile straight wire pair is like 0.6uH/m. But it also adds up, and since it all adds, it's strictly more inductance when you introduce more wiring length.The downside is the RC across the contact, passes leakage current. That can be acceptable for some loads, like incandescent lightbulbs, or some motors, or transformers with loads on them. Beware that the motor/winding inductance doesn't resonate with the capacitor, which can even raise voltage! That's not acceptable for things like unloaded transformers, certain high inductance motor types, LED lights, etc.In that case, put an X cap across the input. This shunts mains inductance so you don't have to worry about that. Put it near the switch, and put the snubber on the other side of the switch, across the load.More reading:https://www.eevblog.com/forum/projects/snubber-3-different-230v-ac-motors-in-a-record-cleaning-machine/Tim

author: Gyro
author_rank: Super Contributor
timestamp: November 06, 2022, 11:16:40 am
content: Quote from: aaron94 on November 06, 2022, 02:14:24 amYour snubber values don't look right to me for such a small load. Typical snubber capacitor values for that load level are normally in the 100 -220nF range but you're right up at the top end there. The capacitor is there to ensure that the resistor only dissipates energy on the rise times of interest, with 1uF, the resistor is dissipating power for quite a lot of the time. Try dropping the value to 100nF, you could then drop the resistor value a bit too, maybe 100 - 220R.

author: Infraviolet
author_rank: Super Contributor
timestamp: November 07, 2022, 01:38:42 am
content: Can you post a full schematic? How is the microcontroller actually powered? Unless something very odd is happening then there shouldn't be effects getting from the high voltage side of the relay to the microcontroller, and if they did they'd destroy it instantly not just trigger reboots. So I'd look on the low voltage side of the relay for your issues. Might the relay be drawing too much current to power its coil, and hence browing out the microcontroller by lowering the voltage being supplied to it for longer than your bypass cps can protect against?