Saturday, April 8, 2023

Configuring the EZABL with Klipper on a Creality Ender 3 Pro

Trying to get my EZABL bed leveling sensor to work with Klipper on a Creality Ender 3 Pro took several hours and about 50 open browser tabs. Here is what I learned from this exercise so you don't have to go through the same thing. Here are the changes you'll need to make in your printer.cfg file:
  • Reconfigure the [stepper_z] section
  • Add a new [probe] section
  • Determine the correct pin configuration for [probe]
  • Add a new [safe_z_home] section
  • Configure the bed mesh

Reconfigure the [stepper_z] Section


The default [stepper_z] section for a Creality Ender 3 Pro looks like this:

[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: ^PA7
position_endstop: 0.0
position_max: 250

Since the EZABL acts as a Z-axis endstop, we will make the following changes:

[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop  #see note (1)
position_max: 250
position_min: -7  #see note (2)
  • (1) The endstop_pin setting will be replaced with 'probe:z_virtual_endstop', which is described in the excellent Klipper documentation here.  This basically tells the z axis that it will get it's endstop info from the probe section.
  • (2) The position_min setting will allow the Z axis to descend below zero while printing, depending on bed height variation.
  • If you followed the EZABL guide when you installed the sensor, you will remember that the sensor is positioned 1-2 mm above the nozzle.  You will also remember that you had to calibrate the sensor during installation by raising the nozzle another 2mm off the bed.  This means, if you followed all of the installation instructions, the sensor will be triggered when the nozzle is 2mm away from the bed.  We will deal with this later.


Add a new [probe] section


A section called [probe] will need to be added to your printer.cfg file.  Here is mine:

[probe]
# Pin for the z-min endstop input
pin: ^!PA7  #see note (1)
# Offset between the nozzle and the EZABL sensor, see note (2)
x_offset: 48.0  # (+) right of nozzle
y_offset: -2.0  # (-) behind nozzle
z_offset: 2.0   # (+) 2 mm above nozzle
speed: 5.0
lift_speed: 30.0
sample_retract_dist: 1.0
samples: 2
samples_tolerance_retries: 6

  • (1) the pin used for the Z-axis limit switch is used here.  Note that we added an exclamation point so that it reads ^!PA7 now!  We will determine the correct setting for the pin later, which is critical.
  • (2) I am using the Petsfang Bullseye cooling duct (went back to stock cooling in November, my updated config is linked below) and I also have a MicroSwiss printhead, so the position of my EZABL sensor is probably different from yours.  Adjust these to match your setup!

Determine the correct pin configuration for [probe]


⚠️This step is critical, not following these instructions can cause damage, be ready to switch the printer off in case the z-axis is lowered too far!

Position something underneath the EZABL probe (you can use your hand) such that the red light on the probe comes ON.  With the red light on, issue a M119 command in the Octoprint terminal:



You should see:

Send: M119
Recv: x:open y:open z:TRIGGERED

Great, the pin is configured correctly!

If you see this instead:

Send: M119
Recv: x:open y:open z:open

...then the pin configuration for the [probe] is incorrect.  The Z axis will probably only move UP, thinking that the z limit has been reached.  In this case, remove the exclamation from the pin configuration so that it reads:  pin: ^PA7, restart Klipper, and try this exercise again. It should read z:TRIGGERED when the sensor detects an object.

Add a new [safe_z_home] section


This section determines where the printhead will jog to before it starts to plunge downward and detect where the bed is.  

[safe_z_home]
home_xy_position: 110, 110 #see note (1)
speed: 200
z_hop: 10
z_hop_speed: 60

  • (1) you may want to adjust this for the size of your bed.

Perform z-axis offset calibration

Follow the steps here to calibrate the z probe offset.  After following the z offset calibration steps, you will see something like this automatically added to your printer.cfg:


#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [probe]
#*# z_offset = 2.700

 

Configure the bed mesh


Add [bed mesh] to config.  This specifies how many mesh points for bed leveling and where those points are.  For more details see the Klipper documentation.

⚠️ You may want to tweak the mesh_min and mesh_max points for your setup.

[bed_mesh]
speed: 120  #how fast to move between points 
horizontal_move_z: 5  #how much the z axis rises between points
mesh_min: 60, 20  #the x,y location of the first mesh point
mesh_max: 200, 200   #the x,y location of the last mesh point
probe_count: 3  # 3x3 grid


Make Klipper understand the G29 command


The G29 command is the bed-leveling command that you may have set already in your slicer start code.  Unfortunately, this command is not natively understood by Klipper.  Fortunately, this is easy to fix.  You can make Klipper understand G29 by adding these lines to your config file:

[gcode_macro G29]
gcode:
 BED_MESH_CALIBRATE

That should be it.  If you already had the EZABL working before, it should work almost exactly the same way now.

Update 28-May-2023; Improved G29 command


This is an update to the G29 command that will grab the target temps of the extruder and the bed, turn off the heaters before meshing, and then turn the heaters back on, waiting for them to reach temp before continuing.  

[gcode_macro G29]
gcode:
  {% set BED_TEMP = printer.heater_bed.target %}
  {% set EXTRUDER_TEMP = printer[printer.toolhead.extruder].target %}
  TURN_OFF_HEATERS
  BED_MESH_CALIBRATE
  # turn on heaters
  M140 S{BED_TEMP} ; set bed temp
  M104 S{EXTRUDER_TEMP} ; set extruder temp
  M190 S{BED_TEMP} ; wait for bed
  M109 S{EXTRUDER_TEMP} ; wait for extruder

Update 19-Nov-2023

Here is my Klipper config file as a github.com gist.






Saturday, September 10, 2022

Downriver Walleye Federation Waypoints GPX file

Yesterday I wrote a simple Python script to convert the waypoints from the the Downriver Walleye Federation waypoints page (a text format) into gpx, and I tested the result using gpx.studio.  You can easily upload this gpx file into your fish finder or GPS.

There were a few typos/errors in the original data that I corrected, as well as removal of some waypoints that were plotted in the middle of Ohio.

I make no claim as to the accuracy of these points, they are reproduced here as a gpx file for reference only.  Any damage, loss, injury, etc resulting from the use of these coordinates is entirely your responsibility.

You can download the gpx file here.

Thanks again to the Downriver Walleye Federation for the original data.



Saturday, January 29, 2022

Micro Swiss Direct Drive Installation for Creality Ender 3 Pro with a Press-Fit Extruder Gear

I'm installing the Micro Swiss direct drive kit for my Ender 3 Pro and I encountered two problems: 

  1. The drive gear on my machine is pressed onto the stepper motor rather than held in place with a set screw.
  2. The stepper motor shaft is round and does not have a flat keyway.  The Micro Swiss kit depends on the shaft having a flat spot on it for the new gear.


Ender 3 Pro extruder stepper motor with pressed-on brass gear.
 (note a drop of penetrating oil in the center)



Creality Press-Fit Extruder Gear Removal

I read at least one claim that this gear easily pulls off with a pair of pliers; unfortunately I found that to not be the case with my motor and gear.

Here is how I got the little gear off:

  • Apply a little penetrating oil to the interface between the gear and the shaft.  I used PB Blaster, WD-40 will work fine as well.
  • Heat the gear with a MAP gas torch (the same kind used for soldering plumbing joints).  You could probably use one of those little butane torches used for lighting cigars as well.  Brass expands quite a bit when heated, so to increase your chances of success, heat the brass gear heavily and avoid applying heat anywhere else on the drive gear.
  • Clamp the gear into a bench vice, and position a couple of wrenches as in the picture below:

Using a couple of wrenches to pop the brass gear off of the motor.

(My vice was frosty -- it was in the negative teens here in Michigan this morning!)

  • Gently tap the end of the wrench in the photo (see red arrow) with another wench.  The metal-to-metal impact should jar the heated brass gear loose.  This is a precision stepper motor, so do not use a hammer!
  • Be careful, this is not the correct way to remove this gear.  The correct way to do this is with a tiny bearing puller like this one as it will not apply any force to the internals of the motor.  Rather, the bearing puller will only apply force inward to the end of the shaft and an equivalent force outward to both sides of brass gear.  The method shown here will transfer whatever force you apply to the gear to the entire length of the drive shaft as well as the internals of the motor.  Proceed with caution and at your own risk.
  • If you choose not to heat the gear, it will be harder to remove and you could increase the risk of motor damage.  Apply heat to the brass gear and use light, gentle taps; the impact force should knock it loose.

Add Missing Flat to Drive Shaft

When you install the new Micro Swiss direct drive gearset, the included gear has a small set screw that is intended to sit onto the flat portion of the shaft.  From the Micro Swiss installation instructions:

Step 14 of Micro Swiss direct drive installation instructions 


Since my machine does not have a flat part of the drive shaft, I had to add one as follows:
  • Follow the Micro Swiss installation instructions for aligning the new filament drive gears.
  • Proceed to tighten down the set screw *as if* there were a flat spot in the shaft.  This step will make a tiny witness mark (scratch) in the shaft that you will use to determine where to grind the shaft down
  • Release the set screw and remove the Micro Swiss drive gear.
  • Use a magnifying glass, if necessary, to examine the surface of the shaft; you should see a tiny witness mark where the set screw was tightened down.  (The shaft is hard steel and it may be hard to see this mark!)
  • Use an abrasive wheel (I used a cut-off disc) to gently grind an area away on the shaft where the witness mark was.  I went several millimeters on either side of the witness mark.  See below:

Creating a flat in the stepper motor drive shaft for Micro Swiss gear installation.

  • Follow the Micro Swiss installation instructions for gear alignment *again* but make sure the set screw is directly over the new flat spot that you just made.  
  • Tighten the set screw down against the new flat spot once you are satisfied with drive gear alignment.
I hope this helps you with your Micro Swiss direct drive installation.