Relay trigger on M81 G-Code instruction

Dear,

I am looking for the solution to stop the printer by deactivating the GPIO output (printer ON/OFF relay) on the M81 instruction of my end-of-print G-Code.
Is there a solution?

Thanks in advance for your help.

Regards
Laurent

Comments

  • M81 is a firmware command to disable main power if the printer firmware is configured for it.
    So solution depends on where the gpio pin is - on printer board, then you need to change firmware to implement it.
    If it is a raspberry pi go to global settings->gpio and you can define a switch. It will also show a gcode command to trigger the switch and if you add it to menu it will appear as switch in the gui as well. See gpio description in manual on in docs on our homepage.
  • Dear,

    I use a GPIO output from my Rock PI4, which allows me to start and stop the printer, however I would like to stop it automatically at the end of printing using M81 or another instruction in my end G-Code.
    I tried to add in the end G-Code of the Cura slicer the instruction "@gpio onoffRelay off" but it doesn't work.
    Below is my output configuration for turning the printer on and off.

    Ouput configuration for Rock PI4 (work in manual with Menu):
         - Name : onoffRelay
         - Function : Set output on/off
         - GPIO Pin : 146
         - G-Code to trigger: ;@gpio onoffRelay on|off|toggle
         - Show in Menu : Selected

    Thanks in advance for your help.

    Regards
    Laurent


  • Does it work in the gui when you switch there? So far I had only tested it with raspberry where pin numbers are BCM numbers 1-40. But BCM is the chip used by raspberry and rock chip use different chip, so not sure what numbering they use that would be usable here. How did you come to think it's pin 146? Is there some documentation about the gpio for your board?
  • Dear,

    The on/off relay works fine from the printer menu.
    I found the pin number information in the Rockpi4 documentation (below the pin number link)
    https://wiki.radxa.com/Rockpi4/hardware/gpio
    I did another test using "Printer Settings", "G-Codes", "Button Command" and "Power Off" by filling it in as is:
    Default G-Code: M81
    Use this instead: @gpio onoffRelay off
    I thought it could run the server command that would stop the printer but without success.

    Regards
    Laurent

  • You are right that you can use the button commands to make server send other gcodes for power on/off. This does not change M80/M81 it just send the other command if you hit th epower switch in our gui.

    Please check in console if manual sending
    @gpio onoffRelay off
    @gpio onoffRelay on

    do what supposed. Since it works in menu I think so, so you just need to make sure the command gets executed at the right time.
    If you have it in your end gcode (M81) you need to replace it there with
    @gpio onoffRelay off

    or add a replacement rule
    ^M81\b
    to be replaced by
    @gpio onoffRelay off

    From what you write I guess you have the M81 in the gcode not the server command it self.

Sign In or Register to comment.