Power-Loss Recovery for 3D Printers(Marlin Firmware)

Introduction: Power-Loss Recovery for 3D Printers(Marlin Firmware)

About: Known by the name, “Kanad Nemade”. 17 years old. Big nerd of robots. Noob Programmer(C++ and Python). Wants to become a Robotics Engineer. Owns a 3D printer.

Isn't it frustrating when you are printing a large print and suddenly there is a Power Outage!?.

Marlin Firmware comes with a Feature called "Power-Outage/Power-Loss Recovery" but some printers do not have this feature enabled by default.

So, In this instructable, we will find how we can Enable this feature in 3D printers which do not have a Power Outage recovery feature.

The method which I used is certainly not the best way to do that but it does the job.

I know that there are other ways of doing it but this method was easier for me and is less time-consuming.

Image Source: Internet


1. LM7805 (5V Linear Voltage Regulator) or AMS1117 (3.3V Linear Voltage Regulator)

2. Power Bank or any other 5V Power Supply(Obviously whose output is not affected by the Main Power Supply).

3. 10KΩ resistor for 5V and 6.6KΩ resistor for 3.3V boards.


Step 1: Configuring Marlin Firmware

Download the Latest Marlin Firmware from Marlin[Github].

CAUTION: Because we are reflashing the Firmware, you will have to write down all the necessary settings as the older settings will be overwritten with the new ones. Also, you will have to configure the Steps/mm, Acceleration, etc in the firmware.

Now, In Configuration_adv.h:

Uncomment the lines so that the POWER_LOSS_RECOVERY section looks like this:



#define POWER_LOSS_PIN 11 // Pin to detect power loss (optional)

#define POWER_LOSS_STATE LOW // State of pin indicating power loss

#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resum

//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.

// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,

// especially with "vase mode" printing. Set too high and vases cannot be continued.

//#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data #endif


You can change the POWER_LOSS_PIN to any pin number which is free.

In my case, In MKS Gen L 1.0 board I had pin D11 free.
Now, you can upload the firmware to the 3D Printer.

Step 2: Building Circuit

CAUTION: You will have to use 3.3V Linear Voltage regulator(AMS1117 3.3V or LD111733V) if your printer board is not 5V tolerant !. Using 5V for non 5V tolerant board will lead to the production of Magic Smoke!

Step 3: Finalising

We will have to keep only the "board and LCD" powered on when there is power outage which can be done by supplying 5V through the USB with a Power Bank(Cheap power banks work better as they are always "on" and can supply power instantly to the board as soon as there is a power outage). Also, the power is not consumed from the power bank always as the board is powered through the PSU when Mains power is available.

Step 4: Summarising

There are certainly better/efficient ways to pull down the "POWER_LOSS_PIN" using a BJT or a MOSFET but this is a simpler way using minimal components, Voltage Divider can be too used but if the voltage changes on the output side the voltage may exceed 5V or 3.3V which can be lethal for the board.

However, due to absence of power to the Stepper motors, the hot hotend will melt the plastic which will create a blob of plastic but it can easily be sanded off or the hotend can be manually moved away from the print(The printer homes X and Y axes before resuming the print again.).

There is another way in which the printer saves its position after each layer but that will shorten the SD Card's life.

Happy 3D Printing!

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest
    • Halloween Contest

      Halloween Contest