# Klipper

Fast 3D Printing with Raspberry Pi - klipper3d.org / github / r/klippers / ender6:7125/

KLIPPER Command

Easiest way to invoke a FIRMWARE_RESTART from the command-line is to run (this work for any GCODE):

echo FIRMWARE_RESTART > /tmp/printer

The default Klipper startup script places a log in /tmp/klippy.log which provides more detailed information.

tail -f /tmp/klippy.log

Troubleshooting

If does not start and complain about

  File "/home/pi/klipper/klippy/util.py", line 42, in create_pty
    os.symlink(filename, ptyname)
OSError: [Errno 17] File exists

It’s probably because it can create /tmp/printer. remove that symbolic link

Klipper features

Install

May Run as docker Image (but does not interact with octoprint) Current install run klipper directly on PI in which case Moonraker has to be able to acess klipper via unix-socket.

KIAUH

Can be used to setup local install + additionnal tools. CLI Menu that allow to install / remove.

$ cd ~ && git clone https://github.com/dw-0/kiauh.git
$ ~/kiauh$ ./kiauh.sh 

Troubleshooting

websockets.py:build_error() - json-rpc request error method not found #405 - UI does not connect to Klipper - Please check if the Klipper service is running and an UDS (Unix Domain Socket) is configured #261

For whatever reason, moonraker was looking into /tmp/klippy_uds, the klipper default

Docker images available:

Configuring Klipper

The Klipper configuration is stored in a text file on the Raspberry Pi.

Starting from ramp config. cp ~/klipper/config/generic-ramps.cfg ~/printer.cfg

Config can reference other config through [include x] mechanism.

Verify config

Finding Serial ports (MCU)

Setup for Octoprint

  1. Install octoprint
  2. Follow instructions
  • ssh to pi@octopi
  • run commands
git clone https://github.com/KevinOConnor/klipper
./klipper/scripts/install-octopi.sh

The above will download Klipper, install some system dependencies, setup Klipper to run at system startup, and start the Klipper host software. It will require an internet connection and it may take a few minutes to complete.

Flashing firmware

compile code

cd ~/klipper/
./scripts/install-octopi.sh     # this install dependancies as well as some bash config that you may want to disable in script 
make menuconfig                 # see below
make

make menuconfig not working #3669 -> workaround => export LC_ALL=C

Finally, for common micro-controllers, the code can be flashed with: Make sure octoprint is disconnected before.

sudo service klipper stop
make flash FLASH_DEVICE=/dev/ttyUSB0
sudo service klipper start

Make sure to restart board afterward: power off/on printer

Moonraker (Optional) - Klipper API

This is necessary to expose Klipper as a REST API, which can be used by Webclient interface like Fluidd or Mainsail. It can esealy be installed with KIAUH

If going through manual install

Enabling the Unix Socket Add -a /tmp/klippy_uds to KLIPPY_ARGS in /etc/systemd/system/klipper.service

and maybe change printer.cfg path as well…

Moonraker depends on the following Klippy extras for full functionality:

  • [virtual_sdcard]
  • [pause_resume]
  • [display_status]

to install with moonraker.conf in the config_path:

cd ~/moonraker/scripts
./install-moonraker.sh -f -c /home/pi/printer_config/moonraker.conf

see Moonraker’s full configuration for futher doc.

Configure Octoprint to use Klipper

see also Fluidd which use Moonraker API and is more integrated with Klipper.

There is the OctoKlipper plugin that provide some interface and ui in octoprint.

power control on Klipper

see also

Written on December 28, 2017, Last update on June 15, 2024
3dprinter klipper