Wanhao D9 – Bed leveling -do this to make it work!

Add M420 S1 after G28


Someone on facebook suggested that the stock wanhao Firmware doesn’t handle leveling propertly. They’re right

Check out……..



given the 1000’s of people having issues getting the D9 to print properly, there does seem to be something fundamentally wrong with the printer….


In your Cura / startup script, find G28

now make it look like this


M420 S1


Now your printer should reliably print first time every time



G28 in the 1.14 version that Wanhao uses DELETES the leveling mesh from Memory!

or, in other words, every time you ‘home’, you un-level the bed!

Adding M420 S1 restores the mesh to memory

Stupid Wanhao 😦


I can confirm after doing this, my printer for the first time in memory has printed an OK first layer three times in a row without me having to do anything!





Author: Bleugh

Early Fourties, Wife, two kids in primary school. Both of us work full time...5 years now we’ve been Back in Blighty after a decade away...It's a new country for everyone! Still finding time to tinker!

17 thoughts on “Wanhao D9 – Bed leveling -do this to make it work!”

  1. Hi, you seem to be the go to guy on the Wanhao D9 🙂

    Is it possible to increase the number or mesh points that a G29 will do?
    If so, do you have a procedure or walk through?

    I have a glass bed, and even after changing the base plate to a 4.5mm aluminium sheet, the bed is still not level in “bed visualizer” .
    I’d like it to do more points to see more or less where the differences are.
    Really struggling with 1st layer adhesion.
    Even a simple circle is near impossible to right.



    1. yes you can increase the number of mesh points.
      Firstly ensure you’re comfortable with the Arduino IDE and compiling the source for your version of the printer.

      find the Configuration.h file and then search for these two lines…
      #define GRID_MAX_POINTS_X 8
      #define GRID_MAX_POINTS_Y 5

      They set the stock ‘mesh’ to be 8 points along X (side to side) and 5 points along Y (front to back) – giving 40 points total

      Change the 5 and 8 to something else

      I don’t know what the upper limits are but being an 8 bit processor, it’ll probably have issues if you go more than 256 points (16×16)

      compile your arduino sketch and you’re good to go!


  2. Thanks, would you then suggest that the latest version of Marlin would work fine with the D9 400/MK2.
    Obviously, the wanhao firmware is not available, only in hex format.


  3. Manolo from Wanhao sent me the raw firmware for 1.1.2. But the file was called 1.1.2-400, but the folder inside was 1.1.2-500.
    Other than the MAX_POS for X Y & Z in the configuration.h file, is there any other settings? other wise i must wait again for the file.


    1. No idea, I own the 300 but highly unlikely there’s no other official change, wanhao seems a bit relaxed with their firmware. You can’t do anything with the hex file, you need the source code.


  4. I hope this will help with my bed problems.
    Right now I am having an issue where the right motor only goes up no matter which way it is supposed to go.
    Any suggestions?


  5. Hey Bleugh, thanks so much for posting everything you have about this printer!
    Is this change needed if you added a g29 after the g28 in cura?


  6. Bleugh Bleugh Please help! Ive been printing hundreds of face shields on my I3 plus with no issue, but cannot get a first layer to print properly on my d9 mk2 since i’ve had it. (which is a long time).

    I read through the reprap forum post and wondered if i should add extra lines… IF i just wanted to try yours, and edit my startup gcode in cura…

    Would this be right?

    G21 ;metric values
    G90 ;absolute positioning
    M82 ;set extruder to absolute mode
    M107 ;start with the fan off
    G28 X0 Y0 ;move X/Y to min endstops
    G28 Z0 ;move Z to min endstops
    M420 S1 ;This is the part added
    G1 Z15.0 F{speed_travel} ;move the platform down 15mm
    G92 E0 ;zero the extruded length
    G1 F200 E6 ;extrude 6 mm of feed stock
    G92 E0 ;zero the extruded length again
    G1 F{speed_travel}
    ;Put printing message on LCD screen
    M117 Printing…


  7. I should probably update the page….

    On facebook there’s quite a few posts –

    This is all that’s really needed – (copy/pasted from facebook)

    G28 X0 Y0 ;move X/Y to min endstops
    G28 Z0 ;move Z to min endstops
    M420 S1 ;enable ABL mesh data
    G29 ;perform new ABL (yes it’s redundant, but it doesn’t hurt)


  8. can you compile a .hex for me with more bed leveling points enabled for the mk2? i tried compiling the stock firmware you linked and i just get an error on something i didnt even change and it fails to compile.


    1. I only have the MK1 with the inductive, not the MK2 sorry 😦 added also that it’s been over a year since I played with Marlin and the kids broke my old laptop with the build environment on, I’d be lost again!

      Good luck though, check the Facebook group out, probably will be able to get t some help there, also the waggster firmware is pretty good and should be able to do what you want


      1. ok so i got it figured out why it wouldnt compile and upload, audruino version was off. went to a lower version and it worked so now i have a 8×8 mesh, do you know how to enable it to see the numbers on the lcd so i can see the values of all the points?


      2. That’s awesome that you figured it out. Unfortunatley, the D9 lost its abilitiy to show the level points on the screen very early on , the only way to read those points is by using a serial / USB connection and some device to talk to it. Pronterface / Octoprint can both do that. Even a simple terminal emulator could when you send the right M commands to read the data!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: