Duet H calculation for bed.g

User avatar
zeplin
Plasticator
Posts: 17
Joined: Thu May 26, 2016 5:36 pm
Location: Houston, TX

Duet H calculation for bed.g

Postby zeplin » Tue Aug 16, 2016 4:12 am

So, now that I have my Crimson Oni running a Duet board and 0.9 motors I am on a quest to get hi-accuracy(ish) on my bed leveling deviation. I can get constantly .101 or .98 on the G32 calibrations but, I expect I can get into the .05 range. I hope. I know my PEI sheet needs to be replaced as it is wavy as a flag in high wind and I have a new sheet waiting to get my calibration routine down. I believe that I have a way to get the H-values from the Firmware. So here is what I have been trying. Please let me know if my thoughts are the wrong way or if there is a G/M command that I have missed. This is done with FRS so it may not work or apply to any other setup but it may.

Process is as follows.
  1. Get an estimated trigger values by using

    Code: Select all

    G1 Z2X0Y0
    G30 S-1
    M114
    G28
  2. Use the returned Z value from the M114 output that looks like the following:

    Code: Select all

     M114 X:-0.00 Y:0.00 Z:-0.32 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 Count 41144 41144 41144
  3. Set your G31 command in config.g to use the 'estimated' probe trigger similar to the following:

    Code: Select all

    G31 X0 Y0 Z-0.32 P100
  4. Run several set of G32's to get the G31 offset/trigger value to actual trigger the FRS. But be careful to not slam you hot end into the bed. I did this with the printer cold and not heated. I have not seen deviation on this value with temperature. At least at the tested temps I have done. (see below for notes on what I did to get it reliable)
  5. Once the FRS triggers reliably with your M558 and G31's set in the config.g file you are ready to start the H-value testing/discovery. This is what my current lines look like

    Code: Select all

    M558 P4 X0 Y0 Z0 H2 F200 T5000
    G31 X0 Y0 Z-0.419 P100
  6. Heat up the Extruder and Bed to 210 and 65 C and give 15 to 20 minutes to level out and heat-soak.
  7. Run a set of of 6 to 10(more cycles will give you less deviation on the averages) G32's with the final line in the bed.g file being 'S-1' copy the details of each run into a spreadsheet (that is linked below) then average them. Below is a my bed.g file that I would be using at this point. You can use less points if you like. But 3 inner and 6 outer would be the minimum that I would believe to work. Esher 3d site makes this easy.
    Spoiler:
    ; Auto calibration routine for delta printers
    ; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

    ;M561 ; clear any bed transform, otherwise homing may be at the wrong height
    G28 ; home the printer

    ; The first time the mechanical probe is used after deployment, it gives slightly different results.
    ; So do an extra dummy probe here. The value stored gets overwritten later.
    ;G30 P0 X0 Y20.00 Z-99999 H0.2

    ; bed.g file for RepRapFirmware, generated by Escher3D calculator
    ; 16 points, 6 factors, probing radius: 110, probe offset (0, 0)
    G30 P0 X0.00 Y110.00 Z-99999 H0
    G30 P1 X70.71 Y84.26 Z-99999 H0
    G30 P2 X108.33 Y19.10 Z-99999 H0
    G30 P3 X95.26 Y-55.00 Z-99999 H0
    G30 P5 X-37.62 Y-103.37 Z-9999 H0
    G30 P6 X-95.26 Y-55.00 Z-99999 H0
    G30 P7 X-108.33 Y19.10 Z-99999 H0
    G30 P8 X-70.71 Y84.26 Z-99999 H0
    G30 P9 X0.00 Y55.00 Z-99999 H0
    G30 P10 X47.63 Y27.50 Z-99999 H0
    G30 P11 X47.63 Y-27.50 Z-99999 H0
    G30 P12 X0.00 Y-55.00 Z-99999 H0
    G30 P13 X-47.63 Y-27.50 Z-9999 H0
    G30 P14 X-47.63 Y27.50 Z-99999 H0
    G30 P15 X0 Y0 Z-99999 S-1
    M665
    M666
    ; Sudo home
    G91
    G1 S1 X170 Y170 Z170 F15000 ; go part way up to speed up homing, endstops activated just in case
    G90
    G28 ; Home the printer again so as to activate the new endstop adjustments
    The output that we want from the 'G-Code Console' will look like this:

    Code: Select all

    Bed probe heights: 0.153 0.081 0.123 0.301 0.676 0.688 -0.051 -0.021 0.186 0.263 0.167 0.417 0.579 0.439 0.940 0.035, mean 0.311, deviation from mean 0.278
  8. Do math to offset the X0 Y0 Z0 trigger value mine with my PEI is a huge -0.43 yes it is that messed up (Don't ask, math in the spreadsheet, as well.)
  9. Load the averaged and offset bed probe points H-values from the above G32's into bed.g(or if you want a Bed-calibration.g for separate calibration factors). Bed.g example:
    Spoiler:
    ; Auto calibration routine for delta printers
    ; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

    ;M561 ; clear any bed transform, otherwise homing may be at the wrong height
    G28 ; home the printer

    ; The first time the mechanical probe is used after deployment, it gives slightly different results.
    ; So do an extra dummy probe here. The value stored gets overwritten later.
    ;G30 P0 X0 Y20.00 Z-99999 H0.2

    ; bed.g file for RepRapFirmware, generated by Escher3D calculator
    ; 16 points, 6 factors, probing radius: 110, probe offset (0, 0)
    G30 P0 X0.00 Y110.00 Z-99999 H-0.152
    G30 P1 X70.71 Y84.26 Z-99999 H-0.469
    G30 P2 X108.33 Y19.10 Z-99999 H-0.467
    G30 P3 X95.26 Y-55.00 Z-99999 H-0.432
    G30 P4 X37.62 Y-103.37 Z-99999 H-0.416
    G30 P5 X-37.62 Y-103.37 Z-9999 H-0.442
    G30 P6 X-95.26 Y-55.00 Z-99999 H-0.24
    G30 P7 X-108.33 Y19.10 Z-99999 H-0.398
    G30 P8 X-70.71 Y84.26 Z-99999 H-0.355
    G30 P9 X0.00 Y55.00 Z-99999 H-0.352
    G30 P10 X47.63 Y27.50 Z-99999 H-0.273
    G30 P11 X47.63 Y-27.50 Z-99999 H-0.291
    G30 P12 X0.00 Y-55.00 Z-99999 H-0.417
    G30 P13 X-47.63 Y-27.50 Z-9999 H-0.59
    G30 P14 X-47.63 Y27.50 Z-99999 H-0.984
    G30 P15 X0 Y0 Z-99999 S6
    M665
    M666
    ; Sudo home
    G91
    G1 S1 X170 Y170 Z170 F15000 ; go part way up to speed up homing, endstops activated just in case
    G90
    G28
    Bed-calibration.g example
    Spoiler:
    ; Auto calibration routine for delta printers
    ; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

    M561 ; clear any bed transform, otherwise homing may be at the wrong height
    G28 ; home the printer

    ; bed.g file for RepRapFirmware, generated by Escher3D calculator
    ; 16 points, 6 factors, probing radius: 110, probe offset (0, 0)
    G30 P0 X0.00 Y110.00 Z-99999 H-0.132
    G30 P1 X70.71 Y84.26 Z-99999 H-0.449
    G30 P2 X108.33 Y19.10 Z-99999 H-0.447
    G30 P3 X95.26 Y-55.00 Z-99999 H-0.412
    G30 P4 X37.62 Y-103.37 Z-99999 H-0.396
    G30 P5 X-37.62 Y-103.37 Z-99999 H-0.422
    G30 P6 X-95.26 Y-55.00 Z-99999 H-0.22
    G30 P7 X-108.33 Y19.10 Z-99999 H-0.378
    G30 P8 X-70.71 Y84.26 Z-99999 H-0.335
    G30 P9 X0.00 Y55.00 Z-99999 H-0.332
    G30 P10 X47.63 Y27.50 Z-99999 H-0.253
    G30 P11 X47.63 Y-27.50 Z-99999 H-0.271
    G30 P12 X0.00 Y-55.00 Z-99999 H-0.397
    G30 P13 X-47.63 Y-27.50 Z-99999 H-0.57
    G30 P14 X-47.63 Y27.50 Z-99999 H-0.964
    G30 P15 X0 Y0 Z-99999 S-1
    G30 P15 X0 Y0 Z-99999 S6
    M665
    M666

    ; Sudo home
    G91
    G1 S1 X170 Y170 Z170 F15000 ; go part way up to speed up homing, endstops activated just in case
    G90
    G28 ; Home the printer again so as to activate the new endstop adjustments
  10. Run a set of 6 to 10 G32's with M665 and M666 averaging them as well.
  11. Load the averaged set of M665 and M666 into the config.g.
  12. Continue running the bed calibration until you have a deviation that you are happy with or tell they converge for some other reason.
Spreadsheet of Doom

Step 4 notes: In getting the triggers to be reliable I had to actual revisit my FRS holders and sand them more. As there was sticking in the holder that would not always allow triggering. Additional, you may have to move the position of the holder slightly for reliability also. As my initial location where the plungers and holders were even thought they lined up there was enough of a offset/miss-alignment that it affected the triggering.

Prints have gotten great. The use of Duet has drop thinned printing areas from 10 to 1 that I got with the Rambo and manual use of the least squares calibration Escher 3D. In the thinning areas, I did a poor job of putting on my PEI sheet. A lot of the error is due to poor install. But, it reflects how well the Duet works. It has the processing power to do the calculation that the Rambo has to fudge to print.

But, pick away, I just hope this makes enough sense that someone else can understand it. Please, enlighten me if there is a different/better way that you may be doing the same process..
Last edited by zeplin on Mon Aug 22, 2016 9:03 pm, edited 5 times in total.
Modding all the things....
Crimson Oni - RoMAXv2 - Calabrating 24v via 2x hp DPS-800-GB PS's, BirdAir layer cooling, SSR'ed 24v Heatbed, e3dv6 hotend and 713maker mount.

User avatar
zeplin
Plasticator
Posts: 17
Joined: Thu May 26, 2016 5:36 pm
Location: Houston, TX

Re: Duet H calculation for bed.g {experiment}

Postby zeplin » Wed Aug 17, 2016 4:09 pm

Have done more testing and it seems to be working. Bu, I wanted to note a intended or unintended feature that I found. I may not be the first to find this but looking for confirmation that it was a feature I could not find any documentation that it should work this way.

In the bed.g file at the last point everybody knows that the 'Snnn" value controls the factors of calibration. Well I was tinkering with the 'S' values and found two things:
  1. G30 Pnn Xnn Ynn Z-99999 S-1 will print out the bed values
  2. Like this

    Code: Select all

    Bed probe heights: 1.060 1.299 1.328 1.205 1.396 1.263 0.944 1.030 1.062 0.158 0.303 0.408 0.398 0.337 0.722 -0.263, mean 0.791, deviation from mean 0.487
  3. You can add a second Snn command and it will do the calibration as well.
  4. Like this

    Code: Select all

    Calibrated 6 factors using 16 points, deviation before 0.928 after 0.154

So now I have a edited my bed.g file to look like this.
Spoiler:

Code: Select all

; Auto calibration routine for delta printers
; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

M561                  ; clear any bed transform, otherwise homing may be at the wrong height
G31 X0 Y0               ; don't want any probe offset for this
G28                     ; home the printer

; The first time the mechanical probe is used after deployment, it gives slightly different results.
; So do an extra dummy probe here. The value stored gets overwritten later.
;G30 P0 X0 Y20.00 Z-99999 H0.2

; bed.g file for RepRapFirmware, generated by Escher3D calculator
; 16 points, 6 factors, probing radius: 110, probe offset (0, 0)
G30 P0 X0.00 Y110.00 Z-99999 H-0.242
G30 P1 X70.71 Y84.26 Z-99999 H-0.531
G30 P2 X108.33 Y19.10 Z-99999 H-0.534
G30 P3 X95.26 Y-55.00 Z-99999 H-0.218
G30 P4 X37.62 Y-103.37 Z-99999 H-0.488
G30 P5 X-37.62 Y-103.37 Z-99999 H-0.44
G30 P6 X-95.26 Y-55.00 Z-99999 H-0.007
G30 P7 X-108.33 Y19.10 Z-99999 H-0.474
G30 P8 X-70.71 Y84.26 Z-99999 H-0.344
G30 P9 X0.00 Y55.00 Z-99999 H-0.307
G30 P10 X47.63 Y27.50 Z-99999 H-0.208
G30 P11 X47.63 Y-27.50 Z-99999 H-0.239
G30 P12 X0.00 Y-55.00 Z-99999 H-0.406
G30 P13 X-47.63 Y-27.50 Z-99999 H-0.566
G30 P14 X-47.63 Y27.50 Z-99999 H-1.004
G30 P15 X0 Y0 Z-99999 S-1
G30 P15 X0 Y0 Z-99999 S6
M665
M666
; Sudo home
G91
G1 S1 X170 Y170 Z170 F15000   ; go part way up to speed up homing, endstops activated just in case
G90
G28


I have added the M665 and M666 to help me speed the data collection process so that I can average the data quicker. I, will be working on a way to take a copy of the log washed by notepad++, then import it into Google Sheets. Hopefully, being a hands off calculations for the majority of the process.
Last edited by zeplin on Wed Aug 24, 2016 4:09 pm, edited 2 times in total.
Modding all the things....
Crimson Oni - RoMAXv2 - Calabrating 24v via 2x hp DPS-800-GB PS's, BirdAir layer cooling, SSR'ed 24v Heatbed, e3dv6 hotend and 713maker mount.

User avatar
zeplin
Plasticator
Posts: 17
Joined: Thu May 26, 2016 5:36 pm
Location: Houston, TX

Re: Duet H calculation for bed.g {experiment}

Postby zeplin » Mon Aug 22, 2016 4:34 pm

Well after testing for several days, I can report that it works. I expected to have to have a large constant to get this to work properly. But, it seems to work fine with a small constant(0.09 mm). I expected (.10 mm to .30 mm or larger) more as my PEI build sheet at the center, has some bad gouges from ABS that did not release properly.

I have done several refinements of my H-calculations, to assist in getting accurate Duet bed calibrations. The full process, as it stands to-date, is in the first post. As well as a link to the Google Sheets that I am using to do the math.

If anyone wants more details on the process or needs clarification in my description of the process PM me or post below.

I have yet to swap my PEI sheet out yet. So, I am not able to get my deviation below .1 to .09. I hope to get that changed out this weekend, but you know some times you want lemonade but life gives you vinegar.
Modding all the things....
Crimson Oni - RoMAXv2 - Calabrating 24v via 2x hp DPS-800-GB PS's, BirdAir layer cooling, SSR'ed 24v Heatbed, e3dv6 hotend and 713maker mount.

Toddimus
Noob
Posts: 2
Joined: Thu Jul 28, 2016 2:01 am

Re: Duet H calculation for bed.g

Postby Toddimus » Wed Aug 31, 2016 12:06 am

I'm going to give this a shot. I'll post how it goes.
Let me know if there's any last minute hints!!!
Cheers,
Todd

dc42
Printmaster!
Posts: 414
Joined: Mon Mar 07, 2016 10:17 am

Re: Duet H calculation for bed.g

Postby dc42 » Wed Aug 31, 2016 5:28 pm

zeplin, can you tell me the principle on which this works? The usual reason for needing H corrections is because the effector is tilting as it moves, and there are so many geometrical build errors that cause effector tilt that l can't envisage a way of working it out from the height measurements.

User avatar
zeplin
Plasticator
Posts: 17
Joined: Thu May 26, 2016 5:36 pm
Location: Houston, TX

Re: Duet H calculation for bed.g

Postby zeplin » Mon Sep 05, 2016 6:40 pm

The way this 'h' value is calculation attempts to sum both tilt and build errors. The values are normalized so a offset from the 0,0,0 position is believed to be 0 when at that position all other H values are offset from that position to account for the tilt and build errors.

The S-1 actual is not the way to get the H values it is a combination of getting a accurate trigger value at 0,0,0 from a single G30 command run repeatedly tell you can get good triggers. It takes some trial here to get the base G31 value needed. This will then replicate the 'estimated' h values needed to flatten the bed in a manor of speaking.

I did this out of frustration of running 5 to 10, G32's that converged in the low .01's but were not level when I went to print. The default H0 values were not working for me. When I installed my PEI sheet i did a really bad job and then I heated the sheet to round the edges and instead curled the edges increasing error in some areas. I mean to replace it but I have not done it yet.

So, tried to come up with a manual way of measuring the offset with feeler gauges or replacing the hotend with a dial caliper after it had been zeroed. But, i could not get good results the values were not repeatable and seem to skewing during measuring. So i did not trust them.

I happened to stumble across the S-1 method that I am using by accident. The S-1 values were someting I had been tinkering with my Rambo board before the Duet but i could never get the calcualtion speed need to actual compensate the error. Is this the true/real 'H' offset that only the distance that the hotend moves in the Z direction. 'NO' not at all. But, it is the amount of H that is need by the printers build to trigger the Z probe FRS's at each position properly.

This method of calculation of the 'H' Value is way I found to get a better result on a wavy build surface that a standard G32 command was not getting me after convergence.

I hope this helps. If not let me know as I my not understand what you are asking.
Modding all the things....
Crimson Oni - RoMAXv2 - Calabrating 24v via 2x hp DPS-800-GB PS's, BirdAir layer cooling, SSR'ed 24v Heatbed, e3dv6 hotend and 713maker mount.


Return to “Duet”

Who is online

Users browsing this forum: No registered users and 1 guest