Power Supply Monitoring and Management Module that improves usability of 3D Printer.
You may say it's kind a replica of Lerdge Power Monitoring Module (http://got.by/3nmu8k), however, it is different. I am not sure if Lerdge module will work with Marlin, probably, yes, but just for power loss monitoring...
The module consists of two functional parts:
1) Power Sensing (on the top, refer to schematics). Sure, it is isolated from mains power by optocoupler. It ensures a LOW signal to the microprocessor under normal operation conditions and will immediately switch to HIGH as soon as power is lost. Then Marlin accepts the HIGH signal, switches off heaters and writes a power recovery information to a MicroSD card. The energy stored in Power Supply's capacitors is (usually) enough for microprocessor to perform that operation before power is lost completely. My printer has been running for about 2 seconds after switching off the main power provided all heaters are off. So, you may test yours to see if it would work. If the time is shorter, you may need to mod your power supply upgrading smoothing capacitors at its out.
2) Power Management (on the bottom). A simple relay based circuit is controlled by Marlin PS_ON_PIN. Relay is connected in parallel to the main Power ON/Off switch and will short it by a LOW control signal.
Logic is the following:
you switch on the printer by main power switch.
start printing (Marlin will activate relay that shorts the switch as son as you print job is running)
if you'd like to activate power management feature, then turn off the main power switch (relay shorts its contacts and printer stays on and continue running)
when print job is finished, Marlin monitors the temperature of the nozzle and will deactivate the relay as soon as temperature reaches 50*C and lower (with a small delay of 5 sec in my settings). If the main power switch was off at the previous step, the printer will be switched off autocratically. Temperature and delay are adjustable in Marlin (see settings below).
Connection: The module is connected to Power line (220V-240V) and parallel to the Power ON/Off switch. I guess for 110v all you need to adjust is R11 and R12 that should be 2 times lower, 22k or 27k instead of 56k (refer to the schematic).
Attention: High Voltage! If you are not sure of how to work with high voltage, please, do not do it.
Overall budget: DIY module ~$3 BoM is provided in the comments to a schematic
Marlin settings: Configuration.h
// SKR Pro
// SKR v1.3
//#define AUTO_POWER_CONTROLLERFAN //#define AUTO_POWER_CHAMBER_FAN
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU over this temperature
// SKR Pro
// SKR v1.3
|10||56K 1W Vertical Resistor||R11,R12||RESISTOR VERTICAL||2|
|18||4148 or 4007||D2,D11||LL-34_L3.5-W1.5-RD||2|