Electronic – arduino – Relay switching a light causes a spike, making a raspberry pi halt

arduinolightingraspberry pirelay

The problem in short:
I worry that switching lights is causing a spike. Occasionally a Raspberry Pi halts completely after a relay is switched.

The setup:

A Raspberry Pi 3 is connected to an Arduino Nano over Serial. The Raspberry gives the Arduino the command to switch a relay (when a PIR detects motion). This turns on 3 fluorescent tubes on 220v in series.

The TV that is connected to the HDMI port of the Raspi sometimes flickers when the lights get switched on. And every now and then (at least once a day) the Raspi just completely halts. No SSH/VNC possible, no HDMI video output. But still the red LED is on.

Why I assume the lights are the culprit:

Every time the Relay switches, the TV flickers. I think there might be a spike in the circuit but I'm not a professional. Also, the logs of the Raspi are completely clean. Which makes it likely there is no software problem here. I have a couple similar setups that work fine. The only difference being that they just switch 1 regular light bulb, rather than 3 fluorescent tubes.

The question:

Is it likely that the 3 lights draw so much power they disturb the TV and the Pi? If so, how can I prevent this from happening?

Best Answer

You should troubleshoot this in a couple of steps.

First leave the circuit as-is but program the nano to turn the lamps on and off autonomously. The Pi should still be affected.

Now disconnect the wiring between the nano and the Pi (using a different power supply if necessary). See if the Pi is still affected. My guess is that it will not be.

If it is not affected then the problem is EMI caused by the inductive load of the lamps, particularly when the contacts open. You can try substituting an SSR or adding a snubber across the contacts, though the SSR is a better bet. The "Hockey puck" style is popular and probably does not require a heatsink for such a light load.

enter image description here