Need help BLTouch problem on Sunlu S9 Plus port to Klipper

Basic Information:

Printer Model: Sunlu S9 Plus
MCU / Printerboard: AVR atmega2560 16MHz chip and is a Ramps v1.0 pinout
klippy.log (632.8 KB)
klippy.log

Describe your issue:

BLTouch help

I am porting a SUNLU S9 Plus from Marlin to Klipper. I have everything working as far as I can tell except the BLTouch. I even have the attached Drybox working :blush:. My problem is that the BLTouch will operate but will not return an Open/Triggered signal as it should. The BLTouch does do its pretest on startup activating the pin twice.

This machine uses a “3D TOUCH” clone device.

Being new at this, deciphering the Marlin pins to Klipper pins has been challenging but thanks to this VERY HELPFUL post I was able to finally understand how to do the mapping. Marlin Pins, Arduino Pins and Actual pins

The Sunlu S9 uses an AVR atmega2560 16MHz chip and is a Ramps v1.0 pinout.

This is the link to the Marlin source code if you want to see it all: http :// 3dsunlu. com/en/NewsDetail/3912708. html (I have to break the links in order to upload. Just remove the extra spaces.)

Here are snippets of the source files which seem to relate to the BLTouch:

-------------configuration.h-------------
#ifndef MOTHERBOARD
  #define MOTHERBOARD BOARD_MKS_BASE
#endif

//
// See https://marlinfw.org/docs/configuration/probes.html
//

/**
 * Enable this option for a probe connected to the Z-MIN pin.
 * The probe replaces the Z-MIN endstop and is used for Z homing.
 * (Automatically enables USE_PROBE_FOR_Z_HOMING.)
 */
#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

-------------PINS.H-------------
#elif MB(MKS_BASE)
  #include "ramps/pins_MKS_BASE_10.h"           // ATmega2560       env:mega2560

-------------pins_MKS_BASE_10.h-------------
#include "pins_MKS_BASE_common.h"

-------------pins_MKS_BASE_common.h-------------
#include "pins_RAMPS.h"

-------------pins_RAMPS.h-------------
//
// Servos
//
#ifndef SERVO0_PIN
  #ifdef IS_RAMPS_13
    #define SERVO0_PIN                         7
  #else
    #define SERVO0_PIN                        4//11//for bltouch  PG5
  #endif
#endif

//
// Limit Switches
//
#ifndef Z_STOP_PIN
  #ifndef Z_MIN_PIN
    #define Z_MIN_PIN                         18          //PD3
  #endif
  #ifndef Z_MAX_PIN
    #define Z_MAX_PIN                         19          //PD2
  #endif
#endif

//
// Z Probe (when not Z_MIN_PIN)
//
#ifndef Z_MIN_PROBE_PIN
  #define Z_MIN_PROBE_PIN                     32//no use   //PC5
#endif
#endif

-------------SanityCheck.h-------------
  #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
    #if DISABLED(USE_ZMIN_PLUG)
      #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires USE_ZMIN_PLUG to be enabled."
    #elif !HAS_Z_MIN
      #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires the Z_MIN_PIN to be defined."
    #elif Z_MIN_PROBE_ENDSTOP_INVERTING != Z_MIN_ENDSTOP_INVERTING
      #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_INVERTING to match Z_MIN_PROBE_ENDSTOP_INVERTING."
    #endif
  #elif !HAS_Z_MIN_PROBE_PIN
    #error "Z_MIN_PROBE_PIN must be defined if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is not enabled."
  #endif

From the marlin reference: https ://marlinfw .org/docs/configuration/probes. html

Before configuring any bed probe be sure to read its documentation and the documentation for your electronics (I wish I had some :frowning:). Make sure you know to which pins the probe will be connected (thanks a lot :frowning:). Marlin provides reasonable defaults, but they will not apply to every situation.
In general, on deltabots the probe should be connected to the unused Z-Min endstop pin (if there is one). On machines that use Z-min for an endstop, the Z-Max pin is recommended next, so this is set as the default alternative on most boards.
• If the probe is connected to the Z-Min pin, enable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN.
• For Marlin 2.0.5.2 and earlier, if the probe is connected to any other pin, enable Z_MIN_PROBE_ENDSTOP.
• The probe-specific pin is defined with Z_MIN_PROBE_PIN. Most boards have a default, but it can be overriden in the configuration.

============================================================
So this is what I have so far ….
[bltouch]
control_pin: PG5 works to raise and lower the BLTouch pin. This is SERVO0_PIN and is Digital pin 4.
However, the sensor_pin does not work. From the information above, it should be on the Z-Min pin:

#define Z_MIN_PIN                18                //PD3

The other options might be:

#define Z_MIN_PROBE_PIN  32 //no use  //PC5
#define Z_MAX_PIN               19                //PD2

Note the Z_MIN_PROBE_PIN is marked as “no use”

If you look in the klippy.log you will see that I have tried all of these. PD3 is always OPEN and the other two are always TRIGGERED.

So, this is where I am. If I can get the Touch to work, I will have successfully ported the Sunlu S9 Plus to Klipper and will share the configuration with everyone interested. Any help would be very greatly appreciated.

Here are the results of the tests:

[bltouch]
sensor_pin: ^PD3   #^PD3 Z_MIN_PIN    #^PC5 Z_MIN_PROBE_PIN   #^PD2 Z_MAX_PIN 
control_pin: PG5    #SERVO0_PIN  4
#pin_up_touch_mode_reports_triggered: False

12:35 AM probe: open
12:35 AM QUERY_PROBE
12:35 AM Sending BLTOUCH_DEBUG COMMAND=pin_up
12:35 AM BLTOUCH_DEBUG COMMAND=pin_up
12:35 AM probe: open
12:35 AM QUERY_PROBE
12:35 AM Sending BLTOUCH_DEBUG COMMAND=touch_mode
12:35 AM BLTOUCH_DEBUG COMMAND=touch_mode
12:35 AM Sending BLTOUCH_DEBUG COMMAND=pin_down
12:35 AM BLTOUCH_DEBUG COMMAND=pin_down

[bltouch]
sensor_pin: ^PD3   #^PD3 Z_MIN_PIN    #^PC5 Z_MIN_PROBE_PIN   #^PD2 Z_MAX_PIN 
control_pin: PG5   #SERVO0_PIN  4
pin_up_touch_mode_reports_triggered: False

12:40 AM probe: open
12:40 AM QUERY_PROBE
12:40 AM Sending BLTOUCH_DEBUG COMMAND=pin_up
12:40 AM BLTOUCH_DEBUG COMMAND=pin_up
12:40 AM probe: open
12:40 AM QUERY_PROBE
12:40 AM Sending BLTOUCH_DEBUG COMMAND=pin_down
12:40 AM BLTOUCH_DEBUG COMMAND=pin_down

[bltouch]
sensor_pin: ^PC5   #^PD3 Z_MIN_PIN    #^PC5 Z_MIN_PROBE_PIN   #^PD2 Z_MAX_PIN 
control_pin: PG5   #SERVO0_PIN  4
#pin_up_touch_mode_reports_triggered: False

12:42 AM probe: TRIGGERED
12:42 AM QUERY_PROBE
12:42 AM Sending BLTOUCH_DEBUG COMMAND=pin_up
12:42 AM BLTOUCH_DEBUG COMMAND=pin_up
12:42 AM probe: TRIGGERED
12:42 AM QUERY_PROBE
12:42 AM Sending BLTOUCH_DEBUG COMMAND=touch_mode
12:42 AM BLTOUCH_DEBUG COMMAND=touch_mode
12:42 AM Sending BLTOUCH_DEBUG COMMAND=pin_down
12:42 AM BLTOUCH_DEBUG COMMAND=pin_down

[bltouch]
sensor_pin: ^PC5   #^PD3 Z_MIN_PIN    #^PC5 Z_MIN_PROBE_PIN   #^PD2 Z_MAX_PIN 
control_pin: PG5   #SERVO0_PIN  4
pin_up_touch_mode_reports_triggered: False

12:44 AM probe: TRIGGERED
12:44 AM QUERY_PROBE
12:44 AM Sending BLTOUCH_DEBUG COMMAND=pin_up
12:44 AM BLTOUCH_DEBUG COMMAND=pin_up
12:44 AM probe: TRIGGERED
12:44 AM QUERY_PROBE
12:44 AM Sending BLTOUCH_DEBUG COMMAND=touch_mode
12:44 AM BLTOUCH_DEBUG COMMAND=touch_mode
12:44 AM Sending BLTOUCH_DEBUG COMMAND=pin_down
12:44 AM BLTOUCH_DEBUG COMMAND=pin_down

[bltouch]
sensor_pin: ^PD2   #^PD3 Z_MIN_PIN    #^PC5 Z_MIN_PROBE_PIN   #^PD2 Z_MAX_PIN 
control_pin: PG5   #SERVO0_PIN  4
#pin_up_touch_mode_reports_triggered: False

12:46 AM probe: TRIGGERED
12:46 AM QUERY_PROBE
12:46 AM Sending BLTOUCH_DEBUG COMMAND=pin_up
12:46 AM BLTOUCH_DEBUG COMMAND=pin_up
12:46 AM probe: TRIGGERED
12:46 AM QUERY_PROBE
12:46 AM Sending BLTOUCH_DEBUG COMMAND=touch_mode
12:46 AM BLTOUCH_DEBUG COMMAND=touch_mode
12:46 AM Sending BLTOUCH_DEBUG COMMAND=pin_down
12:46 AM BLTOUCH_DEBUG COMMAND=pin_down

[bltouch]
sensor_pin: ^PD2   #^PD3 Z_MIN_PIN    #^PC5 Z_MIN_PROBE_PIN   #^PD2 Z_MAX_PIN 
control_pin: PG5   #SERVO0_PIN  4
pin_up_touch_mode_reports_triggered: False

12:49 AM probe: TRIGGERED
12:49 AM QUERY_PROBE
12:49 AM Sending BLTOUCH_DEBUG COMMAND=pin_up
12:49 AM BLTOUCH_DEBUG COMMAND=pin_up
12:49 AM probe: TRIGGERED
12:49 AM QUERY_PROBE
12:49 AM Sending BLTOUCH_DEBUG COMMAND=touch_mode
12:49 AM BLTOUCH_DEBUG COMMAND=touch_mode
12:49 AM Sending BLTOUCH_DEBUG COMMAND=pin_down
12:49 AM BLTOUCH_DEBUG COMMAND=pin_down

As a sanity check, I reinstalled the Sunlu Marlin firmware to the printer to ensure that the Touch is actually still functioning, and it is working fine. That seems to imply to me that the signal pin is different than the one’s listed above that don’t work or else I am doing something stupid (it wouldn’t be the first time).

So, there you have it. If you are still with me, thank you very much. Any help would be greatly appreciated. I’m at the end of my ability.

1 Like

Hello @weeksrw !

When you post code snippets, please use the Preformatted Text feature of the forum editor to give them the proper form. Else information can get lost, e.g. important spaces.

Format

Sorry, I’m new to this. Apparently when I go back to edit it, the option doesn’t seem to be there anymore.

It should, the editor features do not change.

It should be better now. Thanks for letting me know. That helps a lot. :grinning:

In your config snippets I notice a lot of comments.

Be aware that there is a space between the comment sign (#) and the following text.
So

[bltouch]
sensor_pin: ^PD2   # ^PD3 Z_MIN_PIN    # ^PC5 Z_MIN_PROBE_PIN   # ^PD2 Z_MAX_PIN 
control_pin: PG5   # SERVO0_PIN  4
pin_up_touch_mode_reports_triggered: False

instead of

[bltouch]
sensor_pin: ^PD2   #^PD3 Z_MIN_PIN    #^PC5 Z_MIN_PROBE_PIN   #^PD2 Z_MAX_PIN 
control_pin: PG5   #SERVO0_PIN  4
pin_up_touch_mode_reports_triggered: False

With 3D Touch you have a look onto the different settings here:

https://www.klipper3d.org/BLTouch.html#bl-touch-clones

If you have a genuine BLtouch v3, you may also look here:

https://www.klipper3d.org/BLTouch.html#bl-touch-v3

With a BLtouch, you usually home Z to min position, so PD3 should be the proper sensor_pin for the BLtouch.

[bltouch]
sensor_pin: ^PD3
...

You also may have a look on this thread:

I’m looking at this post SKR Mini E3 V2 with BLTouch connected to Z-STOP. ^PC2 always says open
and I wonder if actually I don’t even have a problem. I will test it when I next get a chance.

1 Like

OK! IT WORKS JUST FINE!

So from the above link which also references this link BLTouch clone not supported in Klipper. Always reports open or TRIGGERED despite trying every single combination · Issue #5080 · Klipper3d/klipper · GitHub as per this contributors experience I just tried to Z home onto a piece of foam and it works as expected using the Z_MIN_PIN, PD3 in this case.

As commented in the other issue, the problem appears to be that the clone BLTouch does not implement touch mode. The QUERY_PROBE fails because the trigger signal is only present for a short time. Since touch mode is not implemented, the signal is not saved so then when you run the QUERY_PROBE command, the signal as gone away. The probe functions just fine, however, because the software is watching the signal pin while you are homing and sees the triggered signal as it happens and stops the motors.

If you carefully read the klipper documentation, it is indicated that this can be a problem but it doesn’t explain very well that the QUERY_PROBE won’t work and that the testing procedure doesn’t work either. I see that lots of people have spent a lot of time chasing this problem just as I have.

A simple addition to the klipper testing doc indicating that the procedure may not work with clone probes would be really helpful. Just saying.

Thank you @EddyMI3D for your quick response and helpful information. I really appreciate it. I hope that these comments will be helpful for anyone else struggling with this issue.

1 Like