SerialException Troubleshooting

This is more of a story I suppose, hence why I'm posting it in General. But want to make my intentions clear in writing this: I created an account for the express purpose of writing this post because I hope the information I provide helps someone who finds themselves in the same situation I was in.

I rather recently got into 3D printing. I'm a programmer and sysadmin by trade, and getting computers to do things brings me great joy. 3D printing seems sort of like a perfect fit to someone like me, and indeed, though it can be difficult at times, I liken the difficulty to the same as what I encounter while programming. It's hard, but highly engaging.

Anyway, I've been using Octoprint, having great success printing in PLA, just completed an enclosure to help me print ABS, and that's been going pretty good now that I've finally solved my bed adhesion issues. And then, I was hit with what I now know is quite the demon:

Unexpected error while reading serial port, please consult octoprint.log for details: SerialException: 'device reports readiness to read but returned no data'

Of course, my background renders me no stranger to troubleshooting these systems, so off I went to Google where I found a slew of different explanations. I attacked the problem systematically, trying to correct for each potential issue to see if any difference was made:

  • Check for undervoltage - I first checked the power supply I had connected to my RPi4. I didn't really suspect this could be the issue, as the power supply I have for my Pi is known historically to be good, but it's still worth checking. I did so with the dmesg command, where I found no reports of undervoltage.
  • Check for errant processes - If a process on the Pi is running out of control, this could in theory cause issues. I used the top command to check for any such processes, but didn't find anything out of the ordinary.
  • Check peripherals - If you have other devices plugged into the Pi, this could in theory draw too much power, rendering this issue. I did actually have quite a bit of stuff connected, but no undervoltage message made me think it was unlikely. Nonetheless, I decided to disconnect the peripherals, but it made no difference.
  • Don't access the printer's serial connection from another process - This was a long shot for me since the RPi basically controlled the printer and nothing else, but of course, this didn't end up being my problem either.
  • Check the cable connection - My printer was connected over a micro USB cable, so I checked the connection of the cable, and also inside the printer's main board as well. I thought maybe I had bad solder joints on the main board and that may have been causing the issue. Fortunately, they were immaculate. Unfortunately, that meant my issue lies elsewhere. For good measure, I also tried multiple different cables, both with and without ferrite beads. I even tried the trick of putting tape on the 5 volt pin. To no avail.

At this point, I'd exhausted all of the common options I'd seen, and so, I fell back onto troubleshooting principles, and asked myself, "what changed?" After all, I'd been happily printing for quite some time now, so there had to be something different.

It was at this point that I began to entertain the idea that perhaps this issue was coming from electrical noise. The printer is plugged in to an electrically "busy" area, where multiple other devices are plugged in, and one of those devices wasn't there before all of this. An old mini fridge my grandmother gave me. It is in fact, one of two compressor driven devices connected to that circuit, the other being a water cooler. It didn't really make sense that either could be causing the issue, as the water cooler's been there since long before I had the printer. Nonetheless, I decided to completely isolate the issue. I wiped my RPi, and installed OctoPi, ensuring that it couldn't be a configuration issue on my part. I connected the Pi to only the printer and its power supply, and then watched patiently for the error to occur. Eventually, the error did occur, and I found it only consistently occurred when both the compressor for the water cooler AND the fridge were on AT THE SAME TIME.

I was incredulous, but there in front of me was proof.

I decided to place the printer and the Pi onto a different circuit, running an extension cord. As it turns out, this also didn't solve the issue, though it significantly lessened the frequency. With the knowledge in mind that it probably wasn't anything else, I decided that I needed to make sure that it had to be electrical noise. My place of work graciously allowed me to borrow a power conditioning battery backup system to test this issue. It has been 24 hours since I've started using it, six times longer than the previous maximum, and my printer has remained connected even as I type this. So I'd like to add one step to the list:

  • Check for electrical noise - If your printer operates on a circuit with other devices, especially those with motors in them, try to isolate it, and see if that makes a difference. Consider that you may need special equipment to provide a clean electrical supply.

It is also possible that no circuit in your house is "quiet" enough. It may be necessary to use a power conditioner, or even a battery backup system to get this to work without issue. Consider the fact that having such a device may even be worth it simply as "insurance" against this issue occurring due to random electrical noise. Consider that if you want high reliability, a battery backup system might be a good idea anyway. This ended up being the case for me, as I'm now looking at purchasing a battery backup system myself. I'm out a couple of bucks, but at the very least, I know why this is happening now.

So this one is for everyone out there in the same hole I was in: Take heart, as difficult as it seems, this error doesn't happen without reason. There is a logical explanation for it, even if it's hard to see, and when all else fails, don't forget to try thinking outside the box.


SerialExceptions are one of the hardest errors to debug, because there are so many different things that can influence it and the error itself is quite vague. It's good to have some concrete evidence of another possible solution to the issues. It's crossed my mind before to add to the FAQ topic on this some links to this type of post so people can find them a bit easier.

1 Like

I have to ask. Did you try a new usb cable that was new, and to spec? I had similar problems on another arduino dev platform that was the reult of defective cable.

Not brand new, no. I borrowed a few cables from my place of work to test, but none of them worked. Some had ferrite beads, some did not. I didn't really check to see if they were to spec or not, mainly because of the decision I arrived at regarding the UPS.

The thing is, I sort of realized that even if I could fix this problem with a cable, a UPS would be a superior solution. If not because of the power conditioning they do, then because it would allow me to be better prepared for a power interruption. (Something which unfortunately happens somewhat frequently in my neck of the woods.) As a result, I decided that even if a brand new to-spec cable could fix it, I'd rather have a UPS.

You may find this issue comes back to bite you a few more times even with the UPS. I also went through everything you've experienced and more :slight_smile:

I have ferrite beads on all the cables surrounding my ender3v2 now (usb, camera, stepper motors, PSU power etc etc)

Running it on a dedicated UPS

I have copper tape applied to parts of my stepper motors/extrusions where I found the ground loop had been broken (checked with a multi-meter)

I have a custom made 2metre 10-core cable for the LCD screen

Latest marlin firmware with the rotary EMF noise filter on quite a high setting

Disabled the avahi-daemon service in my octopi, as this seemed to hog CPU usage at 100% during times of serial interference which caused further issues

All of the above combined has finally fixed my serial disconnections and phantom beeps/button presses on the LCD screen, undoing any of the steps individually brings the issue back immediately! :slight_smile:

I also have some of those EMI filters that go on the ender 3 board between the LCD socket and cable but I haven't actually installed those yet as the above steps have eliminated the problem, but at some point I'll add them in anyway :slight_smile:

1 Like

taira - GREAT POST - I've got a similar background, 42 years in tech/IT, and three years 3D printing. I've had similar issues with printers doing the same thing, especially an Ender 3 Pro, which supposedly has a good PSU.

Many many years ago I encountered similar problems in a car factory, where having big spot welders caused havoc with 240V turning into 180V. Not trusting my flat's electricity supply, I tried a small UPS bought when we lived somewhere on the end of a long overhead power line - which often browned out or cut off entirely.

Problem resolved, so I bought a much bigger UPS and run all my printers off that - then run NUT on one of the Pi's and the UPS plugin in Octoprint.

I use a buck convertor off the Printer PSU - one thing that also needs checking is whether there's an undercurrent problem with the settings of the buck convertor.

Finally, you can use from the Pi's command line 'vcgencmd measure_volts' or 'vcgencmd get_throttled' - the command reference is here..

I think the moral of the story is that any cheap switch mode PSU is highly vulnerable to electrical noise and it gets right to the printer motherboard, causing problems just like you describe.

Once again, thanks for the post..

FYI, I've added that to the FAQ entry