This installation is for the printer that run Marlin firmware.
the wires CKL and SDA of BDsensor can be connect to any GPIO pins of your mainboard. You can also connect the BDsensor cable into the Bltouch port directly(except the MKS board),for example:
BLtouch | BDsensor
GND --> GND
5V --> 5V
S --> SCL/CLK
GND --> GND
Zmin --> SDA
Since some of the pins on the mainboard maybe not connected to gpio of MCU directly (e.g. there is a filter capacitor on it or isolated by mosfet, diode or optocoupler, but it's OK if they are isolated by resistors or pullup/pulldown by resistors), they cannot work with BDsensor. and the firmware will report connection error. For example
Please feel free to send me or share your connection picture if you are not sure.
The BDsensor have been integrated to Marlin2.1.x(Since 2022.8.27),
you can download the release version. but now recommend downloading the latest bugfix version: https://github.com/MarlinFirmware/Marlin
or the latest bugfix version with the latest features https://github.com/markniu/MarlinPULL/tree/bugfix-2.1.x
What do you need is change the configure file and pins file.
1. Enable BD_SENSOR
Uncomment
#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,this is a new feature.
#endif
Latest marlin:https://github.com/MarlinFirmware/Marlin
Marlin with Nozzle collision sensing: https://github.com/MarlinFirmware/Marlin/pull/27243)
2. Homing with probe
make sure the Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is disabled and USE_PROBE_FOR_Z_HOMING
should be enable like the following
//#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
// Force the use of the probe for Z-axis homing
#define USE_PROBE_FOR_Z_HOMING
3. Slow down the second homing Z speed
#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 16)
If you work with the new contact feature: nozzle collision sensing, this value is different and please refer to this https://github.com/MarlinFirmware/Marlin/pull/27243
#define BABYSTEPPING
// enable this for the feature of real time leveling
Configure the pins for the SDA and SCL of the BDsensor in your pins file pins_boardname.h (E.g. pins_PANDA_PI_V29.h
) by adding the following 3 lines:
#define I2C_BD_SDA_PIN PC6 // Please change to the actual number which the SDA wire is connected to your mainboard
#define I2C_BD_SCL_PIN PB2 // Please change to the actual number which the SLK wire is connected to your mainboard
#define I2C_BD_DELAY 20 // default value is 20, should be in the range [10,30].
if you want to do the auto bed leveling probe (G29) before print like normal BLtouch,
Uncomment
#define AUTO_BED_LEVELING_BILINEAR
and edit the value like the following
#define Z_CLEARANCE_DEPLOY_PROBE 0 // Z Clearance for Deploy/Stow
#define Z_CLEARANCE_BETWEEN_PROBES 1 // Z Clearance between probe points
#define Z_CLEARANCE_MULTI_PROBE 1 // Z Clearance between multiple probes
in the Configuration.h
Compile the new marlin firmware and flash the mainboard.
M102 S-1
please check the connection and wire order if it return blank or other string.
Send: M102 S-1
Recv: V1.0 pandapi3d.com
M119
Please do not Homing Z until you have checked this step or else the nozzle maybe cashes the printer bed.
Send: M119
Recv: x:open y:open z:open
make sure the z motors off/unlock
move the z axis down with hand until the nozzle close the bed
send M102 S-2
, the return value should be 0.00mm and then send M119 again, you can see the z endstop is triggered now.
Send: M119
Recv: x:open y:open z:TRIGGERED
Clean the nozzle,
If the BD_SENSOR_CONTACT_PROBE
is enabled please send G28
then G1 Z0
else you need to manually move the Z axis until the nozzle just touches the bed plate,(The BDsensor will use this position as the 0 point,so the z_offset is no needed and we set the value as 0).
Send gcode M102 S-6,then it will move the z axis slowly up 0.1mm everytime until it reach to 3.9mm.done
Check whether the BDsensor has been calibrated successful by M102 S-5
that will return the raw calibration data which stored in the BDsensor.
There is also a Calibrate Tools to do that: https://github.com/markniu/Bed_Distance_sensor/raw/new/marlin/BD_Config_Tool_Marlin.zip
If the first raw calibration data returned by the M102 S-5 is greater than 400, that means the sensor is mounted too high and needs to be remounted close to the bed.
If the first raw <100, that means the sensor is mounted too close to the bed.
Make sure that the second data is greater than the first data value by more than 10
G28
G1 Z1
waiting the toolhead stops then
M102 S-2
G1 Z0
after G28
, if not please calibrate again.1.Real time leveling at first few layers with M102
we can easily enable or disable this auto level by sending gcode command or and adding gcode in the gcode file.
To enable bed leveling in Cura, add the M102 G-Code right below the G28 (Home All Axes) G-code in the Start G-code section of your printer’s Machine Settings.
For example M102 S2
below the G28 , that means it will only do bed leveling below 0.2mm of Z axis height.
Send M102 S0
orG28
or M18
will disable bedlevel with BDsensor,BTW,this is disabled by default.
M102 S3 //Set the adjustable Z height value,e.g. M102 S3 means it will do adjusting while the Z height <=0.3mm , disable it by M102 S0.
2. Auto Bed Leveling with G29
Another way to do auto bed leveling is like BLtouch with G29,just add a line G29 below G28.
Installation Video from Chris's Basement
https://drive.google.com/drive/folders/13poitJhHradERgTLGtSDJb0zpuyNYHZY?usp=sharing
M102 S-1 //Read sensor information, and we can use this for connection checking.
M102 S-2 //Read current distance value
M102 S-5 //Read raw Calibrate data
M102 S-6 //Start Calibrate,before that make sure the nozzle is just touched the bed,and then the printer restarted. don't home z axis before this.
M102 S3 //Set the adjustable Z height value,e.g. M102 S3 means it will do adjusting while the Z height <=0.3mm , disable it by M102 S0.
Be careful when using it at the first time, for example, you can use an old PEI plate for testing.
you can find/search more troubleshooting from other users here https://github.com/markniu/Bed_Distance_sensor/issues
Happy printing!