Non-contact Dial Indicator for 3D Printer

by ni_mark in Workshop > 3D Printing

652 Views, 6 Favorites, 0 Comments

Non-contact Dial Indicator for 3D Printer

Bed Distance Sensor for 3D printer
  1. It measures the distance from the nozzle to bed automatically and then adjust Z axis height in real time.
  2. Fast auto bed leveling,
  3. The distance will be displayed on the LCD that will be useful while doing menu leveling.

Attach the Sensor Cable to the Mainboard

The wires CKL and SDA of BDsensor can be connected to any GPIO pins of your mainboard. You can also connect the BDsensor cable into the Bltouch port directly if your mainboard has,for example:

 5V -- 5V(red)
GND -- GND(black)
S -- CLK(green)
Zmin-- SDA(white)


Check the Sense Range

light0.jpg

There is a light from the sensor if the metal is in the sensor range, note: the LED from the sensor is too weak to see in bright room.

Mount the BDsensor

Connection.jpg

After mounted we need to make sure that the bed plate is in the detection range of the BDsensor. Moving Z axis a little up about 0.6mm from the bed plate and check if there is a little light on from the BDsensor.

Configure & Flash Marlin Firmware

The BDsensor have been integrated to Marlin2.1.x(Since 2022.8.27),you can download the latest here: https://github.com/MarlinFirmware/Marlin What do you need is change the configure file and pins file.


Edit Configuration.h

Uncomment

#define BD_SENSOR
#define Z_SAFE_HOMING

modify the Z homing speed:

#define HOMING_FEEDRATE_MM_M { (50*60), (50*60), (4*60) }

to

#define HOMING_FEEDRATE_MM_M { (50*60), (50*60), (1*60) }


Edit Configuration_adv.h

#define BABYSTEPPING
#define HOMING_BUMP_DIVISOR { 2, 2, 8 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)

Here we have to slow down bump homing speed and Z homing speed, because the endstop read from BDsensor process is not in the ISR like normal endstop.

Configure the pins for the SDA and SCL of the BDsensor in your pins file(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 SCL wire is connected to your mainboard
#define I2C_BD_DELAY 20

if you want to do the auto bed leveling probe (G29) before print like normal BLtouch, Uncomment

#define AUTO_BED_LEVELING_LINEAR

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

Calibrate

Read.jpg

1)Move the Nozzle down until it just touch the bed plate(The BDsensor will use this position as the 0 point).

2)Reboot the printer, Send gcode M102 S-6,then it will move the z axis slowly up 0.1mm everytime until it reach to 3.9mm.done

you can check whether the BDsensor has been calibrated successful by sending gcode M102 S-5 to read the raw calibration data from BDsensor.

There is also a Calibrate Tools to do that:https://github.com/markniu/Bed_Distance_sensor/blob/main/BD_Config_Tool.zip Note: data value 1015 or > 1010 that means out of sensor range. if the value of the first 5 points(0~0.5mm) or more are in the range 0 to 1000, and the increased value delta is >=10 that means calibrate successful.like the graph shown above.

Test and Printing

Install Bed Distance Sensor,Open box

Menu bed level

Auto bed level


There are 3 ways to do auto bed leveling:

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 S0orG28or M18 will disable bedlevel with BDsensor,BTW,this is disabled by default.

M102   S-6     //Start Calibrate,before that make sure the nozzle is just touched the bed,and then the printer restarted. 
M102 S-5 //Read raw Calibrate data
M102 S4 //Set the adjustable Z height value,e.g. M102 S4 means it will do adjusting while the Z height <=0.4mm , disable it by M102 S0.
M102 S-1 //Read sensor information

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.


More details: markniu/Bed_Distance_sensor: Auto bed level with High resolution distance sensor (github.com)