Working config for sensorless homing on a CoreXY



  • Does anyone have sensorless homing working on a CoreXY, and would like to share their settings?
    I have it somewhat working: I can home X and Y, but after that the system is unresponsive. This is my current config:

    [[language]]
    ; homex.g
    
    M915 X Y S3 F0 R0		; configure stall detection
    M574 X2 Y2 S3			; set endstops to use motor stall
    M913 X70 Y70			; reduce motor current to 70% to prevent belts slipping
    G91				; use relative positioning
    G1 S1 X-320               	; course home X
    G1 X-5 Y-5			; move away from end
    G90				; back to absolute positioning
    M400				; make sure everything has stopped before we reset the motor currents
    M913 X100 Y100			; motor currents back to normal
    M574 X1 Y1 S1 			; set endstops back to normal
    
    

    I started with the motor current at 50%, but the system hangs after homing
    At 70% motor current, I can move +X 10mm once after homing, and then it hangs

    Any help is appreciated.



  • @whosrdaddy:

    you can check the behaviour of your current config by looking at the DWC screen, you will find that X and Y will be at configured maximum values instead of your minimum values and that explains why nothing moves anymore
    I see that you endstops are at the low end so the line

    M574 X2 Y2 S3

    must become:

    M574 X1 Y1 S3; use sensorless homing for X and Y, endstops are at low end

    here is the complete homing macro from my corexy for reference.
    This macro assumes that home is at front left:

    M400                  ; make sure everything has stopped before we make changes
    M915 X Y S2 R0 F0     ; set X and Y to sensitivity 2, do nothing when stall, unfiltered
    M574 X1 Y1 S3         ; set endstops to use motor stall
    
    G91                   ; use relative positioning
    G1 Z10 F1200          ; lift Z
    
    G1 S1 X-325 Y-325 F3600 ; move right/back 325mm, stopping at the endstop
    G1 X5 Y5            ; move away from home
    ; X or Y is homed at this point, now home the other axis
    G1 S1 X-325 F3600      ; move towards axis minimum 
    G1 S1 Y-325 F3600      ; move towards axis minimum 
    G1 X5 Y5                      ; move away from home
    
    G1 Z-10 F1200           ; lower Z
    M400                  ; make sure everything has stopped before we reset the motor currents
    G90                   ; back to absolute positioning
    M574 X1 Y1 S1         ; define active low microswitches
    
    

    my homing files simple call this macro for XY homing, it works like a charm ๐Ÿ™‚



  • Thanks. I used the macro file in the wiki as a reference, hence x2 and y2.
    I had seen your macro in another post, but didn't catch that. I'll give it a go tomorrow.

    Thanks again!



  • @bartolomeus:

    Thanks. I used the macro file in the wiki as a reference, hence x2 and y2.
    I had seen your macro in another post, but didn't catch that. I'll give it a go tomorrow.

    Thanks again!

    For the record, the macro you are referring to is not mine but from member fma ๐Ÿ˜‰



  • Well, thanks then for pointing me in the right direction.

    I copied pasted that macro for my own config and the macro works.
    However, pasting the macro into homeall.g doesn't work. After homing the system hangs again.

    [[language]]
    M400					; make sure everything has stopped before we make changes
    M915 X Y S3 F0 R0			; configure stall detection
    M574 X1 Y1 S3				; set endstops to use motor stall
    M913 X50 Y50				; reduce motor current to 50% to prevent belts slipping
    G91					; use relative positioning
    G1 S1 X-325 Y-325 F3600			; move right/back 325mm, stopping at the endstop
    G1 X5 Y5            			; move away from home
    					; X or Y is homed at this point, now home the other axis
    G1 S1 X-325 F3600		      	; move towards axis minimum 
    G1 S1 Y-325 F3600      			; move towards axis minimum 
    G1 X1 Y1                      		; move away from home
    M400                  			; make sure everything has stopped before we reset the motor currents
    M913 X100 Y100 				; motor currents back to 100%
    G90                   			; back to absolute positioning
    M574 X1 Y1 S1         			; define active low microswitches
    
    

  • administrators

    Does it really hang, or just refuse to respond to X and Y jogging commands?



  • It refuses X and Y commands.


  • administrators

    Perhaps the firmware thinks it is at the axis limits. What X and Y positions does it display after homing, and what M208 commands do you have in config.g?



  • Ok, I was going to check the info you wanted. Now suddenly Home All is working. Between these posts I have not changed the sensorless homing macro nor the homeall.g

    However in the meantime I did configure my bltouch, and edited config.g and homez.g.

    So I gather when you press Home All it automatically executes homez.g after homeall.g?


  • administrators

    Home All will run homeall.g if it exists. After that, if any axes are flagged as not homed, it will run the individual homing files for those axes.



  • Ok, thank you so much. Sensorless homing now works for my setup. Off to the next stepโ€ฆ



  • Here's my corexy full homeall.g using sensorless homing for X/Y and piezo sensor for Z.

    [[language]]
    ; homeall.g
    ; called to home all axes
    ;
    M400			; make sure everything has stopped before we make changes
    G1 Z1 F6000		; Lift Z
    M574 X1 Y1 S3		; set endstops to use motor stall
    M913 X50 Y50 Z50	; drop motor currents to 50%
    M915 X Y S3 R0		; set sensitivity to +3 unfiltered
    G91			; use relative positioning
    G1 S1 X-400  F4000	; move X all the way left and stop at end
    G1 X16			; move to edge of glass
    G92 X0			; set X0 at edge of glass
    G1 S1 Y-400  F4000	; move Y all the way left and stop at end
    G1 Y42			; move to edge of glass
    G92 Y0			; set Y0 at edge of glass
    G1 X152 Y210		; go to back center of bed for measurement
    G28 Z			; probe bed to set z0
    G1 Z3			; lower bed for clearance
    G29 S1			; load heightmap
    G90			; back to absolute positioning
    M400			; make sure everything has stopped before we reset the motor currents
    M913 X100 Y100 Z100 	; motor currents back to 100%
    M574 X1 S0 		; redefine active low and unused microswitches
    M574 Y1 S1 		; redefine active low and unused microswitches
    
    

  • administrators

    You can remove the M574 commands from that homeall.g file and just put the first one in config.g. I had the M574 commands in my example because it was a macro for testing sensorless homing on a machine that normally used endstop switches. Likewise the M915 command can go in config.g.



  • Ah, yeah I was still using the switches to prevent acccidental triggers during a print.

    Thanks David.



  • (edit: Nevermind, lol) Why is it that this script (SuperJETT's) works for me if I have already homed X and Y but if none have been homed when it gets to the step of moving on the Y axis it moves diagonally in the X+ Y+ direction?

    Here is my Homeall.g:

    ; homeall.g
    ; called to home all axes
    ;
    M400			; make sure everything has stopped before we make changes
    M913 X50 Y50	        ; drop motor currents to 50%
    G91			; use relative positioning
    G1 Z5 F6000		; lower bed for clearance
    G1 S1 X-400  F4000	; move X all the way left and stop at end
    G1 X6			; move to edge of glass
    G92 X0			; set X0 at edge of glass
    G1 S1 Y-400  F4000	; move Y all the way left and stop at end
    G1 Y13			; move to edge of glass
    G92 Y0			; set Y0 at edge of glass
    G1 X150 Y150		; go to back center of bed for measurement
    G30 			; probe bed to set z0
    G1 Z5			; lower bed for clearance
    G29 S1			; load heightmap
    G90			; back to absolute positioning
    M400			; make sure everything has stopped before we reset the motor currents
    M913 X100 Y100 Z100 	; motor currents back to 100%
    G1 X320 Y320            ; move to parking point
    

    Homex.g (and the equivalent for Y) work fine.```
    ; homex.g
    ; called to home the X axis
    ;
    M400 ; make sure everything has stopped before we make changes
    G1 Z1 F6000 ; Lift Z
    M574 X1 Y1 S3 ; set endstops to use motor stall
    M913 X50 ; drop motor currents to 50%
    M915 X Y S3 R0 ; set sensitivity to +3 unfiltered
    G91 ; use relative positioning
    G1 S1 X-400 F4000 ; move X all the way left and stop at end
    G1 X6 ; move to edge of glass
    G92 X0 ; set X0 at edge of glass
    G90 ; absolute positioning



  • Oops, I figured it out. Just seeing those two scripts next to each other made me realize I hadn't removed the M574 command from the individual homing scripts and then when I looked in my config.g I found that I used the X2 parameter for some reason.

    BTW, this is so cool and working well. Thanks to everyone for doing the work!



  • I'm trying to set up sensorless homing on corexy I run into bit of trouble.
    I use this macro to test:

    M117 S"Start sensorless homing"
    M400			; make sure everything has stopped before we make changes
    M117 S"Set endstops to S3"
    M574 X1 Y1 S3		; set endstops to use motor stall
    M117 S"Reduce current"
    M913 X40 Y40 		; XY motors to 40% current	
    M117 S"Set sensitivity"
    M915 X Y S-6 R0 F0	; set X and Y to sensitivity 0, do nothing when stall, unfiltered
    
    M117 S"Move Z down"
    G91			; use relative positioning
    G1 S2 Z5 F1200		; lift Z
    
    G1 S2 X-325 F5000 	; move left 325mm, stopping at the endstop
    G4 P500			; wait 500msec
    ;G1 X5			; move away from home
    ;G4 P500			; wait 500msec
    M400			; make sure everything has stopped before we make changes
    ; X is homed at this point, now home the other axis
    G1 S2 Y-325 F5000	; move beyond axis minimum 
    G4 P500			; wait 500msec
    ;G1 Y5			; move away from home
    
    G1 S2 Z-5 F1200		; lower Z
    M400			; make sure everything has stopped 
    M913 X100 Y100          ; XY motors to 100% current
    G90			; back to absolute positioning
    M574 X1 Y1 S1		; define active low microswitches
    

    What's happening is that when no axes are homed carriage moves towards 0,0, moving both motors at the same time. It catches the and and then moves again. This corresponds to separeate X and Y homing parts.

    Any hints how to fix that?



  • @zen just point both homing files to your macro.

    for example:

    ; homex.g
    ; called to home the X axis
    M98 P"/macros/Sensorless homing"
    

    same thing for homey.g



  • @bartolomeus I can see a few reasons that might be causing your behaviour in the code:

    G1 S1 X-320 -> You might want to add a speed to the homing ( G1 S1 X-320 FXXXX). Sensorless homing is very sensitive to speed variations and triying with different speeds will produce different results.

    G1 X-5 Y-5 -> If Y was not pre-homed this will abort the script on that line, because no moves are allowed on the axis unless it is homed, therefore your motors will be left with 30% current add a G1 S1 Y-320 FXXXX before the line.

    I also noticed that sometimes the first homing move fails, probabl because the motor was "off" and the currents have not stabilized, so I runt the command G1 S1 X-320 and in between I wait 300 ms to let the current transients to stabilize (you do this with the command G4 300).

    Hope this helps.


  • administrators

    The re-home at slower speed bit may not work, because stall detection is unreliable and therefore disabled at low speeds. By default the cutoff speed is 200 full steps/second, so at x16 microstepping and 80 steps/mm that's a speed of 40mm/sec so 2400mm/min. However, for a CoreXY each motor contributes half of the motion, so I think you will find the minimum speed for stall detection is 4800mm/min. You can use the H parameter in the M915 command to try a lower threshold if you like.


 

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