markniu / Bed_Distance_sensor

Auto bed level with High resolution distance sensor
281 stars 27 forks source link

check:0 #13

Closed gacek4000 closed 1 year ago

gacek4000 commented 1 year ago

Hi, I have SKR 1.4 and Marlin-2.1.2. After connecting the BD sensor I keep getting "Calibrate data:28,1023, check:0". The red LED lights up when something metal is under the sensor, then the "BD sensor Z" value on the display changes from 10.14 to 0.0 Any ideas ?

image

i set:

define I2C_BD_SDA_PIN P0_01 // Please change to the actual number which the SDA wire is connected to your mainboard

define I2C_BD_SCL_PIN P0_00 // Please change to the actual number which the SCL wire is connected to your mainboard

define I2C_BD_DELAY 20

//#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

define BD_SENSOR

define Z_SAFE_HOMING

and so on...

markniu commented 1 year ago

you can replace those 2 files with the following link: https://github.com/markniu/Marlin_for_pull/blob/bugfix-2.1.x/Marlin/src/feature/bedlevel/bdl/bdl.cpp https://github.com/markniu/Marlin_for_pull/blob/bugfix-2.1.x/Marlin/src/gcode/probe/M102.cpp

then you can send M102 S-1 to read the version of BDsensor that can help you to check if the connection is success.

you can also try the pins for BLtouch on the SKR v1.4 like this https://raw.githubusercontent.com/markniu/Bed_Distance_sensor/main/doc/images/skrv1_4.jpg

gacek4000 commented 1 year ago

before replacing the 2 files you described: https://photos.app.goo.gl/fSZpwm4N7xALxyRs5 (no response to M102 S-1 and Calibrate data:28,1023, check:0)

after change: https://photos.app.goo.gl/6uFVhADqvVGMHKbYA (correct response on M102 S-1 and fast responses "Calibrate data:28,1023, check:0 Read Error" on M102 S-5) additionally, in this case, instead of "BD sensor Z: 10.14" on the screen, there is "Settings stored" from start 3D printer.

i2c configuration didn't change anything in either case, "#define I2C_BD_DELAY 100" did not help in either case,

markniu commented 1 year ago

That should be all the old calibrate data in the BDsensor has been erased to default 0xFF, Please Calibrate again, or just sending M102 S-6 and waiting it finished.

gacek4000 commented 1 year ago

-facepalm- ill check after job, thanks man !

gacek4000 commented 1 year ago

No, it doesn't work. It behaves the same as at the beginning: it starts moving down at the default speed. When I start the calibration, I have a screwdriver under the sensor, the LED is on red. I have delta if its matter I turned off "NO_MOTION_BEFORE_HOMING" to calibrate without homing after a fresh start. Did not help

markniu commented 1 year ago

the z axis should moving up. and please make sure the calibration is finished by waiting there is message "End calibrate data" return back. or else there will return back 1023 and check 0 after M102 S-5

gacek4000 commented 1 year ago

when i send M102 S-6 the head goes down quite fast, nothing shows up in the console. homing and other head control from pronterface works fine

markniu commented 1 year ago

I have not tested it on delta printer, there maybe some different about the endstop pin, please send me your configure files. https://github.com/markniu/Bed_Distance_sensor/issues/12#issuecomment-1501316810

gacek4000 commented 1 year ago

I just replaced 'current_position.z' like kendrickxy (I'm not as smart at printers as he is :)) and after 'M102 S-6' the head went down again, but in the console I had:

Begin calibration G1Z0.0 ,Z:0.00 w:0,Zpose:0.00 G1Z0.1 ,Z:0.10 w:1,Zpose:0.10 G1Z0.2 ,Z:0.20 w:2,Zpose:0.20 G1Z0.3 ,Z:0.30 w:3,Zpose:0.30 G1Z0.4 ,Z:0.40 w:4,Zpose:0.40 G1Z0.5 ,Z:0.50

when I set

define Z_MIN_PIN I2C_BD_SDA_PIN

define Z_MIN_PROBE_PIN I2C_BD_SDA_PIN

printer behavior as above

Configuration_adv.txt Configuration.txt pins_BTT_SKR_common.txt pins_BTT_SKR_V1_4.txt bdl.txt

gacek4000 commented 1 year ago
markniu commented 1 year ago

from your configure I find the Z_MIN_PROBE_PIN is used as the probe pin not Z_MIN_PIN, so please add this ||P == Z_MIN_PROBE_PIN in the endstop.cpp like image

don't set the I2C_BD_SDA_PIN to other function like the Z_MIN_PIN or Z_MIN_PROBE_PIN

and try M119 again

markniu commented 1 year ago
  • M119 shows 'z_probe: open' no matter what is under the sensor (LED on/off)
  • Z_MIN_PROBE_ENDSTOP_INVERTING true/false changes 'z_probe: open/triggered' accordingly but the head goes down on M102 S-6 in both cases

The homing position of your delta printer is the in the max position, but the calibration position is in the zero, so the head will go down to the zero after the calibration command M102 S-6. recommend to checking the position before calibration by send gcode M114

and don't replace the code planner.get_axis_position_mm(Z_AXIS) with current_position.z in the bd.cpp , because the current_position.z is not the actually current z position while the z motor is moving.

gacek4000 commented 1 year ago

i did what you said and:

M119 Reporting endstop status x_max: open y_max: open z_max: open z_probe: open filament: open ok

with metal under sensor. calibration process - still the same.

'#define Z_MIN_PROBE_PIN P0_10' is this correct ? When I uncomment it, the program doesn't compile

markniu commented 1 year ago

although I haven't delta printer but have one SKRV1.4 board, I will run it on that board late or tomorrow late. and will update that after testing.

If you convenient you can do those follow:

if the value from BDsensor is zero it will report z_probe: TRIGGERED after M119, else it will report z_probe: open, so the metal needs to be close enough to the sensor that can get the value zero from BDsensor, here your BDsensor calibration data has been erased, and no new calibration data now, so the value from it will always be 1023 or 1015

hope I have descripted clearly :)

markniu commented 1 year ago

bdl.zip I have test it with skrV1.4 board, and it can do calibration and M119 success. please replace the those files. including the file probe.h in Marlin\src\module folder. and don't homing printer before calibration.

gacek4000 commented 1 year ago

It works ! everything works, screen and calibration. Thanks a lot buddy :) What have you done? Have I mixed something up?

markniu commented 1 year ago

That's great, thanks for test it on delta printer.
the position value got by planner.get_axis_position_mm(Z_AXIS) is not zero in zero position for delta printer, so I fixed it by planner.get_axis_position_mm(Z_AXIS)-pos_zero_offset