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?

  • 1
    \$\begingroup\$ Use a SSR. Especially one with zero-crossing detection. \$\endgroup\$
    – anrieff
    Commented Sep 3, 2018 at 10:08
  • \$\begingroup\$ Thanks! Do you have a specific one you can recommend? Also, is heat a problem with SSR's? \$\endgroup\$
    – jwktje
    Commented Sep 3, 2018 at 10:17
  • 1
    \$\begingroup\$ Increase local decoupling. \$\endgroup\$
    – winny
    Commented Sep 3, 2018 at 12:34

2 Answers 2


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


Get a better quality power supply for the pi. That isn't affected as much by instable source.

A good sized capacitor across the power supply will also help buffer the powerspike/dip.

It may also be time to replace the fluorescent with LED tubes. Those won't have big startup power draws other than a small inrush to charge the filtering capacitors.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.