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.
    • blandifiedundefined
      blandified
      last edited by

      Hello,

      I am building a custom GUI on Raspberry Pi and need it to communicate with the Duet Ethernet. How can I send specific data such as motor control and temperature readings from the Duet to the Raspberry Pi? I want to fully read information and control the Duet using my custom Raspberry Pi GUI. Would connecting through either Ethernet, USB or pins work?

      All the help is appreciated.

      Thanks!

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

        You can have the RPi send M408 command to the Duet (by USB or HTTP) to get the full status.

        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
        • fmaundefined
          fma
          last edited by

          @blandified, do you plan to release your RPi-based GUI as free software?

          Frédéric

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

            @blandified:

            Hello,

            I am building a custom GUI on Raspberry Pi and need it to communicate with the Duet Ethernet. How can I send specific data such as motor control and temperature readings from the Duet to the Raspberry Pi? I want to fully read information and control the Duet using my custom Raspberry Pi GUI. Would connecting through either Ethernet, USB or pins work?

            All the help is appreciated.

            Thanks!

            You might find it easiest to connect over the network then you can use all the http requests that Duet Web Control uses:

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

            www.duet3d.com

            1 Reply Last reply Reply Quote 0
            • EasyTargetundefined
              EasyTarget
              last edited by

              @blandified, (T3P3Tony: My thoughts too).. If you do not want a serial connection then you may want to look at the http requests (including gcode commands) you can send to the firmware. See the readme at https://github.com/chrishamm/DuetWebControl and beyond.

              Otherwise use a USB serial link in the normal manner; I toyed with the idea of using the UARTs on both the Pi and Duet to make a low-level serial link via the gpio ports, but it seemed like an awful lot of effort for marginal benefit.

              Edit: Ninja'd

              Disaster? The original Printeye is dying with RRF 3.5 (M208 depreciated).
              PrintPy2024 to the rescue!
              MicroPython based; with simple wiring and and no custom PCB.

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

                @dc42:

                You can have the RPi send M408 command to the Duet (by USB or HTTP) to get the full status.

                Thank you for input! Just to clarify, HTTP means ethernet connection, correct?

                We were reading somewhere that ethernet might be the better connection between the Rpi and Duet because we would have more access to sending more commands. Would USB be lacking in any way on what communication can happen?

                We essentially plan to have the SD card (with the gcode file of what we want to print) inserted into the Rpi, and then the Rpi through a GUI will send that gcode file to the Duet.

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

                  @fma:

                  @blandified, do you plan to release your RPi-based GUI as free software?

                  As for now, the Rpi GUI is just for us due to possible legal reasons, but if everything goes smoothly we would like to open source it as free software. Do you have any experience with this?

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

                    @T3P3Tony:

                    @blandified:

                    Hello,

                    I am building a custom GUI on Raspberry Pi and need it to communicate with the Duet Ethernet. How can I send specific data such as motor control and temperature readings from the Duet to the Raspberry Pi? I want to fully read information and control the Duet using my custom Raspberry Pi GUI. Would connecting through either Ethernet, USB or pins work?

                    All the help is appreciated.

                    Thanks!

                    You might find it easiest to connect over the network then you can use all the http requests that Duet Web Control uses:

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

                    We are leaning towards the ethernet/HTTP due to the reason you listed above!

                    For the link that you posted, are these the only HTTP commands or can we build our own?

                    Thanks!

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

                      @EasyTarget:

                      @blandified, (T3P3Tony: My thoughts too).. If you do not want a serial connection then you may want to look at the http requests (including gcode commands) you can send to the firmware. See the readme at https://github.com/chrishamm/DuetWebControl and beyond.

                      Otherwise use a USB serial link in the normal manner; I toyed with the idea of using the UARTs on both the Pi and Duet to make a low-level serial link via the gpio ports, but it seemed like an awful lot of effort for marginal benefit.

                      Edit: Ninja'd

                      Thank you for the input!

                      One thing that just now came to our minds:

                      So the DuetWebControl software is the communication link between the web interface and the Duet board. Does this mean that we download the DuetWebControl software onto the Rpi to allow communication between the Rpi and Duet board through ethernet? (Since we will be using the Rpi instead of the web interface)

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

                        The Duet Web Control does not need to be loaded onto your Pi. Whatever GUI you write on your Pi needs to make the same calls. The calls are so simple they can be made from a browser. Or Curl. Or whatever.

                        Example, from a browser: (Click to enlarge)

                        Second example, from command line:

                        curl http://192.168.86.110/rr_status?type=3
                        {"status":"I","coords":{"axesHomed":[0,0,0],"extr":[0.0],"xyz":[0.000,0.000,625.246]},"currentTool":0,"params":{"atxPower":0,"fanPercent":[0.00,100.00,50.00,0.00,0.00,0.00,0.00,0.00,0.00],"speedFactor":100.00,"extrFactors":[100.00],"babystep":0.000},"seq":6,"sensors":{"probeValue":1000,"fanRPM":0},"temps":{"current":[2000.0,2000.0,2000.0,2000.0,2000.0,2000.0,2000.0,2000.0],"state":[0,3,0,0,0,0,0,0],"heads":{"current":[2000.0],"active":[0.0],"standby":[0.0],"state":[3]},"tools":{"active":[[0.0]],"standby":[[0.0]]},"extra":[{"name":"MCU","temp":41.6}]},"time":53212.2,"currentLayer":0,"currentLayerTime":0.0,"extrRaw":[0.0],"fractionPrinted":0.0,"firstLayerDuration":0.0,"firstLayerHeight":0.00,"printDuration":0.0,"warmUpDuration":0.0,"timesLeft":{"file":0.0,"filament":0.0,"layer":0.0}}

                        Any piece of code that can send and receive HTTP can interact with the Duet, completely replacing the DWC http/css/js with whatever you code.

                        Delta / Kossel printer fanatic

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

                          Another command line example:

                          curl http://192.168.86.110/rr_filelist?dir=sys
                          {"dir":"sys","files":[{"type":"f","name":"bed.g","size":1709,"date":"2017-08-14T16:56:09"},{"type":"f","name":"cancel.g","size":59,"date":"2017-08-14T17:00:18"},{"type":"f","name":"config.g","size":3857,"date":"2018-02-15T08:55:06"},{"type":"f","name":"DuetWiFiServer.bin","size":245264,"date":"2017-11-06T13:50:22"},{"type":"f","name":"homedelta.g","size":743,"date":"2017-08-14T17:08:09"},{"type":"f","name":"iap.bin","size":60904,"date":"2017-08-15T09:07:10"},{"type":"f","name":"iap4e.bin","size":61424,"date":"2017-11-06T14:22:10"},{"type":"f","name":"pause.g","size":221,"date":"2017-08-14T16:32:10"},{"type":"f","name":"resume.g","size":206,"date":"2017-08-14T16:30:26"},{"type":"f","name":"sleep.g","size":54,"date":"2017-08-14T16:27:02"},{"type":"f","name":"stop.g","size":86,"date":"2017-08-14T16:27:02"},{"type":"f","name":"tfree0.g","size":136,"date":"2017-08-14T16:27:02"},{"type":"f","name":"tpost0.g","size":196,"date":"2017-08-14T16:27:02"},{"type":"f","name":"tpre0.g","size":139,"date":"2017-08-14T16:27:02"},{"type":"f","name":"config.g.bak","size":3844,"date":"2018-02-15T08:44:10"}]}

                          Delta / Kossel printer fanatic

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

                            Oh, and you can certainly have your Gcode file on the Pi, and feed it one command at a time over the network to the Duet. With

                            rr_gcode?gcode=XXX

                            However, since the Duet has a file upload facility, and can print from that uploaded file residing on its own SD card, sending the file in pieces from the Pi certainly seems like "re inventing the wheel" and a serious step backwards in reliability.

                            🙂

                            Delta / Kossel printer fanatic

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

                              In fact, I'm a little curious what the real role of the Pi will be in your proposed design.

                              When you say "building a custom GUI on the Pi", building in what? Will it run on the Pi and display on the Pi's physical console, the HDMI connection? If so, in what languages or "tech stack"?

                              Or does it work some other way? Does the Pi talk to a browser?

                              What is the "overall flow" intended?

                              Delta / Kossel printer fanatic

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

                                @Danal:

                                Oh, and you can certainly have your Gcode file on the Pi, and feed it one command at a time over the network to the Duet. With

                                rr_gcode?gcode=XXX

                                However, since the Duet has a file upload facility, and can print from that uploaded file residing on its own SD card, sending the file in pieces from the Pi certainly seems like "re inventing the wheel" and a serious step backwards in reliability.

                                🙂

                                1.) We are using the Rpi to allow a HD touchscreen and further expansion of the project (paneldue is too low resolution and not many options for customization).

                                2.) We are building the GUI with Python. It will be running on the Rpi and the touchscreen will be connected via HDMI.

                                3.) The Rpi will be talking to the Duet via ethernet (potentially octoprint). We might also use HTTP protocol client to send and request info to the Duet USING the GUI.

                                So just to summarize our plan: The Duet is connected to the Rpi using ethernet and the Rpi is connected to our touchscreen. The touchscreen will display the GUI and also have the accessible SD card slot.

                                To clarify, the HTTP command "rr_gcode?gcode=XXX" only passes 1 gcode command at a time? So say we have the gcode on a SD card on the Rpi's touchscreen, can we use the HTTP command "rr_upload?name=XXX&time=YYY" to pass the whole gcode file to the Duet?

                                So… say we have this line of pseudocode HTTP commands sent from the Rpi to the Duet:

                                host = 192.xxx.xxx.xx // address for the the duet
                                sendfile = "rr_upload?name=XXX&time=YYY" // specify the gcode file to send
                                send(host, sendfile) // send the entire gcode file to the duet

                                If this is the case, where exactly on the Duet does this gcode file go? The onboard SD card?

                                Thank you in advance!

                                1 Reply Last reply Reply Quote 0
                                • 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
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA