Auto Bed Compensation - Too Slow?



  • I have just installed a peizo probe on a new printer build and have got my homeall.g working nicely with the peizo triggering as expected. It is installed in the hotend mount and installed in a titan extruder.

    When I use the Auto Bed Compensation tool to call G32, it probes too slowly which i believe is the reason for it not triggering the Peizo.

    The issue might be in the zprobe section of my config.g but I don't have a strong enough understanding to debug it or understand the code fully.

    Here is my bed.g

    ; bed.g
    ; called to perform automatic bed compensation via G32
    ;
    ; generated by RepRapFirmware Configuration Tool on Sat Jul 21 2018 13:51:16 GMT+1200 (New Zealand Standard 
    Time)
    M561 ; clear any bed transform
    
    G28  ; home all axes
    ; Probe the bed at 5 points
    G30 P0 X15 Y15 F6000 H0 Z-99999
    G30 P1 X15 Y285 F6000 H0 Z-99999
    G30 P2 X305 Y285 F6000 H0 Z-99999
    G30 P3 X305 Y15 H0 Z-99999
    G30 P4 X160 Y150 H0 Z-99999 S**
    

    And here is my config.g

    ; Configuration file for Duet WiFi (firmware version 1.20 or newer)
    ; executed by the firmware on start-up
    ;
    ; generated by RepRapFirmware Configuration Tool on Sat Jul 21 2018 13:51:16 GMT+1200 (New Zealand 
    Standard Time)
    
    ; General preferences
    G90                               ; Send absolute coordinates...
    M83                               ; ...but relative extruder moves
    
    M667 S1                           ; Select CoreXY mode
    
    ; Network
    M550 PLinBot                      ; Set machine name
    M552 S1                           ; Enable network
    M587 S"ASUS" P"Fe7awrEpMade2race" ; Configure access point. You can delete this line once connected
    M586 P0 S1                        ; Enable HTTP
    M586 P1 S0                        ; Disable FTP
    M586 P2 S0                        ; Disable Telnet
    
    ; Drives
    
    M569 P0 S1                        ; Drive 0 goes forwards
    M569 P1 S1                        ; Drive 1 goes forwards
    M569 P2 S1                        ; Drive 2 goes forwards
    M569 P3 S1                        ; Drive 3 goes forwards
    M350 X16 Y16 Z16 E16 I1           ; Configure microstepping with interpolation
    M92 X80 Y80 Z2395 E420           ; Set steps per mm
    M566 X900 Y900 Z12 E120           ; Set maximum instantaneous speed changes (mm/min)
    M203 X9000 Y9000 Z600 E1200       ; Set maximum speeds (mm/min)
    M201 X500 Y500 Z250 E250          ; 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
    M574 X1 Y1 S3			  ; set endstops to use motor stall
    M915 X Y S3 R0			  ; set sensitivity to +3 unfiltered
    
    ; Axis Limits
    M208 X0 Y0 Z0 S1                  ; Set axis minima
    M208 X320 Y300 Z290 S0            ; Set axis maxima
    
    ; Endstops
    M574 Z1 S0                        ; Set active low endstops
    
    ; Z-Probe
    ;M558 P0 H5 F120 T6000             ; Set Z probe type to switch and the dive height + speeds
    G31 X0 Y0 Z-0.1 P600               ; Set Z probe trigger value, offset and trigger height
    M557 X15:305 Y15:285 S20          ; Define mesh grid
    M558 P1 I0(or I1) R0.4 F300 X0 Y0 Z0   ;Define Z probe as peizo digital
    
    
    ; Heaters
    M307 H0 B0 S1.00                  ; Disable bang-bang mode for the bed heater and set PWM limit
    M305 P0 T100000 B4138 C0 R4700    ; Set thermistor + ADC parameters for heater 0
    M143 H0 S120                      ; Set temperature limit for heater 0 to 120C
    M305 P1 T100000 B4138 C0 R4700    ; Set thermistor + ADC parameters for heater 1
    M143 H1 S300                      ; Set temperature limit for heater 1 to 300C
    
    ; Fans
    M106 P0 S0.3 I0 F500 H-1          ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is 
    turned off
    M106 P1 S0.5 I0 F500 H1 T45       ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is 
    turned on
    M106 P2 S0.5 I0 F500 H1 T45       ; Set fan 2 value, PWM signal inversion and frequency. Thermostatic control is 
    turned on
    
    ; Tools
    M563 P0 D0 H1                     ; 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
    
    ; Automatic saving after power loss is not enabled
    
    ; Custom settings are not configured


  • You can increased the probing speed by increasing the F value of the M558 command in config.g



  • Thanks,

    I've changed

    M558 P1 I0(or I1) R0.4 F300 X0 Y0 Z0   ;Define Z probe as peizo digital
    

    To

    M558 P1 I0(or I1) R0.4 F1800 X0 Y0 Z0   ;Define Z probe as peizo digital
    

    But it doesn't seem to have had any effect on probing speed.

    My homez.g works nicely using the same speed, is it being overwritten from somewhere?

    ; homez.g
    ; called to home the Z axis
    ;
    ; generated by RepRapFirmware Configuration Tool on Sat Jul 21 2018 13:51:16 GMT+1200 (New Zealand Standard 
    Time)
    G91               ; relative positioning
    G1 Z5 F6000 S2    ; lift Z relative to current position
    G1 S1 Z-295 F1800 ; move Z down until the switch triggers
    G92 Z2.5          ; set Z position to trigger height


  • @ajcraig99 said in Auto Bed Compensation - Too Slow?:

    M558 P1 I0(or I1) R0.4 F1800 X0 Y0 Z0 ;Define Z probe as peizo digital

    I don't understand why people want to define the ppiezo as analog probe

    the correct M558 line would be

    M558 P5 I1 R0.4 F1800 X0 Y0 Z0

    or if you have a recent firmware (1.21 or higher)

    M558 P8 I1 R0.4 F1800 X0 Y0 Z0



  • @ajcraig99 Your home Z should be using a G30 probe command instead of a G1 S1 move. That way the probe offset is used to calibrate your z height accurately.

    I assume you've calibrated your z trigger height used in G31?



  • @phaedrux Sorry but im not too sure, most of the settings I got from the firmware builder (https://configurator.reprapfirmware.org/) and didn't save the .json file.

    To get sensorless homing working, I stole alot of the code from this post.

    https://forum.duet3d.com/topic/3585/working-config-for-sensorless-homing-on-a-corexy/10

    I have a Z offset in my config.g , Is this what you mean by calibration?

    G31 X0 Y0 Z-0.1 P600               ; Set Z probe trigger value, offset and trigger height
    

    When I try to run G30 i get the following error:

    08:44:28   G30 S-2     Error: Z probe already triggered at start of probing move
    

    Changes made since my last post where as directed by whosrdaddy, my new M558 line is

    ;M558 P1 I0 R0.4 F1800 X0 Y0 Z0   ;Define Z probe as peizo digital - Old
    M558 P8 I0 R0.4 F1800 X0 Y0 Z0    ;Define Z probe as peizo digital - New
    

    Now if I run G32 it will just move to each of the 5 points without probing, instead just returning that same error.

    I'm so lost man



  • You're getting really close.

    To get the trigger height you'll need to follow these instructions.

    https://duet3d.dozuki.com/Wiki/Test_and_calibrate_the_Z_probe

    I'm not sure what the ideal settings for the piezoelectric probe are. I think there are a few threads dealing with setting them up specifically. A quick search should get you that.



  • @ajcraig99 said in Auto Bed Compensation - Too Slow?:

    M566 X900 Y900 Z12 E120 ; Set maximum instantaneous speed changes (mm/min)
    M203 X9000 Y9000 Z600 E1200 ; Set maximum speeds (mm/min)

    Maybe you have to adjust those two z speeds to get it working quicker



  • @phaedrux Working through that dynamic calibration procedure and I can't get past the G30 S-1 stage,
    It just crashes into the bed and doesn't trigger the probe.

    Does my homez.g use the M558 line from config.g? since homez.g works I would expect this line to be correct if it is using it right?

    if my homez.g doesn't use the M558 line then I guess my issue lies here.

    I changed I0 to I1 in the M558 line to change to a normally closed switch and now I don't get the error "Error: Z probe already triggered at start of probing move" so at least it tries to probe now.

    So I currently have

    M558 P8 I1 R0.4 F1800 X0 Y0 Z0    ;Define Z probe as peizo digital - New


  • @ajcraig99 when you did the g30 s-1 test did you first change your trigger height in the G31 command to 0 in the config.g?

    Also try changing the trigger sensitivity to a lower value. That's the P value of the G31 command in config.g. try 100 instead of 600.



  • @phaedrux

    Ensure that the Z offset in G1 in config.g is set to 0, these steps will be used to measure this actual offset. (send G31 >Z0 to set it to 0).

    I though I did but misread that as G31, I have a G31 line where Z=0 (was Z-0.1) but no G1 line in my Config.g

    Isn't G1 just 'move'? Do I need to add another line in config.g with just

    G1 Z0
    

    ?



  • Yes I think that's a typo.



  • Ok, 1 step forward, 1 step backwards.

    G31 changed to G1 with Z0 but now when I issue G30 S-1 it starts the manual bed probing wizard.

    M558 is still set to P8 rather than the P0 I would expect to cause this...



  • Nope that should be G31. The g1 is a typo.



  • I think I would go back through the piezo documentation from the start and follow it to the letter.

    Once you get through that if it still doesn't work we can review your config.g and homing files.



  • Typo fixed. Still crashes into the bed.

    Have been through the peizo documentation pretty thoroughly over the last week or so. It's not very detailed but I have checked the polarity and got the sensitivity tuned.

    It just takes a light tap when running homez.g

    https://youtu.be/OKaQNF0DIy0

     G1 S1 Z-295 F1800 ; move Z down until the switch triggers
    

    Snnn Flag to check if an endstop was hit (S1 to check, S0 to ignore, S2+S3 see note, default is S0) 1

    Am I right in thinking that the above waits for an endstop to be triggered (which does get triggered in this case) whereas G31 waits for a probe to be triggered ie a different tool or input compared to above?

    When I run G31 with the bed 100mm or so away from the nozzle, i can manually trigger the peizo, causing the red light to flash but it ignores it.



  • So you should not be using G1 S1 Z-295 F1800 in your homez.g. That is only if you are using a mechanical end stop switch. You should be using G30, which tells the system to probe the bed to find z=0.

    So lets clear up some terminology because I think it's a little confused right now.

    G1 commands are movements. In the command above, the S1 switch tells it to move until an endstop is hit.

    G30 tells the system to do a probe. It uses the settings specified in the config.g (G31 and M558) to tell it what kind of probe it is and how it's configured. It then moves the head down until the probe triggers. It takes the trigger height offset and says if I triggered here, the bed is here, and so it knows where z=0 is and can move accurately going forward. G30 is used by your homing files and the various bed leveling options.

    G31 belongs in the config.g and defines the physical location of the probe in relation to the nozzle. In your case the nozzle is the probe, so the X and Y values are 0. The Z value tells it what height the nozzle is when it triggers. According to the piezo documentation it should be -0.1 because it actually presses into the bed a little bit.

    M558 also in config.g defines the probe type and how it should behave during a G30 command.

    So your config.g should have the following lines in it.

    M574 Z1 S2						; Use zprobe and home to Z Min.
    M558 P8 I1 H5 F300 T6000                 ; Use piezo digital probe type, invert the signal, probe from 5mm height, probe at 300mm/min, travel between probe points at 6000mm/min.
    G31 X0 Y0 Z-0.1 P100
    M557 X10:280 Y35:270 S15				; Define mesh grid
    

    Then your homeall.g should look something like this.

    ; Drop the bed for travel
    ;
    G91                     	; relative positioning
    G1 Z5 F200 S2        		; Lower bed 5mm to ensure it is below the switch trigger height
    
    ; Home XY
    ;
    G1 S1 X-375 Y305 F4000   	; course home X or Y
    G1 S1 X-375 F4000              	; course home X
    G1 S1 Y305 F4000              	; course home Y
    G1 X5 Y-5 F1000             	; move away from the endstops
    G1 S1 X-10 F600           	; fine home X
    G1 S1 Y10 F600               	; fine home Y
    
    ; Home Z
    G90				; absolute positioning
    G1 X190 Y90 F6000		; Move x and Y axis over to bed center so probe is on top of bed
    G30 				; Do a single probe to home our Z axis
    
    ; Move X and Y back Home
    ;
    G1 X1 Y270 Z5
    


  • Thankyou, I've updated the code and will revisit the peizo setup again.



  • No problem. You're quite close.

    The configurator gives a starting point but there are a lot of pitfalls with the option choices. It can take a bit of manual tuning to get it right.



  • Just reporting back to say I got everything working now. Thankyou very much for the help. The code snippets you posted above are working perfectly.

    The issue was entirely user error on my part. I had the probe wired up to the 'Z Stop' on the board instead of 'Z Probe'. A tonne of hassle over a simple mistake but atleast it's sorted now.

    Cheers


Locked
 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.