Marlin: [FR] Recover from Power-loss

Created on 15 May 2015  ·  102Comments  ·  Source: MarlinFirmware/Marlin

You can enter in the firmware resurrection wasp mode?
So in case of power failure it can pause and resume printing the extruder to get up so as not to damage the piece and resume printing when you want?

https://www.youtube.com/watch?v=ZmfGlsUGVs0

More Data Work Improvement Feature Request

Most helpful comment

Recently, and since Prusa brought out their I3 Mk3 with resuming after loss of power, I feel it should be looked at again.
As a UPS is generally too expensive for most people.

All 102 comments

I like the concept, and detecting loss of power without a dedicated circuit could be done in some creative ways, such as noticing a sudden switch in state among many components at once. The biggest caveat is that Marlin must support many boards, and they will vary very widely in the amount of time available to process before power to the CPU is lost. Writing to SD or EEPROM adds a risk of data corruption that we would also need to mitigate.

http://www.wasproject.it/w/en/resurrection-system-a-3d-printing-revolution/

That looks like it would require extra hardware as well. Also it seems to power the arduino from the 12v supply, what if you've converted it to run off the +5vsb rail so the printer can turn the PSU on and off? ATX PSU's have a power good wire which you could monitor instead. There are so many ways this could be monitored and implemented.

@ntoff Yes, theirs has a diode in series with the power supply. Of course with an Arduino connected to USB you are correct. It will stay powered from the USB. And since most users now use laptops, it will probably stay powered for a long time. So this is still very useful for those cases where power is lost only to the high current circuits.

Let's set aside what a print looks like after a hot nozzle has been oozing on it for several minutes...

That's why OP said move the nozzle up and away but THAT would definitely require extra hardware (a UPS) to power the motors.

Still, it should be trivial to sand / file that one damaged spot on a 60+ hour print (someone on reddit just did a 65 hour print) rather than starting all over again from scratch.

Mine are both powered by the 5 volt standby line from the power supply so they work without the PC being hooked up but yeah with the laptop connected the arduino still gets power so there'd be plenty of time for that to save the data or even send the position back to the host and let the host do all the hard work.

@ntoff In the demo video the delta gets stuck and stays in one spot. Maybe it has a fast-cool nozzle. :8ball:

I have downloaded, their firmware and I'm trying to figure out the pieces of code in more. if you look in firware in cardreader.cpp function it was planned but not implemented

if (store_location) {
     // future: store printer been, filename and position for continuing a stopped print
     // I know one can unplug the printer and continue printing the next day.
   }
}

you could integrate into the firmware this thing !? It would be helpful to all in case of low or tebsione and resumed printing when you want.

@galeots Someone around here will experiment with it when we have more time.

with our agreement that we should limit the list of supported hardware maybe this one is more easy? and if no one is going to implement it then i think i should be closed...after all we are only 4 that have made a comment about this

but i like the idea too

I would like to take this project forward with you very helpful to all of you!

I would like to take this project forward with you very helpful to all of you!

This is very complicated for several reasons. First, the G29 Correction Matrix and Zero would have to be stored so it can be recovered and used. Without that, a recovery would not be possible. And you can't re-probe the bed with a part already half built.

Are you thinking about doing the firmware to accomplish this? Because, if you are, I think we can coach you on the necessary components and how to proceed.

if you download from their site you understand where to add the code!
I'm not good at planning but we must add a paritore sensing the voltage drop ...
http://www.personalfab.it/download/19162/

One problem with this is it appears it is aimed at Power Failures. It would be easier to get everybody to agree that the cost, effort, support issues, etc. made sense if it handled any generic failure causing the print to stop. For example, a computer crash or a communication failure to the printer.

as now in the firmware in case of power failure throw it all away! hours in case of printing is a waste! in their gaming system can resume printing the following day if it takes too long!

as now in the firmware in case of power failure throw it all away! hours in case of printing is a waste! in their gaming system can resume printing the following day if it takes too long!

I do appreciate the innovation and use. Mostly, I'm asking "How hard would it be to make this handle the generic case of any failure?" If it could be made to handle the generic case, I might personally jump in and help code it. The big problem right now is we need to clean up and simplify Marlin. So there are a lot of trade offs that have to be made.

When I get a chance... I'll check out what they have done and see if there are things we can leverage.

@galeots
Are you sure you linked to the right software.
Can't find where an extra adc is read.
Can't find a 'resume'-menu.
Can't find writing or reading to/from the sd-card.
Can't find "resurrection" as a string.
Can't find anything relevant

The problem still exists that this feature will require at least some sort of power reserve in the form of either a small battery or capacitor bank. There's no way to implement this feature in _just_ firmware.

Just hook a UPS to the board, power_good wire to one of the RAMPS pin and when the power good signal goes bad it shuts down the heaters and parks the head. Since power is technically never lost you wouldn't need to re-home (unless the UPS battery goes flat but if they can run a PC for a few hours surely it could keep an arduino on for a day)

wait, the WASP team has just released the version of the firmware for delta wasp open (which is the smaller wooden version of the delta wasp) and do not believe in that version have implemented the resurrection, nor will the Lazarus that are present in commercial versions, and it's released in CC, I think as written in the article below it to him asking if we could give us the implementation
http://www.wasproject.it/w/en/resurrection-system-a-3d-printing-revolution/

It will require a lot of preliminary work generally, because Marlin doesn't have formal support for stopping and resuming a print yet, not at all. We need to develop some good, clean ways to accomplish that first, before even beginning to think about how to catch a power failure and respond meaningfully. For example, what if the print is using bed leveling compensation? Upon restoring power, that compensation would be disabled, so the print would resume in the wrong location. So… lots to do.

Hi , i'm not sure if this thread is solved or anywhere else
I'm just a beginner and i don't have learned all the marlin code yet
I don't want to be stupid here , but i need to contribute in a solution for all and for dummies
Not all are devellopers , not all understand GITHUB lol , not all are electronician

I will offer my solution 'for dummies '

We have many sources that can apply a pause in this firmware ok
We know that stopping the motors will not resume their perfect original position
We know that the homing will not resume the original position perfectly
We know autolevel code too young and not ready for resuming ' for the moment '
Impossible to be sure the stepper will not move after turned off , in my case , the pipes , the cables apply forces and the carrier will be pushed , and resuming will be DEAD

So ; We have ONLY ONE POSSIBILITY , never stop the power ! And it's not a big difficulty , i think it's more easy to made than many weeks of programming and testing that will not make results

So , everybody have to make their own extra power hardware , it's not expensive , it's not needed to be enginner

My solution ,
1-) An UPS or 12v/24v battery with diodes on the power
2-) A 220V/110V switch wired on the ' FILAMENT RUNOT SENSOR ' to make pause when loss
3-) Bed power stop when FILAMENTRUNOUT active ' option on the lcd if we want resuming system '

Ups must be able to produce enough time to wait the power restart '24h is very sure 'in reality 10/12h is enough , but for high security i prefer to wire battery directly by diode on the out of the power supply , we can gain more hours just by this .The advantages of direct battery is that in the case of very low voltage 8/7/6/5 critical volts , the motherboard have chance to stay functionnal , unlike an UPS that will brutaly stop
The active steppers and motherboard have a low consumption so , it's easy to have long standby mode with the bed off ' We don't forget to apply more DIMAFIX coat to avoid risk of detachements '

This solution is perfect , FOR DUMMIES too , the cost is not expensive , i thing if you have a printer , you have a home for the printer , you have the money for the filament , you have a computer and INTERNET , you have enough money for one battery and a 220v switch

If stupid comment , please delete
I can make cad schématics and tutorial for dummies , i can make a stronger hardware for not dummies , that have battery test panel , and automatic charging , i can make this.
You just have to make a menu on the LCD ' cold pause + RESTART when filament sensor become OFF' , if not exist, or simplify use and unused pin ' this will need to check all motherboards and have a big work of programming , testing, and supporting' , use the filament runout is IMMEDIATLY functionnal for all

In the case of filament pausing ' real ' , the user need to deactive the ' restart ' in the lcd , and easily change the spool , and restart manualy ' and reactivate the autorestart'

Thks

1-) An UPS or 12v/24v battery with diodes on the power

My FolgerTech only has a 12 volt supply. Nothing else comes out of the power supply. I'm not quite willing to do this, but if I put a small 6" x 4" x 4" tractor battery on the +12 volt power rail, it would probably handle the 20 minute power blinks I get. Something like this:

http://www.ebay.com/itm/Mighty-Max-12V-12Ah-F2-SEALED-LEAD-ACID-DEEP-CYCLE-RECHARGEABLE-BATTERY/191115358342?rt=nc&_soffid=100&_soffType=SaleAndClearence&_trksid=p5731.m3795

If I were to do this, I would probably want to adjust the power supply's output to be more like 13 volts just so it is always lightly charging the battery. That would be a very simple and effective solution for printers with a single 12 volt power supply.

after long reflexion about all the possibilities , the low cost requested , the long life without problems , i have decided this diagram , and all other economical system will not be sure . Printing need stable electrical system , no rapid composed diagram
I have gather all the conditions , cheap , easy for dummies , evolutive for each budget , no safety risks , long life durability , no code no upgrade , work with all printer immediatly ' or all have pausing pin '

1 batterie of your choice , 15$ to more
1 charger low cost 5$ or more
1 220v relay 10$ ' high current needed '
1 capacitor
and some connectors/wires easy to find every where

sans titre

Here is for me , the unique diagram for the better ups securised home made system for 3d printers

@thinkyhead @Roxy-3D and others

Here are my suggest , the ideas of non confirmed and experiment develloper , but develloper too !

  • Mini Ups or 12/24 battery
  • A very little power supply ' not plugged on the ups , Of course !' and plugged on a free PIN of the motherboard to give the loss information when voltage falls

  • PAUSE : The pin make the paused process , the UPS permit to have a good pausing process
    The pause is ok , motors stopped , buffer empty , and we can have the gcode line number , the z height , stabilized

  • BACKUP
    Now it's possible to make a big dump on the SDCARD , Filename , z , line , Mesh , all to restart
    Motherboard waiting in economical mode , no consumption , all stopped

CASE OF UPS SHUTDOWN and motherboard turn off

  • RESUMING
    I have an idea , if we create the ' DUAL HOMING, a new process of homing before starting the print ' , we add on our printer , the ZMAX endstop , and we remake the home process , by probing the zmax too. The new home process will probe zmin , and zmax , and will store the precise height between the two endstop. With this method we can have now , two ways of homing , we can homing with zmin or .... ZMAX too !!!!! AND WITHOUT COLLISIONS with the printed objects !!!!!
    _## Ps: The precise height between the two endstop can be defined on firmware once it is know by the user , a new gcode for zmax homing can be create too , i don't know IF EXIST loll_

Now We have , all on the SDCARD , we can now make the homing with just the zmax endstop , substract the height , apply autobed mesh perfectly and restard at the good line

I don't have enough knowledge of MARLIN labyrinth for the moment , BUT I HAVE IDEAS !!

@ Everybody

@thinkyhead @Roxy-3D and others... i think this one should be taken away.

very little interest have been shown and it just adds more complexity than its worth.

I would say that if people want this kind of security an UPS is the way to go. you can get an APC unit with expansion port for almost nothing is you get them used. replace the internal batteries and add external ones to suit needs

Recently, and since Prusa brought out their I3 Mk3 with resuming after loss of power, I feel it should be looked at again.
As a UPS is generally too expensive for most people.

My idea 👍

OUTAGE PROCESS
1-) Ups with enough energy to finish the current layer
2-) A new gcode instruction M1000 , that i place in the layer change of my slicer
3-) A hardware outage detection , on a free pin
4-) A pause program , that idle the machine , if OUTAGE detectir + M1000
5-) The layer is finished , Carriage in pause park
6-) Program save last height in EEPROM
7-) If power back print restart

If UPS is down then RESUMING

1-) A program for resuming :(need human intervention to check if the object haven't pop off the bed and can continue the print)
--- That ask to move manually the nozzle to find a solid layer to probe z on the object
--- With babystep we will set it perfectly when print restart
But now we have the problem to retrieve the perfect X/Y homing ...

Solution 1 --- Ultra high end endstop with high repeatability and the normal homing give good results
Solution 2 --- Use very low feedrate and babystep in realtime for x/y , if the object is easy ok , but if a mad object , impossible to make it in a short time , and without make some traces ...

Solution 3 --- Place jauge comparator on the printer , and before the print , we place the carriage at x0y0 and we make the measurement. When we will resume , we will replace the carriage and with babystep we remake the same value , and print can begin

But , i need a good idea , to babystep without a ton of adventure or anything that is too much ...
Thks for all idea , all are welcome

I don't see why a gcode is needed, when you could just add into the Configuration_adv.h that you have a UPS, so that would auto-magically finish the current layer, then store the next line onto an SD card.

If someone lives in an area where power outages occasionally happen, or regularly, then an EEPROM is a bad idea, as you will wear out said EEPROM. Besides as the move towards 32bit, most boards do not include EEPROM.

Can you test out the solution with a "secret voltmeter"? This solution can work on many of Atmega chips including ATtinyx4. I just bought the CR-10S so I can't test if it will work and how much time the microcontroller can work without a power.

Link on the code example for voltage metering:
http://www.instructables.com/id/Secret-Arduino-Voltmeter/

My thoughts about how it should work:

  1. Detect the voltage drop (voltage lower than 4800 mV for example - this can be added as a parameter in configuration file for easy tweaking) on internal, so called "secret voltmeter" + Stop the X, Y, Z axis and filament movement (retract a little bit?).
  2. Write the position of X,Y,Z to SD card or EEPROM (or both?). CRC for data may be required.
  3. Try to move Z axis away from the printed object (IDLE mode can be used to save some power?) + Try to notify the Octoprint about the power problem.
  4. Then after power resume:
    4.1 Show confirmation message about the power problem and ask user if he want's to resume the printing + Notify the Octoprint about the power problem.
    4.1 Return X,Y,Z to home.
    4.2 Move X,Y,Z to a last position and continue printing.

P.S.: I think you can keep the actual position of X,Y,Z in a memory to be able to write it on SD card or EEPROM fast enough.

The CR-10S has a Mega2560, not a 168 or 328, so it's not likely to be much help.

I've posted a link on a code for 2560 and other microcontrollers: http://www.instructables.com/id/Secret-Arduino-Voltmeter/

Aha! Well, that is cool.

@Grogyan
Tell me How the machine knows when we make a layer change ... Because in a print , you have zlift , you have fwretract , it's impossible for the machine to know how it's a layer change
It's why we add the gcode instruction in the slicer , not a difficulty and sure and , now , we are sure that the current layer is FINISHED. We are sure that the object have a precise planned surface , the best starting point for recovery. When printing , if we have the outage detection , the machine continue to print while appears the M1000 gcode , and now the machine knows the layer is finished and can go in pause park

Most board does not include EEPROM
I didn't know that ... 😱

@thinkyhead , my new idea is to use the new sensor or MK3 prusa , and to mount it under the carriage , just for X/Y homing. The optical tracker will scan a fix point of the machine when homing but can be used , to make detection of the edges of an alreadry printed object
The question is ... What is the precision/repetability

I have a ' silhouette cameo ' plotter , and the system is the same , an optical tracker scan the paper to find some printed marks before to start the cutting

@Studiodyne
The machine could know by checking, once power loss has been detected, if the next gcode in the buffer has a Z change, then, you can decide if you want to do an X and Y home, or just move the tool head out of the way, the to an X and Y home once power has been restored and print resumed.

Homing accuracy on X and Y depends entirely on your particular endstops, optical tends to be more accurate than a microswitch.

@Grogyan
In the situation of a print in dual extrusion mode , with ZLIFTING , and with separate printed object , where we have Zlift up = G1 zxxx , the layer is not finish .
In my system , we ensure a finished layer , to have a plane surface , for more solving solution , if the object is simple , the user can make a new print of the rest , if the user want to resume , it is possible
And with a totally plane layer , it's possible to make a z homing everywhere

About the endstop... Yes , it's true , it's my last job , find or make some endstop ultra high precision. I'm sure that if I found/make a device with ' 0.05mm' repeatability , i'm winning
But i need the EEPROM + Human intervention for resuming , not automatic mode
The autoresume will never exist as a system for all machines , only some custom machines can make this

In a case of CNC , the carriage cannot move , because of the guiding screws , and if stopped , we are sure to retrieve the same exact position of all the machine , and it's easy to resume , but on a chip printer , when power is down , the carriage moving by the force of the cable , the filament and more

My project is simple ' ALL MACHINES ' with EEPROM ' of course '+ Ups + OUtage detector hardware

  • Power outage -> print while M1000 --> When M1000 go on pause and in reduced bed heat mode + nozzle stop heating

-If ups falls , when reboot the menu tells me

Place manually the nozzle on the object to find the z0
Apply position 
Home x/y 
Read sdcard 
   --> set z height and heaters
  --> find the last M1000 <z height> 
 --> start print

The program to make , is simple , asking user to place manually the nozzle to find a solid layer for probing z , with babystep we will perfect it when restart , make a homing x/y and restart print at the layer stored in eeprom

SIMPLE and PERFECT !
But need ultra high precision x/y repeatability

@Studiodyne
You are making this more complicated than it should.
WASP has working code for an old version of Marlin, that just needs to be worked into the current BugFix.

Using the EEPROM us still not a good idea. I personally do not know if there is enough space left for storing the bytes of the last/next line. Good for quick experiments, but probably not long term.

Checking for Z change once power loss is detected is relatively straightforward.
In my opinion, I am not a dev, nor can speak on their behalf, but I see no need for another gcode be added, just to get a resume going. The layer change means you know the Z height, no need to home that, would be dangerous if settings are not correct, may end up with a broken printer.

FYI a 3D printer, is CNC (Computer Numeric Control)

I have compared the Creality firmware that Naomi (SexyCyborg)acquired
to
WASP
to
Marlin 1.0.1 (as this is the oldest I can find that is similar enough to compare)

All are about the same (more or less) with no specific functions/calls to a pin, or M112 (emergency quickstop)

So either the functions are already in Marlin, or there is proprietary code to execute saving the last gcode line, and resuming from said line.
However, these functions, by themselves, already exist in Marlin, just not implemented in a way to be automated in the case of power loss.

I have ordered some ultra high precision x and y endstop ' METROL 1µ'

I will make my test like this

I make a print with cylinders and square towers , and every 25 layers ' 10mm ' , i will make a G28XY homing , and every 25 layers i will see , if the homing have bad effects on the print
If i have good result , i will start programming this

  • One Gcode instruction to place in the slicer , in ' layer change tab ' , to inform Marlin when layer finished
  • One feature named ' FL - Resuming ' ' finished layer resuming '

The feature is really simple and need hardware
-one UPS
-One outage detector on a free pin

If outage

  • Finish the layer or wait the gcode instruction ' Gcode + outage pin = go to pause park and wait '
  • When in pause , Z height is stored in eeprom

if power resumue

  • Back to print , delete eeprom Z stored

If UPS down

  • On reboot , ask to resume
  • If you resume , MARLIN ask you to place your carriage on a zone where it's possible to probe the object surface
  • If no bltouch , or inductive or simple endstop , you will positionate yourself to be in contact with the object
  • You confirm the HEIGHT= CONTACT TO OBJECT
    And you click resume print at EPPROM Z HEIGHT
    And now , the carriage make a G28 X Y , and use current z as ' zero '
    The print start at the beginning of the sdcard , and reject all moves gcode while the G1 z=Z in eeprom
    AND PRINT START
    you add babystep to perfect the height and it's all

SIMPLE !

The convenient is , AN UPS , DIMAFIX GLUE ON THE BED to ensure no ' pop off '

I promise , i will make it soon
But i will need thinkyhead , to make the storing , and the SD CARD FEEDING until z found
The rest i can !

I have begun the slow process of writing up backup and restore functions last night, as there did not seem to be much progress in this area.
However i'musing the SD card for back up and restore information.

My limited coding ability will mean this will take a while.

Why finish the layer ? Because , so easy to resume a print if the current layer from zero , the probing of restart is so easy too
It's why i will use UPS , because large format printer , need a true solution !!!

It's a good starting point.

I WILL MAKE IT
and thinkyhead will make it really functionnal for all machine
No need of special mechanicals system

FOR ALL MACHINES
but need

Sensor high end ........ 120$
UPS 200$
outage detector 5$

That is very expensive to a lot of people.
But it is a good starting point

Most UPS'es has USB data line to signal if power outage is detected, IMHO. You can try to use UPS connected to a Raspberry Pi + Octoprint for that. But it will be better if someone will test if atmega printer boards have enough power to save the progress on SD card

M27 reports the current byte, getting an accurate location which can be done when SD printing is paused via M25.

Knowing also what the filename was when prematurely stopped is also important, which can be also stores as bytes in the EEPROM.
How much free EEPROM space is there on the Arduino MEGA 2560?

EEPROM size in ATMega2560 is 4096Bytes = 4KBytes
https://www.arduino.cc/en/Tutorial/EEPROMRead

Yes .... expensive ...
But this resume feature is for large format machine. May be for little if has money.
Large format machine can burn 2 or 3 spools and can play more than 100 hours.
It's a lot of stress to have bo possibility to use the already printed object.

Note: 1 micron are really expensive and ... too much for me for the moment so i will wait a few weeks

@thinkyhead @Roxy-3D NEED EXPERTISE PLEASE

GOOD NEWS - POWER OUTAGE RESUMING FOR ALL MACHINES IS NOT A DREAM NOW !

A very good news today , i have made a print , and each 20 layers of 0.3 mm , i have placed a XY homing , and , you cannot imagine my surprise when i've seen , the differences are so little , so acceptable , and NO NEED OF PRECISION ENDSTOP , to home XY after a power loss

POWER OUTAGE SURE RESUMING

My project : 
- A sure system to ensure resuming a print after power loss
- When outage detection , the printer finish the current layer and go to pause parking
- Needed : 
  -  UPS
  -  Litte hardware for outage detection  and a free pin 
  -  M1000 gcode instruction inserted in ' layer change tab ' of your slicer

How it works : 
- Each M1000 increment a counter on each new layer change
POWER LOSS start : 
- If a power outage appears , wait the ' M1000' gcode , 
to be sure the current layer is finished
- and go to PAUSE PARK
- Store the current M1000 count + Z HEIGHT + current FEEDRATE  in SD or EEPROM 
- If power is back , print continue

If UPS is down

RESUMING : 
Only if the object is glued on the bed , and after expertise to continue the print
- Click on the last file and print it
- The firmware ask to help to make a contact with nozzle and object last layer
- By LCD/USB , you will manually make the contact  with the object last surface
- When ok , the firmware will set the Z HOMED and add clearance
- Now the firmware make XY homing ' the loss is minimal with chinese endstop  '
- Now the print can restart 
- Temps + setting 
- ALL MOVEMENT GCODE are ignored until appears  the count of M1000 '
- Stored Z height is applyed  + M1000 count updated +FEEDRATE and Print continue
- May be , a little babystep needed for restart 
- Z height stored is deleted , and the printer is now ready for another outage detection

Some lights about this ways
Why finish the current layer ?

  • Because sometimes the print can be totally restarted , and the parts will be glued , it's easy to restart a print if the last layer is finished.
  • Because when the layer is finished , probing the surface have no doubts , we know exactly the z height for restarting , if not , we have two heights in the print and to restart a print with a layer not finished , it's a big adventure to program and no chance to success , because risk of collision , because of the loss of the buffered lines

Why UPS ?

  • Because the only way , at first to have a good power for long prints , and to have enough energy to finish the current layer

Why a new Gcode in slicer layer change tab ?

  • Because your machine doesn't know when a layer change appears , and can not made the difference between zlift , or retractation or any z moves . With the Gcode M1000 in the slicer , the machine will always exactly know when layer is FINISHED , and it's at this time we can go in pause

Why homing z by hand ?

  • By hand , or lcd , or gcode , is the way for ALL MACHINES , if i make an automated system , I have to programm all configuration , if you have bl touch , it's easy , but if you have endstop , to find the new z is a problem , it's why , you will manually make the contact to have the Z homed

Why homing x and y ?

  • Because NEEDED lolll
  • As you will see on the top of this comment , i have tested the repeatability of chinese endstop and , it's really acceptable to retrieve the same carriage position just by homing

Why make a counter of M1000 ?
To have a turbo feeding of the file while the count is not reached

Why all this process ?
Because the challenge is FOR ALL MACHINES , and no exception , to resume a print is easy , if you have created a special locked mechanics when power loss , but all the cheap printers and many expensive don't have a resume possible mechanics , and it's why , we need an universal SYSTEM
UPS + a little board , and it's ALLLLLLLLLLLLLL !

Why Feeding the files and not storing the restart line ?
Because if usb printing feeding or restart is impossible , it's why for compatbility with all machines , it's better to make an ignore movements procedure to reuse the original file

Why a human intervention for restarting ?
Because an automated restart is impossible ON ALL MACHINES , and the object need a human expertise to be sure , no pop off and to continue is possible

THANKS FOR EXPERTISE

@thinkyhead , please trust this project , and help me to make the program , it's easy , not really difficult , but my little brain , my low knowledge of language , and how to store something on sd or eeprom is at zero , you can make the program in one or two days , for you , it's a game . And your Firmware , will have the best magic feature possible and that WORKS ! Not a commercial illusion that works only ' if , and i f , and if , and if ' but never works
Thks

Prusa Mk3 Firmware
@thinkyhead Looks like Josef has uploaded to his github the firmware source for the MK3 which includes the power panic (Blackout) detection
But you might have already talked to him about it at MRRF.

@Grogyan: I would be more interested in seeing Prusa's TMC2130 crash detection and recovery working on upstream Marlin. That feature shouldn't require any new hardware!

Prusa … power panic (Blackout) detection

We can incorporate this for Einsy RAMBo but other cards will need a new implementation.

Meanwhile, here are the changes that Creality made for the CR-10S firmware:
https://github.com/ShenzhenChuangxiang3D/Marlin/commits/CR-10S

this should atleast be added as optional feature along with hardware to detect the power loss
I am from India and power loss is a common thing here so 3d printers are worthless here without this feature

Meanwhile, here are the changes that Creality made for the CR-10S firmware:

That looks like a decent SD card destroyer. It seems they don't use any backup files or renames, but rather hope the outage doesn't happen during write and if it does, that a random 8bit value saves the day and cancels the print entirely.

I've been playing with a relay on the 230V inputs, so I can send a logic signal as soon as the power goes out and there's about 1500ms of movement before the printer stops, using a "standard" cheap LED 12V 200W PSU, so there is potential to do something useful even without extra capacitors.

The problem I ran into is coldend mounting - after a short while, my extruder mount melted. So "recovery from power loss" sort of inherently relies of a machine built for it.

That looks like a decent SD card destroyer.

Yes indeed. We don't like it at all, and we suspect Creality3D was not aware of its issues.

3d printers are worthless here without this feature

For areas with a lot of power-outages, 3D printers with _proper_ power-loss detection (e.g., Prusa MK3) are recommended. You'll do even better by using a UPS that has an extra digital signal output so it can signal the printer well in advance of total power loss.

Have a look as well to anycubic I3 firmware. They implemented power outage and resume via interrupt. Info are saved in eeprom and function is activated with G5 gcode (they did replace the bezier function). This is working well and is simple compared to what they donne with Cr10.
Source here : https://github.com/ANYCUBIC-3D/I3-MEGA

@systemik: Writing to the EEPROM periodically would be even worse than writing to the SD card periodically, but thankfully the anycubic does not appear to be doing that. Instead, they have an interrupt on the OUTAGETEST_PIN which triggers PowerKill(), which in turn calls OutageSave(). So, overall, not bad. But that still begs the question about what specialized hardware they have. Adding this to upstream Marlin would still only work with the proper hardware.

That said, perhaps if Marlin had the feature to listen on a particular pin for a power event, people could rig it up however they like, whether through a custom PCB or the power loss signal on an UPS. What's clear, though, is that it would not be usable as a software-only solution.

Yes, true, specific hardware in this case. This is based on trigorilla with two big caps which provide just enough power (matter of seconds) to initiate the outage function. As you say, there is surely a way for other board to have such detection pin and have additional power just for the board to write on eeprom or on SD card before power is completely loss.

Hardware plus software feature is acceptable as long as it is an optional feature that can be enabled or disabled
hope this feature will be released soon

Any updates on this feature?

@LevyImage — I'll be working on this feature more once my schedule is clear. Do you have a hardware solution in need of firmware support?

Hi @thinkyhead I've a few CR-10s that I'm modifying. Reversing the dual Z steppers upside down to release compression that can cause bowing. And some other things that require me to change from stock firmware. But I also need the power failure resume feature Creality did. I don't mind the heavy writes to SD cards... I feel print time and lost time is more valuable than a 16GB SD card. Naomi Wu recently posted on the FB group that she's working with Creality to get them to add the thermal protection. Was wondering if someone already has done something like this already for the CR-10s? Thank you

If you just want the Creality3D implementation, I've ported it over to the bugfix branches already, but it is not widely tested and may not be entirely reliable. Just enable POWER_LOSS_RECOVERY to use it.

@thinkyhead Thank you, you're a gentleman and a scholar!

So uh, you guys will support the Trigorilla hardware solution too?

If it uses a digital pin to signal power-loss, then, yes, when we add that functionality.

how to implement the hardware part is there a schematic or ciurcuit diagram? Is there an opensource solution?
i am just a hobbyist without any fancy 3d printer....i made my 3d printer using aluminium frames and arduino mega+ramps board

@paulgamedev have a look to my fork. I implemented it for my i3 mega with 8bits trigorilla board and it works. This is the mix of the initial code here and of the hardware detection code from original firmware. If you want to try, tweak and reshare results that will help others.

https://github.com/systemik/Marlin/tree/1.1.x-power-resume

thanks, I'll try to use this on my kossel soon ^^

Are the solutions discussed here are relevant to what is available in the link below?
"https://github.com/Resumer3d/info "

Are the solutions discussed here are relevant to what is available in the link below?

No. Resumer3D is a standalone solution that is meant to work with even the oldest firmware.

and Resumer3D is not opensource too....its not even close to its 10,000 usd goal on kickstarter

@thinkyhead
Hello,
First of all, thank you very much for implementing the power recovery code from the CR-10S into marlin.
I can understand that you you just implemented it a short while ago and I don't want to complain at all, but I think it isn't working correctly somehow. I've been testing it in different stages of different prints on my anet A8 and it recognizes power outages and asks whether I want to resume the print, which is already awesome.
It also recalls the position it should be at, since the LCD is displaying the right position, but the print never continues.
Apparently the code is supposed to raise the nozzle, then to home X and Y a few times and then to come back to the old position. After that, it should lower itself and continue printing. However, the printer doesn't lower the nozzle after homing a few times on my machine, it just goes to the correct X and Y position and then stays a few millimeters over the print. The LCD reads "Continuing..." but it seems like it doesn't continue, no matter how much time I give it.
Could you please fix this issue ?

Could you please fix this issue

I'll look into it when I get back from traveling, in about 5 days.

@thinkyhead Thank you very much for your help

@thinkyhead Hello, I know it takes some time to make this function work but did you already get some time to look into the problem please ?

I patched POWER_LOSS_RECOVERY yesterday. Please test the latest code at your next opportunity.

@thinkyhead Wow great, thank you very much. I'll try it out today.

@thinkyhead It really worked, thank you very much ! ^^
I have removed the menu and made it into auto resume by changing the line 5174 of "ultralcd.cpp" (" lcd_goto_screen(lcd_job_recovery_menu);") into "lcd_sdcard_recover_job();"
Thanks again !

This is exciting, is bugfix-2.0.x the branch I need to look at for all this?
I'm using CR-10s with stock boards and one with a Duet2Ethernet board.

@LevyImage both 1.1.x-bugfix and 2.0.X-bugfix should be working but I've tried 1.1.x-bugfix

I reworked some of the code tonight because it wasn't functioning for files in sub-folders. Hopefully nothing got broken by the changes. Please test the latest bugfix-1.1.x and/or bugfix-2.0.x branches at your next opportunity.

hello, this feature need extra hardware? Sorry but I don't understand how the firmware detecte the power failure.

During an SD print, the firmware will periodically write to an SD file (called "BIN"), saving the current state and progress of the print job. When a print is completed this file is deleted.

If the machine sees the "BIN" file on boot-up, it will assume that the last print job was interrupted, and it then asks if you want to resume. It uses the data in the "BIN" file to continue the job.

Currently it writes to the "BIN" file every time Z moves to a higher point than before, guaranteeing only one SD write per layer. For historical reasons there is also an option to update "BIN" after every command, but that's not the best option to extend the life of an SD card.

Due to the way it works, prints are likely to resume at a point that has already been printed, thus printing over part of the previous layer. The only way to avoid the issue is to write to the "BIN" file more often, or ideally to add a circuit that detects a power loss early and notifies the firmware via a digital or ADC pin so the firmware can write the "BIN" file and park the nozzle.

@thikyhead thank you very much for your reply. I'm working in a hardware like the Prusa power panic, so a signal will be sent to the electronic board. It will work with the Prusa firmware but Marlin will work?
In the other hand, is it possible add the function that periodically write the the BIN file on the SD? I'm thinking add this feature in the firmware for the Prusa MK2S. Which files is necessary changes? Thank you

Due to the way it works, prints are likely to resume at a point that has already been printed, thus printing over part of the previous layer.

@thinkyhead: One idea may be to rehome on X/Y, but count the number of steps to reach the endstops. This gives a rough estimate of where the print head was located when the print was stopped. Marlin could then attempt to locate the first GCODE command that lies within a certain radius of the stopping point. This won't be accurate 100% of the time, but it may help cut down on retracing.

I try test the last Marlin bugfix with the power loss function but don't work. i unplug the PSU. After that I plug again. Marlin start with the recovery menu. I select recovery. Then start XY home. The z axis is in the same Z position before unplug, ok. Start print BUT is printing the 1 layer on the Z position. It also print the raft layer... In the LCD the Z height is flashing! Could you help me?

@makerbitter To enable #define SAVE_EACH_CMD_MODE...(power_loss_recovery.h)

@cjsoong thank you. I will try again. Is the unique change we must do in the marlin?

@makerbitter Only you need to enable #define SAVE_EACH_CMD_MODE then upload it to the motherboard.

Ok. I'm finishing the board to detect the power loss in the PSU. the board will have a pin out to connect in the 3d board
Where can I configuration the feature in Marlin? @thinkyhead write this feature is available also

@makerbitter You need to download the latest version of bugfix 1.1x or bugfix2.0x.
Marlin/Configuration_adv.h

   //#define POWER_LOSS_RECOVERY
+  #if ENABLED(POWER_LOSS_RECOVERY)
+    //#define POWER_LOSS_PIN   44     // Pin to detect power loss
+    //#define POWER_LOSS_STATE HIGH   // State of pin indicating power loss
+  #endif

@thinkyhead i would like implement the power loss recovery function (without PIN) in other version of Marlin, how can i do that? Where could i check the lines of this function add in the Marlin? Thank you in advance.

Take a good text editor an make a Marlin (directory) wide search for POWER_LOSS_RECOVERY.

Thank you for your help. I would know if is possible find in github the modifications made,, i dont remember how, but i think is possible check the lines add in green and the modificated in red, is it correc?. Im newcomer in github.

Because POWER_LOSS_RECOVERY defeloped a bit since its introduction you will not find a single dif containing all changes.
You can find the majority of the changes by calling
https://github.com/MarlinFirmware/Marlin/commits/ed86550061ab94f10dd1d310c994bd74db582740/Marlin/power_loss_recovery.cpp
and following the links from bottom to top.

@AnHardt thank you

Hi! I've been trying to make this work for some time and I can not. I tried everything that appears in the forums and I have not achieved anything yet. what dou you recommend? @thinkyhead

I recommend you pass on the feature until it is more stable.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings