PSU Control: How to send M80 without connection to the board?

I don't understand how I can send the M80 gcode to the PSU Control plugin if there is no connection to the printer board, because it is powered off.
The Terminal is inactive and you can't send any gcode files.
I know that it would work if I would power the board with 5V instead of 24V, but this is no option for me.
The board of my X5SA is not powered by 5V. The BTT SKR 1.3 would allow me to power the board with 5V, but this would kill my TMC drivers. These drivers get power from the 24V and they don't like that their signal pins get 5V if the 24V is off.look here

So the only option I have is the toggle button?

Personally, I use a TP-Link SmartPlug, an IKEA KOPPLA and plug both the Pi power adapter and the printer into both. The TP-Link has a number of means of toggling that programmatically.

Otherwise, you could bring the toggling event to the Pi's GPIO, rig up a suitable relay circuit and power the printer this way.

But I've never used the PSU Control plugin. Maybe some method of doing what you're trying for is available in that.

It was my plan to use a relay to switch on the 24V psu, that is not the problem.
I am talking about the event to trigger the relay. It looks like I can't use the gcode M80 to do this, because I have no connection to the printer.

It feels like Pi-side code to me (rather than asking the printer to turn itself on with a GCODE command). You might look into the Gcode Systems Command plugin and rig up, say, an OCTO801 = /home/pi/scripts/turnOnPrinter or similar.

I know that it is PI side code. It is the Plugin that gets the M80 gcode and switches the relay on via GPIO.
But Octoprint doesn't let me send gcode at all without a connection. So the plugin will never get the gcode.

I think about to solve the problem without an octoprint plugin. I could write a small service in python that acts as a virtual serial port. It would let octoprint believe that it is attached to a powered on printer. Upon reception of M80 it would switch on the relay and passes all gcodes through to the real serial port of the printer.

That's not a terrible approach.

You might also be able to write a plugin that hooks into the serial connection. Maybe this works even when OctoPrint thinks the printer is disconnected and then you could trap that M80 there.

I started the whole thread in the hope that the PSU Control plugin would just do that already. On the github site of the plugin there is no possibility to ask this questions and I am too lazy to dig through the code to find it out myself.
My approach with the service would have the advantage to be independent of OctoPrint :wink:

The author's repository has an Issues feature. You could open up a fact-finding issue in an attempt to speak with the author.

Or you could find their username on here and then call out to them with an @ symbol followed by their username. If they frequent the forum here, then they'd be notified.

I am familiar with github, because I use it myself, but this author has his issue page not enabled, see yourself

Wow. Did not know that. I guess then we have this approach...


UPDATE: Ah, he's using a gitea (github-compatible) server on his domain name. So he's doing what I'm doing, running my own server so that I can have unlimited private repositories without paying github.

Thanks, maybe that helps.

My stuff is not so important to keep it secret. The linux kernel driver I wrote is now spread widely.

I use the scripts for system commands and I added the on/off to the header bar. GCODE commands are processed by the printer controller only, not the Pi, so unless the printer is already on, you can't use gcode to switch it on.

1 Like

This is just not true. Here you can see that the gcode command is processed by the plugin on the Pi.

@OutsourcedGuru I use GitHub for publishing public projects :slight_smile:. So that's the right place for anything related to PSUControl. I ended up disabling Issues due to people treating it like product support and not a real issue tracker.

To answer the question in this thread. You simply can't use G-Code commands (M80) when the serial port is not connected. If you want that functionality you'll have to re-work your setup to run the controller & pi on standby power and then add support in your firmware to switch on primary power.

1 Like

Thanks dude. And I know what you mean about odd issues entered by people. :+1:

As I told in my first post, that wouldn't work with some of the TMC drivers. So I have to think about the solution that I mentioned some posts above. A service that acts like a virtual printer that lets octoprint believe that there is an active connection.And this service would switch the relais.

I know this is a bit old but I thought it worth mentioning, if you are using cura as your slicer, the octoprint plugin in cura can detect when psu control is installed and theres a check box you can set to automatically trigger psu control on when you upload gcode to the pi.

If I can't send the M80 gcode if the connection is closed, then neither the plugin in cura can do it.