Help with bltouch

im hoping someone can help with this, I’m running klipper/moonraker/mainsail on a raspi 3b connected to an anet a8 motherboard. The electronics are pretty much stock for an a8 and I have been running with a capacitive sensor for years.

I’m replacing the capacitive sensor with a bltouch to dial out some occasional issues with inaccuracies of the capacitive sensor. Anyway - I bought a bltouch clone (chinese ebay special) and had a bunch of issues with it not reporting the trigger state and frequently going into an error state (flashing red light). I tried the suggestions on the klipper bltouch documentation page without success. Eventually I gave up an ordered a genuine bltouch hoping that it would work out of the box… but I have pretty much the same issues.

Initially I had connected the bltouch to the anet motherboard but after reading that I might be required to remove components from the board (https://www.reddit.com/r/AnetA8Plus/comments/pj1sfd/complete_anet_a8_plus_bltouch_klipper_wiring/) for it to work I decided to just hook it up to the GPIO pins on my raspi. I followed the instructions here: HowTo Run BLTouch connected to RPi microcontroller [3DPrint.Wiki]

After some issues I double checked the official wiring for the bltouch 3.1 (the model I have) which states it should run off 5v and NOT 3.3v which the wiki recommends. I swapped it over to use a 5v power supply and still have some problems.

  • power the unit on, it does the self test and all good
  • BLTOUCH_DEBUG COMMAND=pin_up and BLTOUCH_DEBUG COMMAND=pin_down both work as expected
  • BLTOUCH_DEBUG COMMAND=touch_mode enabled and QUERY_PROBE reporting open as expected
  • gently touch the pin and QUERY_PROBE still reporting open, despite the bltouch led turning red
  • push the bltouch pin back up until it locks itself (replicating it smashing into the bed), still reporting open
  • BLTOUCH_DEBUG COMMAND=reset
  • BLTOUCH_DEBUG COMMAND=pin_down
  • BLTOUCH_DEBUG COMMAND=touch_mode
  • QUERY_PROBE reporting open
  • touch the end, still reporting open

So it looks like its screwed, right? But…

  • BLTOUCH_DEBUG COMMAND=reset
  • run G28 with a piece of card under the bltouch… works fine

Restart klipper, then G28: BLTouch failed to verify sensor state. Sometimes this happens 3 times and shuts the printer down; other times it works on one of the retries. Set pin_up_touch_mode_reports_triggered: False as per the docs (despite this not being a clone).

  • run G28 against the bed. Works.
  • run G28 again. Nozzle crashes into the bed and No trigger on z after full movement

I really dont want to give up and go back to my capacitive sensor but this is really frustrating. Can anyone help? Here’s the relevant part of my printer.cfg

[mcu rpi]
serial: /tmp/klipper_host_mcu

[bltouch]
sensor_pin: ^rpi:gpio0
control_pin: rpi:gpio27
x_offset: -25.5
y_offset: 0.2
z_offset: 1.865
#probe_with_touch_mode: True
pin_up_touch_mode_reports_triggered: False

[safe_z_home]
home_xy_position: 100, 100
speed: 50
z_hop: 10
z_hop_speed: 5

Hello @jeffers !

Actually there can be more relevant than this.
Please share the complete printer.cfg or the klippy.log as file.

Sure, here you go!
printer.cfg (7.2 KB)

Is there a special reason to wire the BLtouch to the RPi instead of the MCU?
I would not go this route as especially when pullups are needed the RPi can be problematic.

Yeah, I’d prefer not to have to remove components from the mainboard, as described in the first post. My understanding is that gpio0 on a raspi has an inbuilt pullup which is always active - I assume others are running this setup without issue?

The Kernel interface that Klipper uses on the RPi often (always?) does not allow to set the pullup of GPIOs.

FWIW, I have not come across someone who has connected his BLtouch to the RPi. Cannot offer any more advice.

Anyone else have any suggestions? I didnt think a bltouch connected to a raspi was such a rare setup

Actually there is also no solution for the BLTouch connected to the Pi for OctoPrint that I know of.

There are limitations that apply to the Raspberry Pi’s GPIOs and the Linux Kernel. I wouldn’t classify these limitations as a bug in Klipper as there is only so much that can be done in software to compensate for these limitations. Also, with regard to the internal pullups, even if Klipper supported enabling them I suspect that they are too weak for the BLTouch.

That said, according to the Pi 3B schematic there are no hardware pull-ups on GPIO0 or GPIO1. In fact the schematic is pretty clear in telling you that these pins are reserved for identifying hats and they should not be used for anything else. Its possible that the Kernel enables internal pullups on these pins, however as mentioned above they are likely too weak.

There are however 1.8K pullups on the i2c pins (gpio2 and gpio3). They might be a bit strong, but its possible you will have more success with using one of them as the sensor pin.

Just want to chime in, I also was hit by this issue. What I was seeing was that the probe wouldn’t always deploy when asked (you could bounce back and forth issuing pin_up and pin_down commands, and perhaps every fifth command would fail to act).

I moved the sensor pin to GPIO2 and did a manual pullup on the control pin (GPIO27) with a 10K resistor. Once this was done it seems to properly deploy every time, and I can complete a bed level probe with 12 points)

Hmm, I’m back because I celebrated prematurely. The successful bed level was a fluke. Even with hardware pullup, and a shielded cable, the issue persists. This could be an issue with the pi software module itself.

Mhh I also want to try this because I have an old 8bit bord for my ender 3, did you try also an other pi ? maybe just the Pin was broken ? In general I like the idea to put non critical stuff like BL or filament runout sensor on the PI.

Hi All, @jeffers ,
Was this issue resolved? I have a very similar problem with my Creality clone BLtouch probe. I’ve verified the pin assignments and the up/down commands work, but i am not able to get G28 to work repeatably.

i’m having same issue, i’m using only control pin connected on raspberry, and sensor pin connected to board (i have only one pin free) sometimes during mesh bed i’m having this issue BLTouch “failed to verify sensor state” and bed hit the nozzle. It start happening when i switch to rasp gpio pin, before i had another pin on control board (i fired that pin, maybe a short)