Bed_Distance_sensor icon indicating copy to clipboard operation
Bed_Distance_sensor copied to clipboard

Kippler support

Open hackebike opened this issue 2 years ago • 43 comments

Any chance you add Kippler support?

hackebike avatar Oct 06 '22 11:10 hackebike

Seems will wait for more time, Since I am not familiar with klipper and python, also try to looking someone help to supporting.

markniu avatar Oct 07 '22 10:10 markniu

hi there,

working on klipper support for the sensor but cant even connect the probe for any reason. Its connected to the raspebrry PI`s I2C connector but i2cdetect cant find the device.

PI SDA -> Sensor SDA PI SCL -> Sensor SCL PI GND -> Sensor GND PI 5V -> Sensor 5V

I2C is working image

device seems to work, i can see the LED when putting some metall piece to the sensor

any idea?

HelgeKeck avatar Nov 02 '22 10:11 HelgeKeck

The device has a 5V VIN, but does the device uses a 3.3V or a 5V I2C connection. Cant find any information on it

HelgeKeck avatar Nov 02 '22 10:11 HelgeKeck

I tried it with an Arduino I2C scanner nd found this

if the device is connected to the arduino it returns an derror for these addresses

Unknown error at address 0x51 Unknown error at address 0x54 Unknown error at address 0x57 Unknown error at address 0x5A Unknown error at address 0x5D

HelgeKeck avatar Nov 02 '22 13:11 HelgeKeck

there is a different from the standard I2C. See this timing diagram of this sensor https://github.com/markniu/Bed_Distance_sensor/blob/main/doc/images/0220517153950.png , for increasing the speed, there is no I2C address transfer in the timing diagram that's the difference from the standard I2C. There is a library for the arduino: markyue/Panda_SoftMasterI2C
for example add

lib_deps          = 
  markyue/Panda_SoftMasterI2C

in the platformio.ini

markniu avatar Nov 02 '22 14:11 markniu

ok, thank you

HelgeKeck avatar Nov 02 '22 14:11 HelgeKeck

The device has a 5V VIN, but does the device uses a 3.3V or a 5V I2C connection. Cant find any information on it

this device is 5v I2C connection,but can work with normal 3.3v MCU like stm32 which most gpios are 5V tolerate

markniu avatar Nov 02 '22 14:11 markniu

nice it works, getting the first readings. will play a bit with it and let you know when i need more infos

HelgeKeck avatar Nov 02 '22 14:11 HelgeKeck

nice it works, getting the first readings. will play a bit with it and let you know when i need more infos

look forward to

markniu avatar Nov 02 '22 15:11 markniu

Python module finished :-)

https://www.youtube.com/watch?v=nbHTrJHoE-k

HelgeKeck avatar Nov 02 '22 17:11 HelgeKeck

wow, nice work!

markniu avatar Nov 02 '22 22:11 markniu

Thats not good. I just realized that this sensor will most likely not be supported by klipper naytime soon. Problem is the unusual I2C communication the sensor uses. We cant use the inbuilt I2C micricontroller code from klipper to connect to the device, a microcontroller implementation just for this sensor seems unlikely to be approved by the klipper mantainers. So a real implementation is not likely.

HelgeKeck avatar Nov 03 '22 21:11 HelgeKeck

is it possible to change the firmware of the sensor to use standarized I2C communication?

HelgeKeck avatar Nov 03 '22 21:11 HelgeKeck

it can not be flashed firmware from the i2c port. and the reason for not use standard I2C is that we need quik response of the sensor when homing z axis. maybe we can add the softI2C code of this sensor to the klipper.

markniu avatar Nov 04 '22 03:11 markniu

i am trying to implement it atm

HelgeKeck avatar Nov 04 '22 04:11 HelgeKeck

image

HelgeKeck avatar Nov 05 '22 08:11 HelgeKeck

image

Can BD sensor data be read with klipper now?

markniu avatar Nov 05 '22 11:11 markniu

yes, on a microcontroller level

HelgeKeck avatar Nov 05 '22 11:11 HelgeKeck

good job ! I am editing the wiki document about the calibration that maybe you needed

markniu avatar Nov 05 '22 12:11 markniu

yes, working on the calibration, having also some questions. will ping oyu in the nbext days

HelgeKeck avatar Nov 05 '22 13:11 HelgeKeck

Have updated the document which contains the calibration process. https://github.com/markniu/Bed_Distance_sensor/wiki/Data-Protocol

markniu avatar Nov 05 '22 15:11 markniu

Hi @HelgeKeck @markniu, may I know what are the configs for Klipper implementation?

ashbuilds avatar Dec 03 '22 14:12 ashbuilds

I was wondering, could we simply use a MCU to connect the sensor to klipper, like we can do with the ADXL345 sensor (for resonance compensation)? Would it solve the issue with the unusual I2C protocol, or would it be too slow to react?

JayBee-git avatar Dec 05 '22 14:12 JayBee-git

@JayBee-git I was also thinking the same but not sure how Klipper will read the data from sensor. I'm also looking into it.

ashbuilds avatar Dec 05 '22 16:12 ashbuilds

@ashbuilds true, I know serial can be used in klipper but that would probably require to change some code. BLtouch is going through the printer motherboard which is a MCU as well, so I bet there is something that can be done here. Maybe even connecting the BDTouch to the motherboard could work?

JayBee-git avatar Dec 06 '22 05:12 JayBee-git

The output of the TCA 305 sensor chip is a simple open drain already. What is the point of using a custom protocol with a micro controller here instead of simply exposing the output of the sensor directly? I am sure you have good reasons @markniu but it would be nice if you could explain them.

bombela avatar Dec 12 '22 00:12 bombela

There is a progress for Bed Distance sensor working with klipper: can display the distance value on screen, homing, and still need some work for the probe, calibration ... image

the BDsensor is connected to mainboard not RaspberryPi, It's not recommend to connect to RaspberryPi for there maybe a sync problem while homing.

markniu avatar Dec 27 '22 07:12 markniu

Awesome! Really very interested in this. Does it work with a pei bed surface being magnetic? I have glass ATM. But thinking about getting pei.

Townie-au avatar Dec 27 '22 08:12 Townie-au

Awesome! Really very interested in this. Does it work with a pei bed surface being magnetic? I have glass ATM. But thinking about getting pei.

yes, I also test with the pei + steel + magnet on the bed

markniu avatar Dec 27 '22 08:12 markniu

There is a progress for Bed Distance sensor working with klipper: can display the distance value on screen, homing, and still need some work for the probe, calibration ... image

the BDsensor is connected to mainboard not RaspberryPi, It's not recommend to connect to RaspberryPi for there maybe a sync problem while homing.

Have you any news about bd sensor on klipper?

neshami avatar Jan 09 '23 00:01 neshami