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

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.