Raspberry Pi turns off mid print

What is the problem?

Hi, i've been using a raspberry PI 4 with octoprint connected to an ender 3 pro for a few years now with next to no issues. I've easily ran 30+ spools of filament through the machine. Recently however, i've been running into an issue where the PI switches off completely mid print, it's happening near enough every print now. Though sometimes i get lucky and manage a few prints before a failure. I recently had a 33 hour print fail at the 31 hour mark, that one sucked. More recently i'm only getting about an hour into 4 hour prints.

When it turns off, the printer stays on with its current temperature settings with the print head frozen in place until i cancel the print through the screen.

What did you already try to solve it?

I've checked all cables and they're secure, octoprint is up to date, the printer is cleaned, fans are working, i've also taped off the power pin on the USB between the printer and PI to cover the backflow issue as others have suggested.

Have you tried running in safe mode?

Currently attempting a print with safe mode turned on.


Same issue, the current print failed at around 2 hours in (50%) and then 1 hour 50 minutes on the two previous attempts and the raspberry pi shut down, with safemode on it made it about 2 hours 30 minutes before crashing or shutting down.

Systeminfo Bundle

octoprint-systeminfo-20230701144925.zip (54.0 KB)

Additional information about your setup

OctoPrint 1.9.1
OctoPi 0.18.0
Running on a Raspberry Pi 4 with official usb power brick

Connected via usb to the printer with the power pin taped over.

Ender 3 Pro - 4.2.7 32bit Board - Firmware: 1.0.1

Does the Pi run stably if it isn't printing?
Try running something to give it a bit of stress, so it's working similarly hard.

I found this:

2023-07-01 14:28:15,666 - octoprint.plugins.backup - ERROR - Error while creating backup zip
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugins/backup/__init__.py", line 999, in _create_backup
    raise InsufficientSpace()

How full is the SD card in the Pi?

Yeah, it can stay on for days when it isn't printing.

What would you suggest running to try and stress it?

I've pretty much only ever used it for octoprint.

Free: 7.9GB / Total: 29.0GB

No idea, I'd have to duck that question... performance - How can I stress test my Raspberry Pi - Raspberry Pi Stack Exchange

Alternatively perhaps monitor temperature and voltage while you're printing: it shouldn't be too hard to log the data.

Actually the logs do not report any throttling issues.

It is more that some hiccup shuts the Pi down:

2023-06-30 17:00:30,063 - octoprint.server - INFO - Shutting down...
2023-06-30 17:00:30,067 - octoprint.server - INFO - Calling on_shutdown on plugins
2023-06-30 17:00:30,068 - octoprint.events - INFO - Processing shutdown event, this will be our last event
2023-06-30 17:00:30,071 - octoprint.events - INFO - Event loop shut down
2023-06-30 17:00:30,085 - octoprint.server - INFO - Goodbye!

This repeats at random out of the blue.

Just out of curiosity, on my system I clicked on the power icon in the header and selected "Shutdown system". After restarting I found the following in my octoprint.log:

2023-07-02 05:48:36,961 - octoprint.server - INFO - Shutting down...
2023-07-02 05:48:36,967 - octoprint.server - INFO - Calling on_shutdown on plugins
2023-07-02 05:48:36,973 - octoprint.events - INFO - Processing shutdown event, this will be our last event
2023-07-02 05:48:36,984 - octoprint.events - INFO - Event loop shut down
2023-07-02 05:48:37,642 - octoprint.plugins.tracking - INFO - Sent tracking event shutdown, payload: {}
2023-07-02 05:48:37,651 - octoprint.server - INFO - Goodbye!

This leads me to suggest under OctoPrint Settings, Server, Commands are the shutdown and restart commands. I'd clear both of those or replace them with something benign like echo "shutdown" and see what happens.


I'll give this a go.

I do appreciate all the help!

I did just manage a successful 8 hour print (a new file) without any hiccups. I'm 50% through another one now.

The file that it shutdown on failed 3 times previously at a similar point in the print, and maybe 1 in 4 prints had issues last week. I'm starting to wonder if perhaps some select gcode uploads got corrupted or something.

Do you know there's a "Power failure" plugin, to help recover a print?
Doesn't help with the actual problem, but might mitigate against it.
I haven't tried it myself yet, so I don't know if it's any good.

1 Like

This does not appear as a power failure.
It is a regular shutdown.

I don't know if that plugin works in that case.

I would expect a shutdown to be easier to recover from than a power failure, but judging by the discussion on that plugin, I am wrong...

Gave this a go, had one successful print (different file) then a crash (shutdown command was still somehow issued) 30 minutes into the next print.

octoprint (12).log (87.3 KB)

What came to mind:

Do you have some additional software installed to OctoPi? A GUI maybe?

Just OctoPrint (1.9.1) on the PI

I've just wired up some extra cooling to the electronics box and i got a plugin to track the temperature of the PI through octoprint, i'm gonna try a few prints and see if that helps. I doubt it was overheating, but hopefully it'll rule out any weird power issues due to the creality boards terrible motherboard cooling, which forked off the hotend fan.

So, with the following changes:

  • Routing the Raspberry PI power cable no where near any other cables to cut down on interference.
  • Wired up the Electronic Box's Cooling (Ender 3 mainboard & PI) to take power directly from the printer PSU via a buck converter and swapped out to two 120mm fans.
  • Replaced the powerbutton that was hooked up to the GPIO with a momentary switch instead of a toggle switch (had no issues with this for 2 years, but i had a shiny new button so thought i may as well try).

I've managed to print a file which had previously crashed or shut down the PI, three times previously without any problems.

So, i'm thinking it was either electrical intereference or a cooling issue.

I'm gonna keep printing for a few days and see if i run into any more problems.

It depends on if the print gets cancelled on a shutdown. If it does not, the print would likely recover with the plugin.

1 Like

So, i had to do a bit of maintenance on the printer (swapping out a nozzle, fixing a clog, changing Y axis belt) and then the issue cropped up again with the PI shutting down after about 20 minutes into a print.

It's also extremely hot (weather wise), so i thought maybe it was a heating issue, tried a desk fan directly over the board + creality board, same problem. Though the PI wasn't hitting over 40 degrees. The electronics box has a seperate 120mm fan for both the PI and printer board.

Maybe it was electrical interferance on the power, rerouted it, added ferrite cores, tried new cables, hooked up the entire thing to a UPS. Same problem, PI shut off after ~20-30 minutes in a print.

Was about to give up when the ender 3 screen beeped by itself, so i routed the ribbon cable away from literally every other cable and no issues.

I'm 2 prints in now with the ribbon cable hanging out the front of the print enclosure through a hasitly drilled hole into the electronics box and i've had no issues.

I've got no idea why in the hell interference on a display cable to the printer board caused the PI to shut down, but there we are. I hope this helps other people.

1 Like

Nevermind, tried printing again today and it's now only getting 8-10 minutes in before the PI shuts down.

I'm guessing the beeping on the screen from the screen cable was a totally seperate issue.