naikymen / klipper-for-cnc

Fork of the Klipper 3D-printer firmware, plus features for more general CNC.
https://klipper.discourse.group/t/klipper-for-cnc-initiatives-and-projects-list/5698
GNU General Public License v3.0
66 stars 9 forks source link
automation cnc liquid-handling

Klipper for CNC

Welcome to my fork of the Klipper project, with home-able extruders, configurable extra ABC axes, and CNC-style probing!

Full changes and limitations stated further down this readme.

Use cases: as far as I can tell.

Follow the discussion over at Klipper's forum: https://klipper.discourse.group/t/12249

What you can expect:

Critical limitations: you should know this beforehand.

Disclaimers:

Klipper


Original Klipper docs

https://www.klipper3d.org/

Klipper is a 3d-Printer firmware. It combines the power of a general purpose computer with one or more micro-controllers. See the features document for more information on why you should use Klipper.

To begin using Klipper start by installing it.

Klipper is Free Software. See the license or read the documentation. We depend on the generous support from our sponsors.

Fork notes: 7+axis and more

Find the associated configuration examples at the following sections.

Changes and new commands

This fork implements:

Other changes:

Contributing: Interested in CNC stuff for Klipper?

Not-so-minor modifications to Klippy's core were made to accommodate these features.

Pull requests

Pull requests are very welcome over here, and will be merged quickly.

Buy me a beer

Show your love for this project through Liberapay: https://liberapay.com/naikymen <3

Also consider donating to upstream Klipper and its appendages.

Chat

Let's chat over here: https://klipper.discourse.group/t/klipper-forks-for-cnc/5698

Cheers!

Configs

See examples here: https://gitlab.com/pipettin-bot/forks/firmware/klipper-stack/-/tree/pipetting/printer_data/config

These are meant as soft reference configs; you must adjust them to match your setup before using them.

Pin mappings for the Arduino CNC-Shield (v3.0) have been added to this repo: generic-cnc-shield-v3.0.cfg

ABC axes

Most of the configuration is "stock". Only the [printer] section needs slightly different stuff:

[printer]
# Regular pritner configuration.
kinematics: cartesian_abc
# Units: mm/s and mm/s^2:
max_velocity: 5000    # F120000
max_z_velocity: 250   # F30000
max_accel: 1000
# Add ABC kinematics to the toolhead:
kinematics_abc: cartesian_abc
axis: XYZABC
# This tells the Moves which axes can "consume"
# acceleration from the above settings. It defaults
# to all axes. Any axes omitted from this setting
# will accelerate as fast as required (which might
# be impossible for your machine. BE WARNED).
# accel_limited_axes: XYZABC

Then configure the additional ABC steppers, exactly the ones specified in the axis parameter. For example, the ABC steppers can be configured just as you would the XYZ:

[stepper_a]
# Regular stepper configuration.
# ...

[stepper_b]
# Regular stepper configuration.
# ...

[stepper_c]
# Regular stepper configuration.
# ...

Examples:

What works:

Important TODOs:

PID sample averaging

This is meant to mitigate the effects of noisy ADCs in Arduinos, with great success. :)

The only new parameter is samples which can be added to a heater_generic section.

[heater_generic well_plate_heater]
# This is the new parameter.
# Set "samples" to an integer value "n". The last "n" measurements will be 
# then used to compute the P term (by averaging) and the D term (by regression).
samples: 10
# The rest of the config is standard stuff.
# See: https://www.klipper3d.org/Config_Reference.html#heater_generic
# ...

Extruder homing

Configure your extruders normally, and then add the required homing parameters. See notes below.

Any number of extruders can be configured to do homing. This requires:

[extruder]
# ...
# To enable homing on the extruder, setup all the 
# usual extruder parameters above, and then add the
# usual homing parameters used by regular steppers:
# See: https://www.klipper3d.org/Config_Reference.html#stepper
position_endstop: 0.0
position_min: 0.0    # LIMITS ARE ENFORCED
position_max: 100.0  # LIMITS ARE ENFORCED
homing_speed: 25.0
homing_positive_dir: False  # ADJUST TO MATCH YOUR SETUP
endstop_pin: gpio15  # REPLACE WITH THE PIN OF **YOUR** HOMING ENDSTOP

[extruder_home extruder]
# This section is required, but no parameters needed.

Usage notes:

Symmetric Extruder

A new configuration option was added to [extruder], called symmetric_speed_limits.

Setting this parameter to True will force speed and acceleration limits on all moves involving the extruder.

The limits are derived from max_extrude_only_velocity and max_extrude_only_accel as usual. The difference is in that they will be applied to all moves (and not to "extrude only" moves).

[extruder]
# ...
# ...
# When 'True', this new parameter allows applying speed limits symmetrically
# to extruder moves, which will always be enforced. Then 'False' (the default)
# the limits remain conditional (e.g. to the direction) as it is done for
# regular 3D-printer extruders.
symmetric_speed_limits: True
# ...

Single-probe

Simple enough. For reference, read: https://www.klipper3d.org/Config_Reference.html#probe

[probe_G38]
# See: https://www.klipper3d.org/Config_Reference.html#probe
recovery_time: 0.4
pin: gpio19
z_offset: 0

Usage notes:

Multi-probing

Note that this module also implements the regular G38.n commands added by [probe_G38] (hence the incompatibility), using the [probe_G38_multi] section associated to the active extruder by name.

For example, this means that:

Example configuration:

[probe_G38_multi extruder]
# This probe will be associated to the main [extruder] section.
recovery_time: 0.0
pin: ^tools:PC5
z_offset: 0

[probe_G38_multi my_probe]
# This probe will not be associated to an extruder (unless there is one named "my_probe").
recovery_time: 0.0
pin: ^tools:PB1
z_offset: 0

For convenience, their status can show up next to the endstops in Mainsail:

query_probe_endstops.png

Installation

The easiest way is to use a KIAUH "klipper_repos.txt" file. Details at: https://github.com/th33xitus/kiauh/blob/master/klipper_repos.txt.example

  1. SSH into the Pi.
  2. Copy "klipper_repos.txt.example" to "klipper_repos.txt".
    • Use the command: cp kiauh/klipper_repos.txt.example kiauh/klipper_repos.txt
  3. Edit the kiauh/klipper_repos.txt file to append "naikymen/klipper-for-cnc,pipetting" after the last line.
    • Use the command: echo "naikymen/klipper-for-cnc,pipetting" >> kiauh/klipper_repos.txt
  4. Start KIAUH.
    • Use the command: ./kiauh/kiauh.sh
  5. Choose option "6) [Settings]".
  6. Choose option "1) Set custom Klipper repository".
  7. Choose the option corresonding to "naikymen/klipper-for-cnc -> pipetting"
  8. Use KIAUH to uninstall and reinstall Klipper.
  9. Have fun!

Updates through moonraker

Thanks to some changes in upstream moonraker, a properly configured repo can be updated from Mainsail just as the original Klipper.