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

    Macro: Execute python script on Rpi

    Scheduled Pinned Locked Moved
    3D Printing General Chat
    3
    6
    495
    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.
    • jontek2undefined
      jontek2
      last edited by

      Hey!

      I'd like to be able to execute a python script on an Rpi. The Rpi is not connected to the duet board.

      Any ideas?

      1 Reply Last reply Reply Quote 0
      • t0biasundefined
        t0bias
        last edited by

        This is how I have done it:

        • Connect any unused Output of the Duet with one of the GPIOs of your Pi alongside with a GND connection (optionally use a opto-coupler for the GPIO connection for power isolation).
        • Use a Macro on the Duet using the M42 command to switch the pin on the Duet-side high/low.
        • Watch the GPIO-pin from within your python script for change.
        1 Reply Last reply Reply Quote 0
        • t0biasundefined
          t0bias
          last edited by

          In case you cannot physically connect the Rpi to the Duet for whatever reason you could use something like this https://coptonix.com/products/lan-i2c-adapter-ms/
          and send a I2C-request from the Duet to the Pi via Ethernet.

          1 Reply Last reply Reply Quote 0
          • jontek2undefined
            jontek2
            last edited by

            Thanks for the replys!

            I'd really like it to be completly wireless.

            Does the Macro-functionality support API-calls or anything like that? Or is it just g-code?

            1 Reply Last reply Reply Quote 0
            • t0biasundefined
              t0bias
              last edited by

              As far as I am aware, it can only do G-Code since it's basically just a list of G-Code commands executed in sequence.

              Two more ideas which, however, are probably still not exactly what you are looking for:

              1. Use a minimal Microcontroller powered off the Duet like an Arduino or even better a Bare Microcontroller with a WiFi Shield or something like that to monitor a Level-change on some pin and send out a notification to your Pi

              2. Use a Serial/UART to WiFi Bridge and read the serial data from the Duet using the Pi.

              Let me know if you find some other solution to your question, I'd be very interested in hearing about it..! 😉

              1 Reply Last reply Reply Quote 0
              • tooundefined
                too
                last edited by

                depending on what board and version you are running, you can do it with this handy extension:
                https://forum.duet3d.com/topic/13194/dsf-extension-exec-on-mcode-was-shutdown-sbc

                Cartesian Duet3+Raspberry pi 4 with 5x 1XD using servo drives printing mortars and concrete

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