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

Duet Buddy - a proof of concept remote monitor

Scheduled Pinned Locked Moved
General Discussion
19
85
8.0k
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.
  • undefined
    richardmckenna @zapta
    last edited by 3 Feb 2020, 17:05

    @zapta not sure about standalone mode duet3 but I don't think it will work with duet3 + pi as DSF has a new REST API so it would be a GET at http://{{RASP_PI_IP}}/machine/status.

    Also not sure if the JSON model that is returned has changed from the old version. I will see what it returns tonight if no one else has by the time I get to it 🙂

    undefined undefined 2 Replies Last reply 3 Feb 2020, 17:21 Reply Quote 0
    • undefined
      zapta @richardmckenna
      last edited by 3 Feb 2020, 17:21

      @richardmckenna, shouldn't be too difficult to handle the difference. The duet buddy reads its configuration from an SD card so instead of the duet IP it can read the full duet status URL. As for json field names, if they changed, should be difficult to select an alternative parsing.

      This is the current duet status parser logic. It's straight forward and can be easily adapted to pick whatever fields.

      https://github.com/zapta/misc/blob/master/duet3d_buddy/arduino/duet_parser.cpp

      1 Reply Last reply Reply Quote 0
      • undefined
        Danal @zapta
        last edited by 3 Feb 2020, 17:46

        @zapta said in Duet Buddy - a proof of concept remote monitor:

        @tobias_munich said in Duet Buddy - a proof of concept remote monitor:

        @zapta is it working with the DUET3 & RRF3?

        Didn't tested it with duet3 and RRF3 (I have neither) but it it doesn't work, a small change should fix it.

        The duet buddy polls the printer at the URL below with xx.xx.xx.xx representing the IP address of the printer.

        http://xx.xx.xx.xx/rr_status?type=3

        It expect to get back a json document with the printer status and then extract a few values such as progress, temp and z height. You can try it manually from a browser and see if you get a json doc. If you will post it here, I can text if the existing firmware will parse it correctly.

        If you look at DWC2, it contains a javascript module that figures out whether the printer is using HTTP Polling or using WebSockets, connects, and then handles future requests in an abstract way. Shouldn't be too hard to reproduce this in the M5stack device. That would allow it to connect to either old or new very easily.

        Delta / Kossel printer fanatic

        undefined 1 Reply Last reply 4 Feb 2020, 04:17 Reply Quote 0
        • undefined
          zapta @Danal
          last edited by zapta 2 Apr 2020, 04:18 4 Feb 2020, 04:17

          @Danal, that makes sense. I already change the format of the configuration to allow specification of full url. The determination of the protocol can be added as an automatic logic or a user configured flag. This platform is very flexible.

          https://github.com/zapta/misc/blob/master/duet3d_buddy/arduino/arduino.ino#L9

          Edit: the 'type=3' in the URL has nothing to do with RRF3.

          1 Reply Last reply Reply Quote 0
          • undefined
            tobias_munich @richardmckenna
            last edited by 4 Feb 2020, 08:23

            @richardmckenna @zapta
            this is the output from the standalone version.

            {"status":"I","coords":{"axesHomed":[1,1,1],"wpl":1,"xyz":[15.000,0.000,4.850],"machine":[15.000,0.000,4.850],"extr":[0.0]},"speeds":{"requested":0.0,"top":0.0},"currentTool":-1,"params":{"atxPower":-1,"fanPercent":[0,100],"speedFactor":100.0,"extrFactors":[100.0],"babystep":0.000},"seq":1,"sensors":{"probeValue":0,"fanRPM":[-1,-1]},"temps":{"bed":{"current":24.2,"active":0.0,"standby":0.0,"state":0,"heater":0},"current":[24.2,23.4],"state":[0,0],"tools":{"active":[[0.0]],"standby":[[0.0]]},"extra":[{"name":"*MCU-Temp","temp":48.0},{"name":"*Chamber Temp","temp":28.3},{"name":"*Chamber Hum[%]","temp":28.3}]},"time":149.0,"currentLayer":0,"currentLayerTime":0.0,"extrRaw":[0.0],"fractionPrinted":0.0,"filePosition":0,"firstLayerDuration":0.0,"firstLayerHeight":0.00,"printDuration":0.0,"warmUpDuration":0.0,"timesLeft":{"file":0.0,"filament":0.0,"layer":0.0}}

            Hypercube-Evolution, Dual-Z, Nimble v2, Orion Piezo
            Duet3, DuetWifi, Raspberry Pi 4, 7 inch HDMI Display, Panel-Due
            Firmware: RepRapFirmware for Duet 3 MB6HC 'always the latest release'

            1 Reply Last reply Reply Quote 0
            • undefined
              Danal
              last edited by Danal 2 Apr 2020, 16:19 4 Feb 2020, 16:17

              If you don't need to full two way interface... There is a way to get status (only) from a Duet3/RRF3 with HTTP only (no socket needed). Here is a Python example that returns a JSON object of "Current Position" from either 2 or 3 via auto-detection:

              # Python Script to return JSON object of current position from a Duet printer
              # Auto-detects RRF2 vs RRF3 protocol
              #
              # Copyright (C) 2020 Danal Estes all rights reserved.
              # Released under The MIT License. Full text available via https://opensource.org/licenses/MIT
              #
              import requests
              import json
              import sys
              endpoint2='/rr_status?type=1' # RRF2 request
              endpoint3='/machine/status' # RRF3 request
              endpointA=endpoint2 # Active
              def getCoords(base_url):
              global endpointA
              if (endpointA == endpoint2):
              try:
              r = requests.get(f'{base_url}{endpointA}')
              j=json.loads(r.text)
              jc=j['coords']['xyz']
              ret=json.loads('{}')
              for i in range(0,len(jc)):
              ret[ 'xyz'[i] ] = jc[i]
              return(ret)
              except:
              endpointA = endpoint3
              if (endpointA == endpoint3):
              try:
              r = requests.get(f'{base_url}{endpointA}')
              j=json.loads(r.text)
              ja=j['result']['move']['axes']
              jd=j['result']['move']['drives']
              ad=json.loads('{}')
              for i in range(0,len(ja)):
              ad[ ja[i]['letter'] ] = ja[i]['drives'][0]
              ret=json.loads('{}')
              for i in range(0,len(ja)):
              ret[ ja[i]['letter'] ] = jd[i]['position']
              return(ret)
              except:
              print(base_url," does not appear to be a RRF2 or RRF3 printer", file=sys.stderr)
              raise
              # Test cases
              print(getCoords('http://192.168.7.100'))
              print(getCoords('http://127.0.0.1'))
              print(getCoords('http://192.168.7.101'))

              And example output:

              {'x': 0.0, 'y': 0.0, 'z': 626.751}
              {'X': 271.4, 'Y': 341.1, 'Z': 5.7, 'U': 0}
              {'X': 271.4, 'Y': 341.1, 'Z': 5.7, 'U': 0}

              Delta / Kossel printer fanatic

              undefined 1 Reply Last reply 4 Feb 2020, 16:36 Reply Quote 2
              • undefined
                zapta @Danal
                last edited by 4 Feb 2020, 16:36

                Thanks Danal. I am currently using '/rr_status?type=3' but this can be configured in the M5Stack SD card config file to any url. Picked =3 because this is what my DWC keeps polling.

                Currently the response parser looks for these json fields:
                status, fractionPrinted, coords.xyz[2], temps.current[0] and temps.current[1]. If RRF3 has them then it work with no change. Otherwise, adding them to the parser should be easy.

                Response parser is straight forward and anybody make changes for RRF3 please send me a pull request.

                https://github.com/zapta/misc/blob/master/duet3d_buddy/arduino/duet_parser.cpp

                1 Reply Last reply Reply Quote 1
                • undefined
                  bricor @zapta
                  last edited by bricor 2 Jun 2020, 03:21 6 Feb 2020, 03:11

                  @zapta I just set one up. Fairly straight forward, Monitoring a print job as I'm typing this. I may have missed it, is there a way to program the buttons to pause or stop the current job or does it only monitor the printer (one way device)? Thank you, it's a neat little device.

                  IMG_9303.jpg

                  undefined 1 Reply Last reply 6 Feb 2020, 03:30 Reply Quote 0
                  • undefined
                    zapta @bricor
                    last edited by zapta 2 Jun 2020, 03:32 6 Feb 2020, 03:30

                    @bricor, awesome!!!

                    Currently the buttons are not used but shouldn't be too difficult for any with some programming experience to program them to do things, for example, sending gcode commands to the printer.

                    Here is a challenge, the first person that will program a button to send any command to the duet will the respect of the community and an amazon gift card of $25 (e.g. for a spool of filament). Challenge closes April 30. Please report your success here and ping me.

                    undefined 1 Reply Last reply 6 Feb 2020, 03:50 Reply Quote 3
                    • undefined
                      bricor @zapta
                      last edited by bricor 2 Jun 2020, 03:51 6 Feb 2020, 03:50

                      @zapta I really apprecite the effort. I could only imagine what it took to put this together. For me, it was a challenge to put the bits and pieces in place to go from plugging in the usb cable to having a functioning device. Not difficult, but a challenge. I hope to figure out what you did here and the whole c programming stuff. Need to be able to toggle between machines (ip addresses) as well

                      undefined 1 Reply Last reply 6 Feb 2020, 04:50 Reply Quote 0
                      • undefined
                        zapta @bricor
                        last edited by 6 Feb 2020, 04:50

                        @bricor, I plan to look for ways to simplify the deployment for people that don't want to deal with Arduino. M5Stack has a software tool called M5Burner and another option is to use the esptool program directly. Need to figure those out or possibly somebody here can come with a simple recipe to 'burn' the Duet Buddy firmware.

                        undefined 1 Reply Last reply 6 Feb 2020, 06:01 Reply Quote 0
                        • undefined
                          bricor @zapta
                          last edited by 6 Feb 2020, 06:01

                          @zapta I should’ve said fun challenge. Rewarding type

                          1 Reply Last reply Reply Quote 0
                          • undefined
                            richardmckenna
                            last edited by 6 Feb 2020, 10:21

                            dammit!!! you guys have just made, nay, forced me to buy this!. Grrrrrr

                            M5Stack and Battery module on their way.

                            1 Reply Last reply Reply Quote 0
                            • undefined
                              tekkydave
                              last edited by 6 Feb 2020, 10:25

                              I have one on order from Bangood. Ordered the Grey one at £29.53 as it has the motion sensor built in.

                              ~ tekkydave ~
                              D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
                              FreeCAD, PrusaSlicer

                              undefined undefined 2 Replies Last reply 6 Feb 2020, 10:28 Reply Quote 0
                              • undefined
                                jay_s_uk @tekkydave
                                last edited by 6 Feb 2020, 10:28

                                I ordered the grey one too from aliexpress for £28.51.
                                Still waiting for it to get dispatched due to the "extended" chinese new year.
                                Sounds as though that won't happen till around the 18/02

                                Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                1 Reply Last reply Reply Quote 0
                                • undefined
                                  richardmckenna @tekkydave
                                  last edited by 6 Feb 2020, 10:28

                                  @tekkydave ah I went with this one https://www.amazon.co.uk/MakerHawk-Development-Bluetooth-Expandable-Compatible/dp/B07M71ZG6N which has the built in MPU9250 - £13 more but I get it tomorrow 🙂

                                  undefined 1 Reply Last reply 6 Feb 2020, 10:29 Reply Quote 0
                                  • undefined
                                    jay_s_uk @richardmckenna
                                    last edited by 6 Feb 2020, 10:29

                                    @richardmckenna thats the grey one

                                    Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                    undefined 1 Reply Last reply 6 Feb 2020, 17:34 Reply Quote 1
                                    • undefined
                                      zapta @jay_s_uk
                                      last edited by 6 Feb 2020, 17:34

                                      The github repository has now a script to download the firmware to a M5Stack Core. For now it's only for windows but writing a similar shell script for Mac or Linux should be easy.

                                      With this script, the Arduino IDE is not needed anymore (unless if you want to make code changes) and it just requires the Silicon Labs USB/Serial driver (available at m5stack.com and silabs.com).

                                      https://github.com/zapta/misc/tree/master/duet3d_buddy/release

                                      Please let me know howit works and feel free to send me pull requests.

                                      1 Reply Last reply Reply Quote 0
                                      • undefined
                                        tekkydave
                                        last edited by 6 Feb 2020, 17:42

                                        It's arrived 🙂
                                        2020-02-06 17.00.59.jpg
                                        2020-02-06 17.02.18.jpg
                                        2020-02-06 17.01.48.jpg
                                        2020-02-06 17.01.35.jpg

                                        ~ tekkydave ~
                                        D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
                                        FreeCAD, PrusaSlicer

                                        1 Reply Last reply Reply Quote 0
                                        • undefined
                                          hayseed_byte @zapta
                                          last edited by 8 Feb 2020, 18:52

                                          Very cool project!

                                          Is there a way to do something similar but display the status of multiple printers on a computer monitor? Maybe with the use of a raspberry pi? I have nine printers that I'd like to monitor from another room but I don't want to buy nine of those. 😄

                                          https://wildbot.me/wildbot
                                          Gcode Definitions for VSCode extension: https://github.com/hayseedbyte/rrf-gcode-definitions

                                          undefined 1 Reply Last reply 8 Feb 2020, 18:54 Reply Quote 0
                                          33 out of 85
                                          • First post
                                            33/85
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA