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

Why? It is not providing any isolation of note. :grimacing: It's just connected as a glorified transistor with unity gain.

And the very unusual choice of 3 V relay modules (never seen those before!) is completely inappropriate here as 5 V modules with a functional optoisolator do operate with a correctly connected 3.3 V logic control source and the additional regulator is superfluous. :roll_eyes:

Nor am I sure of the point of grounding the relay control line instead of connecting it to the ESP!