Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save georoen/d12a98b2b5591efa4ce5c91d38bd9d2e to your computer and use it in GitHub Desktop.
Save georoen/d12a98b2b5591efa4ce5c91d38bd9d2e to your computer and use it in GitHub Desktop.
My working notes on figuring out the Monoprice Mini Delta V2 (MPMDv2) web API

Monoprice Mini Delta V2 printer API

My in-progress documentation of the Monoprice Mini Delta V2 printer api. This is traffic captured between the included Wiibuilder application and the printer when you connect to the printer through Wiibuilder and send a gcode file to print.

GET

api/printer

api/printer during print job

{
    "sd": {
        "ready": false
    },
    "state": {
        "flags": {
            "cancelling": false,
            "closedOrError": false,
            "error": false,
            "finishing": false,
            "operational": false,
            "paused": false,
            "pausing": false,
            "printing": true,
            "ready": false,
            "resuming": false,
            "sdReady": false
        },
        "text": "Printing"
    },
    "temperature": {
        "tool0": {
            "actual": 200,
            "offset": 0,
            "target": 0
        }
    }
}
Path Value Notes
sd/ready true/false When the printer is ready to receive a file over wifi (ready for a new print job), false if the sd card is missing
state/flags/cancelling true/false Unknown; True when the printer is in the process of cancelling a job?
state/flags/closedOrError true/false Unknown
state/flags/error true/false Unknown; True when the printer is in an error state?
state/flags/finishing true/false Unknown; True when the printer is finishing a job?
state/flags/operational true/false True when the printer is on the main menu of the LCD, ready to receive/start a print job
state/flags/paused true/false True when the printer is paused
state/flags/pausing true/false Unknown; True when the printer is pausing a job?
state/flags/printing true/false True when printer is running a job, false otherwise
state/flags/ready true/false True when the printer is ready (no job), false otherwise
state/flags/resuming true/false Unknown; True when the printer is resuming a job after printing?
state/flags/sdReady true/false Same as sd/ready
state/text text State text, not what is displayed on the LCD. See "Text messages" below
temperature/tool0/actual integer Current temperature of the hot end, in C
temperature/tool0/offset integer Unknown; haven't seen anything other than 0
temperature/tool0/target integer Target temperature in C - this is set when a target temp is set on the printer screen, and doesn't clear when you start a print job (even though the target temps are different in the job)

Text messages:

  • Printing - while a print job is running
  • Finish - while the "Print Completed" screen is displayed on the printer
  • Operational - when the printer is on the main LCD menu

api/job

api/job during print:

{
    "job": {
        "file": {
            "date": 0,
            "name": "wiibuilder_pos.gcode",
            "path": "wiibuilder_pos.gcode",
            "origin": "local",
            "size": 10
        },
        "filament": {
            "length": 1939.1099853515625,
            "volume": 4.6538639068603516
        },
        "estimatedPrintTime": 2784
    },
    "progress": {
        "completion": 15,
        "filepos": 10,
        "printTime": 873,
        "printTimeLeft": 2341
    },
    "state": "Printing"
}
Path Value Notes
job/file/date Unknown Unknown, always 0
job/file/name Text Filename of file currently being printed. If transferred over wifi from Wiibuilder, it will display "wiibuilder_pos.gcode"
job/file/path Text Path of file currently being printed. If transferred over wifi from Wiibuilder, it will display "wiibuilder_pos.gcode"
job/file/origin Text Unknown; Origin of file, perhaps? Have always seen it set to local
job/file/size integer Unknown; Alway set to 10
job/filament/length float Length of filament to use, in mm. Seems to match the "FilamentUsed:749.94" comment in gcode files
job/filament/volume float Unknown
job/estimatedPrintTime integer Estimated time to complete print job, in seconds
job/progress/completion integer Print job complete percentage
job/progress/filepos integer Unknown; Always set to 10
job/progress/printTime integer Number of seconds elpased since print job start
job/progress/printTimeLeft integer Estimated number of seconds left in print job (this is not estimatedPrintTime minus printTime)
job/state text Job status text, appears to match state/text from api/printer

api/files/local

Summarize the available space on sd-card:

{
  "files": [
  {
      "date": 1656750092,
      "name": "AdapterHalter_V02.gcode",
      "origin": "local",
      "path": "AdapterHalter_V02.gcode",
      "size": 590420
    },
    {
      "date": 1656746236,
      "name": "AdapterHalter_V01.gcode",
      "origin": "local",
      "path": "AdapterHalter_V01.gcode",
      "size": 591273
    }
    ],
  "free": 7635566592,
  "total": 7980711936
}
Path Value Notes
files unkown List of files
files/0/date
files/0/name
files/0/origin
files/0/path
files/0/size
free integer Free bytes on card
total integer Available bytes on card

If no card found, free and total are 0. Attention, this happens during print; But may also happen afterwards - then you need to reboot the printer!

POSTS

/api/printer/printhead

{"command":"jog","x":0.0,"y":0.0,"z":-10.0}
{"command":"jog","x":0.0,"y":-10.0,"z":0.0}
{"command":"jog","x":-10.0,"y":0.0,"z":0.0}

Buttons to test:

  • Home, Cancel print

Transmitting a file

As seen here: https://forum.drucktipps3d.de/forum/thread/14736-mp-mini-delta-v2/?postID=191112#post191112

curl -H "X-Api-Key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -F "file=@[output_filepath]" "http://199.199.9.99/api/files/local"

... the printer returned:

{"done":"true","files":{"local":{"name":"GewindeTest_V02.gcode","origin":"local","path":"GewindeTest_V02.gcode"}}}

Transmit, select and print

curl -H "X-Api-Key: AAAAAAAAAAAAAAAAAAAA4AAAAAAAA" -F "file=@GwindeTest_Grid_m12_iso.gcode" -F "select=true" -F "print=true" "http://192.168.178.55/api/files/local"

and the printer returns:

{"done":"true","files":{"local":{"name":"GwindeTest_Grid_m12_iso.gcode","origin":"local","path":"GwindeTest_Grid_m12_iso.gcode"}}}
POST /api/files/local HTTP/1.1
X-Api-Key: 097EBEDA13A1402BB2D07505874E6414
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBHFJVxswwyoqKvCt
Host: 192.168.1.174
Content-Length: 4937590
Expect: 100-continue

------WebKitFormBoundaryBHFJVxswwyoqKvCt
Content-Disposition: form-data; name="file"; filename="wiibuilder_pos.gcode"
Content-Type:application/octet-stream

;FLAVOR:Marlin
;TIME:8156
;InfillDensity:20
;FilamentType:PLA
;FilamentUsed:4127.60
;Layer height: 0.14
;MINX:-30.626
;MINY:-24.102
;MINZ:0.32
;MAXX:26.761
;MAXY:20.135
;MAXZ:48.06
;POSTPROCESSED
;Generated with Cura_SteamEngine 4.12.1
; thumbnail begin
W221
W220 5f534a50475f5f0056312e3030008c008c00090010001d0314032b031d0321033c032c031903d702

...the rest of the gcode file...

;SETTING_3 rts = True\\nwall_thickness = 1.2\\nxy_offset_layer_0 = =xy_offset\\n
;SETTING_3 \\n"]}

------WebKitFormBoundaryBHFJVxswwyoqKvCt
Content-Disposition: form-data; name="select"

true
------WebKitFormBoundaryBHFJVxswwyoqKvCt
Content-Disposition: form-data; name="print"

true
------WebKitFormBoundaryBHFJVxswwyoqKvCt--

The printer sent back:

HTTP/1.1 201 CREATED
Content-Type: application/json;charset=utf-8
Content-Length: 112

And then a json packet:

{
    "done": "true",
    "files": {
        "local": {
            "name": "wiibuilder_pos.gcode",
            "origin": "local",
            "path": "wiibuilder_pos.gcode"
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment