Collision sensing for Marlin - markniu/Bed_Distance_sensor GitHub Wiki

Collision sensing for Marlin

[!NOTE] This feature requires the BDsensor firmware version(you can sending M102 S-1 to get that version,not the hardware version on the sensor) is V1.1b , > V1.2b or purchased after March 2024 , else you need to flash the firmware into BDsensor with external hardware tool like STlink.

How does it work

  • Stop z axis when the nozzle touch the bed after G28, like normal probe sensor.
  • Find the actual zero position after the nozzle touch the bed: move the nozzle down 0.1mm -> up 0.4 mm->up 0.1mm reading the raw data at the same time, after that determines where is the zero position.

Benefit:

  • Auto z_offset calibration.

    meanwhile you still can manually adjust the z_offset for different fialment.

  • Overcome the temperature drift.

    The temperature drift will change the z_offset, but it does not change the range of bed_mesh heightmap with BDsensor. that means the bed mesh is the same even with different temperature.

[!NOTE] The code for this feature is on the pull list of official marlin github: https://github.com/MarlinFirmware/Marlin/pull/27243

so please use this marlin code: https://github.com/markniu/MarlinPULL/tree/bugfix-2.1.x

How to activate

Enable BD_SENSOR, and add #define BD_SENSOR_CONTACT_PROBE in the configuration.h

and it should like this:

#define BD_SENSOR
#if ENABLED(BD_SENSOR)
  #define BD_SENSOR_PROBE_NO_STOP // Probe bed without stopping at each probe point`
  #define BD_SENSOR_CONTACT_PROBE // it uses nozzle collision sensing to probe while homing`
#endif

Homing Speed

Adjust the speed of probe in the configuration.h

The sensitivity depends on the speed, so you need to adjust the speed of Z axis, the homing_speed and second_homing_speed should be in the range of 3 ~ 5mm/s, here is the z probe feedrate speed. for example:

 #define Z_PROBE_FEEDRATE_FAST  (5*60)   // 5mm/s
 #define Z_PROBE_FEEDRATE_SLOW  (4*60)   // 4mm/s

increase homing bump of z axis to > 4mm in the Configuration_adv.h

#define HOMING_BUMP_MM      { 5, 5, 5 } 

Test homing

Please send G28 Z about 10 times, or M48 command to see if it is stable.

Test Video