Not sure if this should be in Get Help or not so decided to post here. Is there anyway to block raspberry pi from sending voltage over USB? Specifically just want to block any voltage from being able to flow from pi to my SKR 1.3 as I just blew up the USB controller on 3B+ because it back fed too much voltage even when the SKR was set to not get power from USB
Software or hardware mods, I don’t care which, just don’t want to run into this problem ever again if at all possible.
You can modify a usb cable, or tape over the +5 V contact in the connector. Make sure to keep the GND connected and it should work fine (without powering the printer controller, or backpowering the raspberry pi from the printer)
I was trying to think how this could happen. I think it's because you have the ground of each isolated from each other. Or there is something wrong with your power supply. Try measuring the voltage on your pi power supply to ground. Like the ground on your printer. The metal on the power supply should be grounded thru it's ac outlet. Try your 5v from your pi power supply to the ground of your machine. It should be 5 v and if it's not. Not sure what to tell you. When you have two different grounds that can cause problems. If you have someone close with a knowledge of electronics they might be able to help you with your problem. Good luck.
The problem is that the USB standard makes a basic assumption:
the host computer is the one with the beefy power supply and all client-side devices don't
For the Pi + Arduino/RAMPS pairing, this assumption is just wrong. The downstream side is the one with the beefy power requirements and the Pi was designed to have little power.
So the Pi in some cases is expected to provide (some) 5V of power to the printer for the device stack to work and to recognize the connection. If the printer board is otherwise turned off then the Pi tries to sink power over that cable to the printer. What printer manufacturers should do is to consider the possibility of something plugged into the Type B port as accidentally back-powering their board, detect this and to provide circuitry to prevent it. They don't.
In some cases, both Pi and printer are powered and yet that 5V from the Pi is traveling over the serial cable and then to ground on the printer side. In circuit design, this is expected to happen but the printer board manufacturer should make sure that the resistance to ground is so high that the current is limited. But again, they don't.
I've just sent in a query to Adafruit to ask them to source or make a serial cable for this purpose with manual and/or programmable inline 5V switch.
Note that the Pi4B has yet another bus arrangement and drivers and is different from all predecessors. The author at uhubctl has recently indicated that somebody (Raspberry Pi Foundation?) has a patch that could allow him to test a fix within his code.
Regarding your own script(s) that you used, I'd recommend adding an entry to /etc/sudoers.d so that the Pi user can run your sudo'd commands without a password. So your script would be called with sudo myscript, you'd remove the individual sudo commands out of your script and adjust to full paths and then OctoPrint could control them.