Skip to content

Instantly share code, notes, and snippets.

@jaredharley
Last active September 2, 2023 14:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaredharley/31e6a05da2a2edf44c5150d839439c9b to your computer and use it in GitHub Desktop.
Save jaredharley/31e6a05da2a2edf44c5150d839439c9b 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.

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

POSTS

/api/printer/printhead

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

Buttons to test:

  • y, z, Home, Cancel print

Transmitting a file

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"
        }
    }
}
@georoen
Copy link

georoen commented Jul 1, 2022

Hey @jaredharley ,

Trying to upload a gcode I found how to summarize the available space on sd-card:

api/files/local

{
"files": [],
"free": 7635566592,
"total": 7980711936
}

Path Value Notes
files unkown Always empty?
free integer Free bytes on card
total integer Available bytes on card

If no card found, free and total are 0.

Nevertheless, I am still wondering how to upload gcode? Could you lay out the curl command to me (a curl/POST noob)?

Thank you!

@georoen
Copy link

georoen commented Jul 2, 2022

... okay. I was able to upload gcode via command line eventually, but not to start a print job yet. You can find the appended notes in the fork. Most probably though, they'll need some formatting - I am really no API / REST / JSON / Reverse-Engineering expert! Therefore, thank you @jaredharley very much for your efforts writing it down! It helped me a lot!! :)

https://gist.github.com/georoen/d12a98b2b5591efa4ce5c91d38bd9d2e

@loociano
Copy link

loociano commented Nov 4, 2022

Thanks for writing this!

I'm the author of the Cura plugin for the Mini V2 https://github.com/loociano/MPSM2NetworkPrinting. Some user reported that the plugin worked with the Mini Delta V2, however this can't be since their APIs are completely different.

@FerreiraPablo
Copy link

FerreiraPablo commented May 26, 2023

I also found that the API is really similar to the OctoPrint api. https://docs.octoprint.org/en/master/api/version.html
by using http://{{IP_ADDRESS}}/api/version you can verify the version of the API.

Edit: Is the same API some endpoints are missing because of version discrepancies, in fact it works with Cura if you use the OctoPrint Plugin.

@sgallagher
Copy link

I also found that the API is really similar to the OctoPrint api. https://docs.octoprint.org/en/master/api/version.html by using http://{{IP_ADDRESS}}/api/version you can verify the version of the API.

Edit: Is the same API some endpoints are missing because of version discrepancies, in fact it works with Cura if you use the OctoPrint Plugin.

Could you go into more detail here? How do you set up the OctoPrint plugin with the MPMDv2?

@FerreiraPablo
Copy link

I also found that the API is really similar to the OctoPrint api. https://docs.octoprint.org/en/master/api/version.html by using http://{{IP_ADDRESS}}/api/version you can verify the version of the API.
Edit: Is the same API some endpoints are missing because of version discrepancies, in fact it works with Cura if you use the OctoPrint Plugin.

Could you go into more detail here? How do you set up the OctoPrint plugin with the MPMDv2?

  1. Install this extension: OctoPrint Connection
    image

  2. Setup your printer as an Offline Printer, with the official profile available in cura for the Mini Delta V2
    image

  3. Go to your newly added printer settings and click Connect OctoPrint.
    image

  4. Setup your printer and now you should be able to print directly through Wi-Fi using the latest Cura Version.
    image

@sgallagher
Copy link

Thanks, but I guess the main thing I am at a loss about is figuring out what the API key would be.

@FerreiraPablo
Copy link

FerreiraPablo commented Jul 12, 2023

Thanks, but I guess the main thing I am at a loss about is figuring out what the API key would be.

Sorry, you can write anything. The API is unlocked locally.

But this one is hardcoded on WiiBuilder: 097EBEDA13A1402BB2D07505874E6414

But yep, whatever you write there will work anyway.

@piberry
Copy link

piberry commented Aug 8, 2023

I stumbled upon this but unfortunately it´s not working. The obvious difference is that the picture above shows version 1.5.0 while my printer is on 1.4.2. This refers to the LCD Firmware Version.
Since the wiki for the mpminideltav2 is down, i used waybackmachine to access it. Although the files there are downloadable, the minideltalcd_v1.5.0.zip is corrupt. I opened it in a text editor and found the original filename which is MiniDeltaLCD_V1.5.0_new.efm but i wasn´t able to find it on the net.
I would be happy if someone could provide the file, see point 6 of the attached picture.
image

I love that tiny machine, thanks for helpng me out!

@FerreiraPablo
Copy link

FerreiraPablo commented Aug 8, 2023

I stumbled upon this but unfortunately it´s not working. The obvious difference is that the picture above shows version 1.5.0 while my printer is on 1.4.2. This refers to the LCD Firmware Version. Since the wiki for the mpminideltav2 is down, i used waybackmachine to access it. Although the files there are downloadable, the minideltalcd_v1.5.0.zip is corrupt. I opened it in a text editor and found the original filename which is MiniDeltaLCD_V1.5.0_new.efm but i wasn´t able to find it on the net. I would be happy if someone could provide the file, see point 6 of the attached picture. image

I love that tiny machine, thanks for helpng me out!

I had the same looking for the the firmware, not even the guys monoprice support have it. But i got you!
On the facebook group you can find all firmware files.
https://www.facebook.com/groups/581769846127833/files/files

I also uploaded them to my server :
https://ferreirapablo.com/files/MonopriceMiniDeltaV2FirmwareFiles.zip

Note: You need to add the files in the same name as they are on the zip or on facebook for the printer to pick them up.

But even with that all updated i shouldn't make any difference, the API hasn't changed a lot. The same OctoPrint Plugin should work.

@piberry
Copy link

piberry commented Aug 8, 2023

Thank you so much! The printer is busy right now, i´ll try with the updated firmware tomorrow and report back.

@piberry
Copy link

piberry commented Aug 9, 2023

Seems like i´m out of luck for now...
When i try to update the LCD firmware, everything looks ok first but then the printer resets and is stuck at the monprice logo until i eventually power cycle it. After that it still shows LCD firmware 1.4.2.
When i try to connect to octoprint i get "OctoPrint responded with an unknown error" and the printer resets too.
I reformatted the sd card and downloaded the files again but no luck either.
I requested membership for the facebook group and will invest some more time next weekend.

@FerreiraPablo
Copy link

is weird, those are the exact same files I used in my printer and the same as they are in Facebook. I will check the SDcard and confirm you the file names.

@FerreiraPablo
Copy link

FerreiraPablo commented Aug 9, 2023

Extremely weird: Confirmed.
The files are the following:
flash.wfm, lcd.efm respectively:
I updated through this menu:
20230809_123629

Is the last version even if the homescreen still says there is a new version available. Nothing happens when you click the notification it just installs the files from the SD Again. (I'm using the same 8GB one that came with the printer if that matters)
20230809_123601

Can you enter the /api/version endpoint from of your printers ip to confirm? Like this.
image

@piberry
Copy link

piberry commented Aug 9, 2023

Here´s the output:
{"api":"1.0","server":"1.4.2","text":"MiniDeltaLCD","mem":85196}

I ran the printer on the weedo community firmware and also on Marlin 2.1.x by TheThomasD for some days but i flashed it back to the official firmware via the flash.wfm file you provided. The firmware flash went fine - shows v.1.2.0 on the screen again. The Marlin 2.1.x branch is a bit different in some ways, the delta calibration is buggy and the z-heigt calibration acts different too. Now, with the original firmware, everything is back to normal, so i´m 100% sure everything is stock again. I don´t know if this is related to the problem in some way.
The weedo community firmware 1.2.0 also gets stuck at the monoprice logo which i found really weird but version 1.1.5 works normal.
With every firmware i tried to connect with cura but the printer always resets and cura throws the error.

Edit:
I sent M502 via pronterface to reset the eeprom and also tried with a 8GB card and a 128MB one - same result.

@piberry
Copy link

piberry commented Aug 23, 2023

i almost got somewhere...
i was able to dump the flash of the esp32 with a ftdi exactly as described here:
https://github.com/Mclute0/-MPMDv2-modifications-and-fixes/blob/main/esp32-wroom32e%20output

my dump is the size of the flash memory but the dump from that git is double the size. in a text editor i can see that it is indeed firmware 1.5 but how can it be 8mb large? stuck again...

@piberry
Copy link

piberry commented Sep 2, 2023

solved:
https://github.com/piberry/-MPMDv2-modifications-and-fixes

i also managed to enable the parts cooling fan in marlin firmware so it responds to M106.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment