Idea for modifications to handle unexpected shutdown

My idea for wiring a Raspberry Pi to handle unexpected shutdown.

I have an Ender 3-V2 printer. I am using a Raspberry Pi 3B+ for the Octoprint interface. At present the Ender 3-V2 is unmodified. The Ender 3-V2 has an internal 24V supply. The Raspberry Pi is powered from a 5V wall-wart.

I have noticed that the USB connection from the Raspberry Pi will power the printer’s controller board when printer’s power is turned off. This can result in unpredictable operation when things are re-powered. Here is what I am planning as a solution.

  1. Isolate the +5V connection via the USB cable between the Raspberry Pi and the Ender 3-V2.
  2. Add a power supply to convert 24VDC to 5VDC power – to power the Raspberry Pi.
  3. Add a relay to allow the Raspberry Pi to control 24VDC power to the Ender 3-V2.

I will implement the above modifications on a Pi Hat. The main power switch on the printer may power-off everything. I foresee an issue that this might corrupt the SD Card in the Raspberry Pi. Therefore, I will add the following modifications:

  1. Create a signal from the 24VDC to signal the Raspberry Pi to shutdown. So that if 24V Power is removed, the Raspberry Pi will shut down gracefully – without corrupting the SD Card.
  2. Add a small reserve supply (large Capacitor or SuperCap) to hold +5VDC long enough to assure a graceful shutdown.

I understand that this will require some work on a shutdown script for the Raspberry Pi. I am comfortable pursuing that.

I look forward to your comments.
Thank you!

Hello @MJBTechCraft !

This is a well known issue: Put tape on the 5V pin - Why and how, Printers known to have backpowering issues

It is not recommended to switch high current sources (secondary side). In particular when you can switch low current (primary side). High currents can result in arcs.

I think it is way more easy with a dedicated PSU for the PI. All my OctoPrint installations here work that way.

UPS Pi Hats already exist too...here's an open source one.

1 Like

My printer (LulzBot TAZ 6) spends a lot of time turned off. The RPi 3B that is connected to it is almost always turned on. The printer is plugged into a TP-link smart plug which can be controlled by the TP-link plugin.

If I had unstable AC power, I'd add a UPS for the RPi. If the UPS has enough capacity, I could add the printer as well. This would ride through momentary outages but long-term outages while actively printing will probably result in a failed print.