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.
- Isolate the +5V connection via the USB cable between the Raspberry Pi and the Ender 3-V2.
- Add a power supply to convert 24VDC to 5VDC power – to power the Raspberry Pi.
- 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:
- 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.
- 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!