I have a Raspberry Pi that is powered by mains from a AC-DC Laptop Charger (with DC Buck regulator).
I also have a DIY Nodemcu (Home Automation project), it has a relay (5V with a control circuit that I got somewhere here and built it[ the relay module itself does use PNP and the nodemcu cannot turn off the relay itself]), they are powered by another AC-DC charger (5V output).
Both of them are connected to a single automatic voltage regulator but, whenever I turn on or off the relay (nodemcu is controlling the relay) with a plugged in Electric Fan as the AC Load, the Raspberry Pi suddenly resets (hardware reset, like shorting the RESET pin on the Board). I live in SE Asia and we only have 2 prong US like outlet (no grounding, | |), I beleive that they are both live (220V) or maybe each prong are half of the 220V.
Is there any way to determine why this happen? My initial design was to use the same PSU from the RPi and the NodeMCU but I've encountered the problem whenever I cycle the relay, so I used a separate PSU for the nodemcu but I was surprised that the issue persist. The relay module has the glass diode (maybe 1n4148) connected in reverse (protection from spikes?) it is connected to the NodeMCU GPIO D5 with an arduino sketch program that I made.