Configure NPN sensor for Z axis homing

I have a custom-built Cartesian-style printer with an Octopus Pro board and TMC2209 drivers.
I have everything working except my Z-axis homing. Currently, I have a mechanical Z end stop wired to the Octopus Pro but I would like to use my NPN-style proximity sensor for homing. Sort of like a BL Touch.

I am not sure how to configure this type of setup. I can’t seem to find information on it either. When I home all axis, X and Y axis home fine and are set up as sensorless with virtual end stops. When my Z-axis homes, the NPN sensor light will trigger but not stop the Z-axis. I did a query check on the sensor and it is working as it should.

Klipper says to remove my position_endstop line and use a virtual end stop for the Z-axis but this doesn’t work.
printer.cfg (8.0 KB)

I am including my printer.cfg file. Any help is greatly appreciated.

I am sure there is something I am missing.

Your stepper_z needs this:

[stepper_z]
...
endstop_pin: probe:z_virtual_endstop
#position_endstop: 0 <-- Comment this. Not needed
position_min: -1
...

Ref: Configuration reference - Klipper documentation

This is how I have it set. It will level but not home. I am using a mechanical z endstop right now.
[stepper_z]
step_pin: PF11
dir_pin: PG3
enable_pin: !PG5
microsteps: 16
rotation_distance: 8
endstop_pin: tmc2209_stepper_z:virtual_endstop
#position_endstop: 0
position_min: -2
position_max: 280
homing_speed: 12
second_homing_speed: 1

If you want to use the probe for homing you need to change the endstop_pin to probe:z_virtual_endstop. You’re currently telling the printer to use the diag pin on the Z driver for sensorless homing which is not a safe way to home and could lead to a head crash.

How would I do this?
Add the virtual endstop to the probe pin and remove the diag pin?

I keep getting this “tmc virtual endstop requires diag pin config”

YES!!
That was my problem. I was using the virtual endstop for the Z axis and not the probe.
Thanks guys!!

1 Like

Hi , i have the same problem could you share your pinter config with me.