Microcontroller freezes randomly when switching on a relay (snubber inside)

Hello!

Please, I need some advice with my project :frowning:

I use a esp32 with some sensors and actuators (triacs and relays). I have 3 relays (I use the chinese relay boards that runs at 3.3v). One relay switches a water pump, the other a moisture maker and the last an aquarium air pump, all running at 230v 50hz.

In the water pump and moisture maker I have a varistor and snubber (0.1uF and 220ohm) in parallel with the relays. It seems that they are doing its job (no freezes or reboots when switching). The problem is the air pump...

It only consumes 3.5w and if I put the snubber (0.1uF and 220ohm) it turns on only using the residual current that the snubber leaks. If I insist on switching on and off the relay, after some tries it crashes the esp32.

I don't understand how this little pump that only consumes 3.5w can generate this crashes, I didn't expect that needed a snubber. Maybe the problem is the relay board that is low quality? By the other hand I don't know which values to use in the snubber to prevent this crashes and keep the pump off when the relay is open.

Any help is appreciated, thank you!

Schematic and links to the data on all components please...

Does actuating the relays with nothing connected to them also cause the crash?

Sometimes also the circuit design is okay, but the layout creates problems. So images of your hardware would be helpful, as well.

Hi Paul, thank you for your response. I hope this help you to understand my circuit:

Sorry about the schematic, is the only tool I have right now for drawing.

This is the Air pump:

This is the big transformer that feeds the moisture maker:

And this is the water pump:

Hi Aarg, here is my setup:

In the relay of the middle is where the air pump was connected, right now is powered directly to avoid crashes.

I forgot to reply you about trying to actuate the relays without any load. I will try, thank you for the idea.

I know that pen/pencil and paper is so 20th century, but it works... the hardware you have shown there must have a detailed diagram in order to fully understand for troubleshooting purposes.

What is that double junction strip on the right hand side? It looks like mains wiring connects to low voltage wiring. :grimacing:

Haha, you're right. Sometimes I forget that in the school I learned to write in a paper ^^'.
The junction strip in the right hand is the 3.3v dc powering all the sensors and actuators, yes it looks like a 230v power line, not very proud on some parts, but still in progress…

About the diagram you're asking… You want a diagram of how I connected all the things together?

Thank you.

Yes. I'm surprised that you didn't start out with one.

Righ now my diagram is to follow the cables :sweat_smile: I will do one for you, and for me :grinning_face_with_smiling_eyes:

@PaulRB I tried to switch the relay a lot of times without any load and no crashes.

This suggests that the problem is on the line side, but there are two different major scenarios:

  1. Extreme noise is generated
  2. The control circuit is extremely sensitive to interference.
1 Like

The air pump is a solenoid and a membrane. From what I know, solenoids are very noisy, I think a snubber will solve the problem but I have no idea which values of the condenser and resistor to put.

The same values of R and C I use for the water pump and moisture maker turns on the air pump with the relay open. Maybe with a bigger resistance and smaller capacitor? I don't know which values to try.

When you post things like that, you should include all the details. We understand technical things here. So instead of saying, "same values of R and C" you should specify the values.

I see two types of relays (I think). Solid state and mechanical. I would guess it is the mechanical relays that are causing the problem. Without a proper schematic I can only guess. Links to technical information for the components also helps. How did you derive your snubber values?

Sorry I didn't specify the values because I posted them previously and I put the exact model in the schematic. The capacitor is 0.1 uF and the resistor 220 ohm.

I get them from a commercial multi-purpose snubber I found in AliExpress.

Try this link, it will show you how to calculate the proper value. RC snubber circuit design and calculations for inductive loads - YouTube As far as your drawing it does not help me. A schematic showing all of the connections etc would be a big help. Post links to technical details on each of the hardware devices. "I use the chinese relay boards that runs at 3.3v" doesn't say much there are a lot of variations available. Here is a paper that may help: https://www.cde.com/resources/technical-papers/design.pdf AC and DC snubber circuits are not the same. Personally I use zero cross electronic switches in place of relays, a lot fewer problems. I have even used back to back SCRs in some real problem units.

Okay, my bad. In my defence you didn't put a value on that, you put a component marking.

The snubbers should be across the device being snubbed, NOT the relay contacts.

You mean that I should connect the snubber in series with the load? I followed this schematic:

image

I saw this connection method in many posts about snubbing an ac load with a relay.