Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    How to run gcode commands remotely on a Duet3 + RPi?

    Scheduled Pinned Locked Moved Solved
    General Discussion
    2
    4
    252
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TDKundefined
      TDK
      last edited by

      I have a Duet3 6HC board connected with a Raspberry Pi. It works, I can print files, view the web interface, etc. Is there a way I can programmatically (Python) run commands remotely on this setup? I have it set up where I can telnet into the RPi, but obviously entering gcode commands in the console doesn't work.

      I also have a Duet2 Wifi board where I can telnet into the board and just send commands to run them. I'm essentially looking for the same functionality on the Duet3 + SBC setup.

      1 Reply Last reply Reply Quote 0
      • A Former User?
        A Former User
        last edited by

        There is a phyton api if you search the forum

        and if you just want to run code from the console then on the pi do/opt/dsf/bin/CodeConsole (sudo if needed?)

        1 Reply Last reply Reply Quote 0
        • TDKundefined
          TDK
          last edited by

          Running sudo /opt/dsf/bin/CodeConsole from the console seems to work.

          Here's my code to log in using Python with the default user/pass. After this, sending commands works:

          tn = telnetlib.Telnet(printer_ip)
          print(tn.read_until(b"login: ").decode('utf=8', errors='ignore'))
          tn.write(b'pi\n')
          print(tn.read_until(b"Password: ").decode('utf=8', errors='ignore'))
          tn.write(b'raspberry\n')
          print(tn.read_until(b"$ ").decode('utf=8', errors='ignore'))
          tn.write(b'sudo /opt/dsf/bin/CodeConsole\n')
          print(tn.read_until(b"Connected!").decode('utf=8', errors='ignore'))
          
          tn.write(b'M114\n')
          sleep(1.0)
          print(tn.read_very_eager().decode('utf=8', errors='ignore'))
          
          A Former User? 1 Reply Last reply Reply Quote 0
          • A Former User?
            A Former User @TDK
            last edited by A Former User

            @TDK said in How to run gcode commands remotely on a Duet3 + RPi?:

            Running sudo /opt/dsf/bin/CodeConsole from the console seems to work.

            they've started moving away from running as root so wasn't sure if that applied to CodeConsole or not.

            you can also pipe commands for a one off echo M114 | sudo /opt/dsf/bin/CodeConsole
            (edit: you could also run the whole thing securely over ssh from another host as single command ssh pi@printer_ip "echo M114 | sudo /opt/dsf/bin/CodeConsole" (use with public key in authorized_keys (ssh-keygen and ssh-copy-id pi@printer_ip) and specify ssh -t or set up sudo on the remote host to not require password for the command in question))

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA