Understanding G29, G32 and Z offset
-
Hi folks,
I'm (finally!) getting my CoreXY printer toward a usable state.
I have just fitted a dc42 IR probe, which seems to be working well, giving very repeatable measurements.
My printer (a D-Bot) has two Z-axis screws, which are each driven by an independent driver on the Duet. Having configured my probe X/Y offsets, leadscrew locations in the machine coordinate system and probing locations, G32 is working beautifully at levelling the bed.
I'm currently homing with a Z-axis limit, rather than the IR probe - I may change this in the future.
The trigger height of the Z probe gives ~1.2mm offset between the trigger height of the IR probe and where the nozzle needs to be, which makes sense - this is reported by G32. On repeated running of G32, I see the following in the console:
G32
Leadscrew adjustments made: 1.256 1.266, points used 2, (mean, deviation) before (1.261, 0.004) after (-0.000, 0.000)This adjustment means that my Z=0 position is incorrect after G32. I can correct this by adding G1 Z0 and G92 Z1.2 into bed.g, but then this error comes back when running G29. Creating a mesh.g and adding the G92 Z1.2 / G1 Z0 in at the end caused some...unexpected motion, so I think I am missing something here.
What's the proper way to handle the offset between the mechanical Z origin and the trigger height of the Z probe when using G29 and G32?
For the record, have always been running G32 before G29. Adding G32 before G29 to mesh.g seemed to cause the printer to get stuck in a loop of continuously running G32, but that's maybe a question for another thread.
This is my config.g:
; Configuration file for Duet WiFi (firmware version 3.3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.3.10 on Wed Dec 29 2021 11:34:18 GMT+0000 (Greenwich Mean Time) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"D-Bot" ; set printer name M669 K1 ; select CoreXY mode M81 C"pson" ; setup ATX supply, but leave switched off ; Network M552 S1 ; enable network M586 P0 S1 ; enable HTTP M586 P1 S0 ; disable FTP M586 P2 S0 ; disable Telnet ; Drives M569 P0 S0 ; physical drive 0 goes backwards M569 P1 S0 ; physical drive 1 goes backwards M569 P2 S0 ; physical drive 2 goes backwards M569 P3 S0 ; physical drive 3 goes backwards M569 P4 S1 ; physical drive 4 goes forwards M584 X0 Y1 Z2:3 E4 ; set drive mapping M671 X190:-200 Y82:82 S2.5 ; set Z screw locations relative to WCS origin M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation M92 X100.00 Y100.00 Z400.00 E790.00 ; set steps per mm M566 X2000.00 Y2000.00 Z500.00 E120.00 ; set maximum instantaneous speed changes (mm/min) M203 X6000.00 Y6000.00 Z1000.00 E1200.00 ; set maximum speeds (mm/min) M201 X200.00 Y200.00 Z20.00 E250.00 ; set accelerations (mm/s^2) M906 X800 Y800 Z800 E800 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 S1 X-150 Y-85 Z0 ; set axis minima M208 S0 X150 Y85 Z300 ; set axis maxima ; Endstops M574 X1 S1 P"!xstop" ; configure switch-type (e.g. microswitch) endstop for low end on X via pin xstop M574 Y1 S1 P"!ystop" ; configure switch-type (e.g. microswitch) endstop for low end on Y via pin ystop M574 Z1 S1 P"!zstop" ; configure switch-type (e.g. microswitch) endstop for low end on Z via pin zstop ; Z-Probe M558 P1 C"zprobe.in" H5 F120 T6000 ; enable Z probe, set dive height, probe speed and travel speed G31 X0 Y-16 P500 M557 X-112.5:112.5 Y-84:66 S75 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M307 H0 B0 S1.00 ; disable bang-bang mode for the bed heater and set PWM limit M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C M308 S1 P"e0temp" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e0heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1 M307 H1 B0 R2.032 C234.5:191.1 D5.75 S1.00 V11.9 ; Tuning parameters M143 H1 S280 ; set temperature limit for heater 1 to 280C ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off M950 F1 C"fan1" Q500 ; create fan 1 on pin fan1 and set its frequency M106 P1 S1 H-1 ; set fan 1 value. Thermostatic control is turned off ; Tools M563 P0 S"V6" D0 H1 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ; Custom settings are not defined
bed.g:
; bed.g ; called to perform automatic bed compensation via G32 ; ; generated by RepRapFirmware Configuration Tool v3.3.10 on Wed Dec 29 2021 11:34:18 GMT+0000 (Greenwich Mean Time) M561 ; clear any bed transform ; G29 ; probe the bed and enable compensation G28 ; Home G30 P0 X-145 Y66 Z-99999 ; Probe near -X Z leadscrew G30 P1 X135 Y66 Z-99999 S2 ; Probe near +X Z leadscrew ; G1 Z0 ; G92 Z1.2
- I know the meshgrid should be finer - this is just for testing!
- The Duet is currently running V3.4.6
-
Hi,
Anytime you perform auto bed leveling using G32 you should follow it with setting the Z=0 Datum using G30
Frederick
-
Hey Frederick,
Thanks for your reply (and apologies for my delayed response).
I'm still not sure I understand the 'setting Z datum with G30' aspect. It looks in DWC like the compensation is being applied once the mesh levelling is complete? I can see the screws move to correct an angle in the bed when running the second G30 in bed.g, so as far as I can tell, it looks to be working without sending another G30 afterwards?
In light of my original question of the Z offset after probing, I think I've fixed this by adjusting the probe parameters in config.g. Instead of the default 0.7mm offset in Z, I have put:
G31 X0 Y-16 Z1.9 P500
This looks to have brought everything into line (offsets around 0 after bed levelling)., and feels like a more ethical solution than fudging it with G92.
-
It's important to differentiate between G32 - bed leveling (auto or manual) and G29 (mesh compensation - mesh creation - mesh loading)
Both require setting the Z=0 Datum using G30.
G32 (bed leveling) should be followed by G30.
G29 (mesh creation or loading) should be preceded by G30.
On a machine that allows auto bed leveling you will likely use G32 (bed leveling) followed by G30 (setting the Z=0 Datum) then G29 S1 (mesh loading).
In that case the G30 proceeding the G29 satisfies the need to follow G32 by G30.
The reason for G30 after G32 is that the leveling process can change the Z position of Z=0 - doing the G30 resets the Z=0 Datum correctly.
Hope that clarifies rather than confuses.
Frederick