I would like to be able to toggle the USB port(s) power On & Off via OctoPrint if possible.
I have a 4 relay control already wired and set up to control the printer's power, however, the Printers LCD screen stays on due to the USB connection powering it up all the time. Also, have some compact mUSB LED lighting I would also like to control via power on USB ports, instead of having to try and cut into the USB cables to use the control relays.
I do know it's possible to do outside of Octoprint, but would like to keep it simple.
My set-up is:
Pi 3 B+
4 Control Relay box (controls printer PSU)
Latest OctoPrint w/ PSU Control Plug-In
Wanhao i3 Plus 3D Printer (24v system)
ADVi3++ FW (not factory Marlin)
You could use my last posted suggestion as combined with a GCode Systems Command that you'd create a pair of new commands like OCTO912 and OCTO902. The first would turn ON USB port 2 (per the example) and the second would turn it OFF.
Next, you could edit the config.yaml for the Controls section and add a pair of buttons which point to those new OCTO commands. After a restart, OctoPrint's Control tab would have two buttons for toggling ON/OFF USB port 2 in this case.
Hey guys. I turn on an off my printer from GUI, using a relay to turn on and off the power supply, and a command line to turn off USB port. It was just simple to do.
I´ve installed a package called hub-ctrl. It controls USB power.
Step-by step was like this:
1- Downloaded the package here: https://github.com/codazoda/hub-ctrl.c
2- Copied to /tmp using WinSCP
3- Elevated privileges with sudo to get root permissions
4- Compiled the package with the following command (in the tmp folder): gcc -o hub-ctrl hub-ctrl.c -lusb
It created a file called hub-ctrl. I,ve copied that file to /usr/bin: mv hub-ctrl /usr/bin/
5- Created my scripts to power on and off the printer at /usr/local/bin/scripts/
Script to start the USB power, wait 5 seconds then activate the relay - printer_on.sh
I wasn't keen on the potential for glue from the tape fouling the port.
Interesting that you mention the driver side of things, I've not run into that issue yet and it's something that I've implemented for a number of years; Occasionally cables have been rewired to use the 5V from a discreet SMPS instead. Would that have overcome it?
You probably just leave the serial cable in at all times (like most of us).
You could wire the 5V as described to an ATX sort of power supply or switching power supply. And yet, the 5V on an ATX is always there (with a limited current) so that pretends like it's always on. As for the switching power supply, I'll note that my own wouldn't stay on if the load was too small. (It's fond of cycling ON/OFF with a too-small load.)
I’m trying to implement this with raspberry pi 3b. All works from SSH on command line, but I can’t figure out how to get Octoprint to execute the script. Trying to use system command editor. Have tried too many things to list here. When entering command as stated above I get no tty error. If I add an & like discussed in another thread, I get command executed successfully but nothing happens. Feel like this is a simple issue but I’m so new to Linux I can’t seem to work it out. A working example in system command editor plugin may help, any insight is appreciated. Thanks in advance!