USB not resetting when powering off Printer (Prusa I3 Mk3)


#1

My goal is to have Octoprint automatically reconnect to my printer when it powers on.

Printer is Prusa I3 Mk3 plugged in via USB to Raspberry PI B+
PI is running octopi (Version 0.15.1, running on Raspberry Pi 3 Model B Plus Rev 1.3)

Using the portlistener plugin if I physically remove the USB plug at one end and then plug it back in, I can see a kernel message on the PI and the port is detected and automatically reconnects.

If I poweroff the printer (currently doing this via a sonoff control but I don't think that is relevant - the end result is still no power to the printer as expected). Then no change is detected by the PI. I assume that it is still supplying power via the USB (the Prusa screen does turn off).

So the end result is power/on/off via printer power and the Serial connection will disconnect and never re-connect.

Has anyone else experienced this ? Any suggestions? I can see that there are some options to shut power to the USB ports via PI console but I would have to somehow link that to powering the printer on to then bounce the port..

Thanks.


#2

Yep.

Nope, but very much interested into any solution that others come up with - it's a thing greatly annoying me about my own MK3 but I haven't yet been able to make the time to investigate possible solutions.


#3

Searching for this, I see nothing by the way.

That said, here is a cool program which will reset a USB port, assuming that you know the information about that USB port that is. And you could marry this usbreset program with the following script which would find the information for the intended device:

resetprinterport

Remember to chmod a+x resetprinterport so that it's executable.

#!/bin/bash

result=`lsusb | grep "The exact text string returned from your controller board from lsusb"`
#echo $result
tokens=( $result )
busnum=${tokens[1]}
devnum_colon=${tokens[3]}
devnum=${devnum_colon%":"}
command="sudo /home/pi/usbreset /dev/bus/usb/$busnum/$devnum"
eval $command

From what I understand, a proper USB connection uses the existence/absence of the 5V line to determine if it's up or down. If this were my own printer, I would consider creating a male/female inline adapter for this setup with a diode placed on the 5V line. The idea would be to block 5V going in the Raspi-to-printer direction but to allow it to be seen in the printer-to-Raspi direction. In theory, then, the Raspi could bring up/down that serial interface based upon whether or not the controller board is powered. And yet, it should block the Raspi from itself trying to send 5V power over to the controller board and then being confused about the up/down state. (I would guess that a typical Type-A to Type-B serial cable would assume that the Type-A side is the host and therefore should provide power for the serial connection. But for your needs, this isn't what you would want.)


#4

Thank you both for the responses. I have previously cut/taped the 5v line on the USB cables for other printers for similar reasons. In tests I found the Prusa (einsy) doesn't connect when the 5v line is missing. Which I think as @OutsourcedGuru points out is probably the correct response. I will cut up a cable and try an inline diode and see if that fixes it.


#5

Use alligator clips for a test to see if it works. If it seems to, then solder up a good solution. I have a pile of these in my stash of components. Just add a couple of layers of heatshrink to the cable before soldering to tidy things up.