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
dmesgcommand, 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
topcommand 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.