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

    Duet 3D and Raspberry Pi connection

    Scheduled Pinned Locked Moved
    Firmware installation
    7
    27
    5.1k
    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.
    • dc42undefined
      dc42 administrators
      last edited by

      Yes it would upload to the SD card. You would then need to send a GCode command to print the file you just uploaded.

      Duet WiFi hardware designer and firmware engineer
      Please do not ask me for Duet support via PM or email, use the forum
      http://www.escher3d.com, https://miscsolutions.wordpress.com

      1 Reply Last reply Reply Quote 0
      • blandifiedundefined
        blandified
        last edited by

        @dc42:

        Yes it would upload to the SD card. You would then need to send a GCode command to print the file you just uploaded.

        Thank you very much! We are done with the first draft of the GUI and how it will send the gcode file to the Duet's SD card.

        Here's another challenge: So the Rpi and the Duet are connected via Ethernet. How does the DWC factor in? Do we need to do some installing/setting up or will the Duet and Rpi automatically connect via the DWC?

        Thanks!

        1 Reply Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators
          last edited by

          DWC runs in the web browser, so in your setup using a RPi you would need to replicate whatever DWC functions you want to use on the RPi, for example in Octoprint.

          Duet WiFi hardware designer and firmware engineer
          Please do not ask me for Duet support via PM or email, use the forum
          http://www.escher3d.com, https://miscsolutions.wordpress.com

          1 Reply Last reply Reply Quote 0
          • blandifiedundefined
            blandified
            last edited by

            @dc42:

            DWC runs in the web browser, so in your setup using a RPi you would need to replicate whatever DWC functions you want to use on the RPi, for example in Octoprint.

            Thanks for the speedy response! We might end up switching to Raspian due to somethings coming up with the GUI, just wanted to check that the process would be the same 🙂 Any idea on this? Thanks in advance!

            1 Reply Last reply Reply Quote 0
            • kazolarundefined
              kazolar
              last edited by

              I am using RPi to monitor print progress as I keep print progress updated in a sql database from each of my printers – and others are updated via octoprint -- I have a process which sends commands to DWC via http requests (basically a REST api) and get back a json object with all the information I'd need to build a full fledged UI, I only take the information I need to get progress, and estimation to completion as that's all I display on a rolling ticker LCD which shows progress of all print jobs. There are a handful of supported commands which are documented in DWC, some give more information than others, you can also execute gcode commands if necessary.

              1 Reply Last reply Reply Quote 0
              • blandifiedundefined
                blandified
                last edited by

                @kazolar:

                I am using RPi to monitor print progress as I keep print progress updated in a sql database from each of my printers – and others are updated via octoprint -- I have a process which sends commands to DWC via http requests (basically a REST api) and get back a json object with all the information I'd need to build a full fledged UI, I only take the information I need to get progress, and estimation to completion as that's all I display on a rolling ticker LCD which shows progress of all print jobs. There are a handful of supported commands which are documented in DWC, some give more information than others, you can also execute gcode commands if necessary.

                If I can pick you brain real quick: We have an Rpi3 running Raspbian and want to connect to Duet using ethernet and send HTTP requests to send gcode and print. Do we connect using the DWC? If so, how do we get DWC on the Rpi? Do we treat the Rpi like a computer and access it that way?

                1 Reply Last reply Reply Quote 0
                • Danalundefined
                  Danal
                  last edited by

                  The very best thing to do is look at DWC on Github for examples.

                  There was a topic in a different forum discussion about having a "multi printer" monitor, and, by looking at DWC, I was able to have a draft in a day, and a workable product in about three. With only a couple of hours per day. And having never looked at DWC before.

                  This is in no way a brag on me. I'm medium skilled web person at best.

                  It is pointing out how much can be done, and how quickly, through the existing APIs, and how much those APIs can be understood by looking at functions in DWC.

                  Delta / Kossel printer fanatic

                  1 Reply Last reply Reply Quote 0
                  • T3P3Tonyundefined
                    T3P3Tony administrators
                    last edited by

                    @blandified:

                    If I can pick you brain real quick: We have an Rpi3 running Raspbian and want to connect to Duet using ethernet and send HTTP requests to send gcode and print. Do we connect using the DWC? If so, how do we get DWC on the Rpi? Do we treat the Rpi like a computer and access it that way?

                    If you are connecting to the Duet and sending http from.another application (like some software you are running in the Raspi), rather than a web browser, then you can send http request formatted in the same.way as DWC formats http requests.

                    Look at the DWC github readme:

                    https://github.com/chrishamm/DuetWebControl/blob/master/README.md

                    You will see commands like:

                    [[language]]
                    rr_gcode?gcode=XXX
                    
                    

                    To send a gcode. It's worth reading that whole readme as it explains how to establish a session and gives some examples.of the AJAX that the Duet returns.

                    www.duet3d.com

                    1 Reply Last reply Reply Quote 0
                    • kazolarundefined
                      kazolar
                      last edited by

                      I send
                      rr_status?type=[1-3]

                      depending on what I want to get from duet

                      so let's say your duet address is 192.168.0.100 you'd send an http request
                      http://192.168.0.100/rr_status?type=1

                      and you'll get back a json payload and you then read it into your app and display it as you see fit.

                      treat the duet as you'd treat any REST host – you send commands to the DWC from the Pi and get back information.
                      You can do that inside a web app, a python script, or a Java web service as I am doing.

                      1 Reply Last reply Reply Quote 0
                      • blandifiedundefined
                        blandified
                        last edited by

                        @dc42:

                        DWC runs in the web browser, so in your setup using a RPi you would need to replicate whatever DWC functions you want to use on the RPi, for example in Octoprint.

                        Hey dc42, we are having trouble with using "rr_upload?name=XXX&time=YYY."

                        Using a web browser on the Rpi, we are able to use "rr_gcode?gcode=XXX" to select the gcode file and print it out, but this only works on a gcode file that is already on the SD card.

                        Example:

                        _> [IP address of Duet]/rr_gcode?gcode=M23 [filename].gcode

                        [IP address of Duet]/rr_gcode?gcode=M24_

                        But once again, this only works with gcode files that are already on the SD.

                        When we try to use the rr_upload, we don't know how to specify the gcode file that needs to be uploaded:

                        So looking at the HTTP command:

                        > rr_upload?name=XXX&time=YYY

                        According to the documentation, XXX is the folder we want to save the gcode file to, so here:

                        > rr_upload?name=gcodes/[filename].gcode

                        However, how do we SELECT the gcode we want to upload TO that folder?

                        So say we have a gcode file "zTest.gcode" that is on the Rpi and we want to send that gcode file to the SD card.

                        How do we do this?

                        1 Reply Last reply Reply Quote 0
                        • Danalundefined
                          Danal
                          last edited by

                          You can't use a browser to upload, because a browser does a "get" request with what you type into the address bar.

                          The "rr_upload…" has to be a "post" request. The direct answer to your question "Which file is sent" is "the file you encode and send in the post request".

                          See https://github.com/chrishamm/DuetWebControl/blob/master/core/js/upload.js for details.

                          Delta / Kossel printer fanatic

                          1 Reply Last reply Reply Quote 0
                          • blandifiedundefined
                            blandified
                            last edited by

                            @Danal:

                            You can't use a browser to upload, because a browser does a "get" request with what you type into the address bar.

                            The "rr_upload…" has to be a "post" request. The direct answer to your question "Which file is sent" is "the file you encode and send in the post request".

                            See https://github.com/chrishamm/DuetWebControl/blob/master/core/js/upload.js for details.

                            EDIT: I have completely redone this post

                            Thank you for your help in this manner.

                            So the rr_upload is a POST request, but this can't really be done in the browser because the browser only does GET requests.

                            So we must use python to run this rr_upload command, do we need to specify it in python to be a POST?

                            And I would like to clarify, if you don't mind and when it's convenient for you, how do we encode the file and send in the POST request?

                            Thank you in advance!

                            1 Reply Last reply Reply Quote 0
                            • blandifiedundefined
                              blandified
                              last edited by

                              @dc42:

                              DWC runs in the web browser, so in your setup using a RPi you would need to replicate whatever DWC functions you want to use on the RPi, for example in Octoprint.

                              Hey dc42, hope you're doing well.

                              Would this example of python and http POST requests be what we are looking for?

                              url = '[Duet_IP_Address]/rr_upload?name=gcodes/[filename].gcode'
                              files = {'file': open('[filename].gcode', 'rb')}
                              values = {'author': 'John Smith'}
                              r = requests.post(url, files=files, data=values)

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