I am operating an Raspberry Pi Zero inside a distribution board. The pi is powered via usb using a din rail power supply and it connected to an usb-rs485-adapter to get modbus data from a smart meter. The pi runs Raspbian 10


I noticed after several hours (5-15hrs) the pi looses network connectivity. As I don't have any other console or gui connected, I assume it crashes. After powercycling the pi boots normally.

At first I suspected a faulty sd-card, but this was not the case. I tested the pi with a different powersupply and the same card, it ran fine. So I assumed the din rail power supply (a Mean Well HDR-15-5) is faulty. However, I removed the very same power supply from the distribution panel and tested it outside without issues.

Now I have only two options left that are different when the pi is inside the distribution board:

  1. The pi is located next to (~2cm distance) the main AC supply wiring (230V, 40A max). The pi is in a plastic case. Can electromagnetic interference cause this issue? I know that this could theoretically be an issue (as with every circuit). The question aims to how likely this could be the case.

  2. Inside the breaker panel, the pi was connected to the rs485 interface. Could a faulty / low quality usb-rs485 device cause this behaviour? If yes, how can this be diagnosed?

Is there any other possibility I am overlooking?

  • Have you monitored memory usage?
    – CoderMike
    Sep 26, 2020 at 21:13
  • How did you test the supply - it only needs a minor voltage drop or spike (or even noise) that will not show up on a multi-meter. I would talk to Mean Well and see if they have ideas or even if the unit is suitable for a Pi.
    – user115418
    Sep 26, 2020 at 22:44
  • @Andyroo: I forgot to mention, I tested it by operating the pi with it. It runs for 7 days so far without issues. Sep 27, 2020 at 8:17
  • @CoderMike no, I didn't. The pi is not running anything special yet, apart from sshd. Do you think mem usage could be an issue on a "stock" raspbian installation? Btw, the syslog did not show any signs of a problem. Sep 27, 2020 at 8:21
  • Could be RAM, pi Zero only has 512MB. If it runs low it will start swapping memory to sd card and the Pi will look like it’s hung.
    – CoderMike
    Sep 27, 2020 at 8:29

1 Answer 1


The Pi Zero is a rather rudimentary design and not very robust. It is not something I would have chosen for a task designed to run unattended.

Any such device needs to be designed for its environment; a distribution board is a rather hostile environment and interfacing needs to incorporate protection, but EMI should not be an issue although this depends on what is being powered.

At the least any such project should include a watchdog. This is standard technique and is traditionally done with an external circuit, but the SOC includes a hardware watchdog. See https://raspberrypi.stackexchange.com/a/99585/8697

This needs some customisation to detect failure conditions. It includes some generic conditions, but ideally this should include an application specific test driven by your code.

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.