Over on a Facebook group, we've been having a discussion about controlling power to a 3D printer and a Raspberry Pi from a common source.
Rather than figure out some way of using a buck converter to power the Pi *from* the printer, my preferred solution is to do it from the mains in some way. I'm especially not wanting to corrupt the Pi's SD card, as I'm sure you can appreciate.
My thinking is this:
1. Power both the 3D printer and the Pi from an Energenie plug (or 4-way strip).
2. Have a GPIO button on the Raspberry Pi.
3. When pressed, the button tells the Pi to shut itself down cleanly.
4. The Pi shuts itself down cleanly, *but* it triggers the Energenie to shut itself off just before the Pi is no longer in a state to do anything.
My question is: Is there a way for the Pi to send a command to an Energenie plug AFTER it's finished writing everything to the SD card but BEFORE it shuts down completely? I know there's all kinds of levels of Boot process, but is there a way to get the Pi to know where it is in the Shutdown cycle?
Hope someone can help!