Preface
The official installation instructions use Octoprint as a control interface. Nowadays, most setups involve Moonraker and fluidd / Mainsail as the primary ways to interact and control a Klipper printer.
The manual configuration of these components is quite involved, so this article will employ KIAUH, a superb shell script that conveniently handles the initial setup process.
This guide will only cover the basic setup, but there is a lot more to discover.
Content
Initial Considerations
For better understanding, some background information:
-
Klipper requires a constant and stable connection between a host process running on a personal computer and the printer board. It is common to use Single Board Computers (SBC) such as the Raspberry Pi, but any current SBC will do the job. See Other Single Board Computers (SBC) apart from Raspberry Pis for more details.
-
The Klipper concept includes several interdependent and interacting products. To gain an understanding of the system, refer to Klipper Architecture / Ecosystem.
-
Some hardware, especially displays, may not have full support from Klipper. It is advisable to carefully examine the configuration files for a particular printer model to ensure that all hardware is compatible. For instance, the absence of a
[display]
section in a file strongly suggests that the printer’s stock display is not currently supported.
Prepare The Host
On the host computer, a Linux operating system must be running.
-
This guide will assume the use of a Raspberry Pi (RPi).
-
If setting up a different SBC, the approach must be tailored accordingly.
- For example the popular Armbian distributions offer a comparable approach by using
armbian-config
as opposed toraspi-config
(see below) - If you are installing another Linux distribution, in any case, check OS Sanity Checks and Fixes
- For example the popular Armbian distributions offer a comparable approach by using
-
For Raspberry Pi it might be preferable to use 32bit versions, especially when using CAN setups (there are reports of issues with CAN and 64bit Kernels).
Setting up the SD Card
-
Get, install and run the Raspberry Pi Imager
-
Choose the proper OS you want to use. Popular choices are
- Mainsail OS (Other specific-purpose OS → 3D Printing → Mainsail OS)
Mainsail OS comes with Klipper / Mainsail preinstalled, so you can skip installing them later - Raspberry Pi OS lite
- Mainsail OS (Other specific-purpose OS → 3D Printing → Mainsail OS)
-
With the symbol, some settings can be baked into the image that can make the setup easier:
-
Prepare the SD card and proceed to boot the RPi with it. It is advisable to connect the RPi to a monitor and keyboard. Some distributions require manual intervention to complete the setup process.
Completing the RPi OS Setup
-
Run
sudo raspi-config
- 1 System Options → S1 Wireless LAN → Follow the WIFI setup (skip for using Ethernet)
- 3 Interface Options → I2 SSH → Enable yes
- 3 Interface Options → I4 SPI → Enable yes
- 3 Interface Options → I5 I2C → Enable yes
- 6 Advanced Options → A1 Expand Filesystem
-
Get the IP address of the RPi and write it down. To accomplish this, execute the following command:
hostname -I
-
Make sure your Linux is updated to the current state. Run
sudo apt update sudo apt upgrade
-
Reboot via
sudo reboot now
OS Sanity Checks and Fixes
This is applicable not only to RPi, but to any Linux OS:
- Fix a Debian Bullseye bug leading to lost MCU serials: Debian 11 (Bullseye) udev bug - No board or serial found
- Disable certain unwanted Linux services that can interfere with Klipper’s operation: BRLtty / ModemManager - Services Interfering with Klipper
Accessing the RPi via SSH
Usually, a monitor is not connected to the RPi and administration is executed “headless” using SSH. In the previous step, the SSH server was enabled, so this access should now work with either the configured or default username, password, and IP address.
After the initial setup is completed, most tasks can get done using the web-based interfaces. Familiarity with these tools, especially when troubleshooting, is strongly recommended.
Common tools to work with SSH are:
-
Windows
-
macOS
-
Linux typically has the options on board already, e.g. in Nautilus, Thunar, Konqueror and the Terminal app.
Install the Klipper Ecosystem
This chapter outlines the steps necessary to perform a basic setup of Klipper with KIAUH.
Install and Run KIAUH
Run the following commands:
sudo apt-get install git -y
cd ~
git clone https://github.com/dw-0/kiauh.git
./kiauh/kiauh.sh
Install Klipper and Associated Products
In KIAUH follow this simple sequence:
-
Choose
1) [Install]
-
Choose
1) [Klipper]
- Choose Python 3
- Choose the number of instances. Typically 1, unless you want to run more than one printer off the same host SBC
- Answer any question about missing group membership with Yes
-
Followed by
2) [Moonraker]
-
Install the web-interface of your choice:
3) [Mainsail]
and / or4) [Fluidd]
- Installing both is possible
- The first one installed will be accessible via port 80, the second one via the port given during installation, e.g. 81
- Confirm questions about downloading any macro files.
-
Hit
B
to go back to main menu -
On your main personal computer, use your browser to navigate to
http://the_IP_you_noted_earlier/
to access the web-interface for the first time
-
Download the appropriate configuration file for your printer / printer-board (screenshots from fluidd)
- Move to Configuration (Machine in Mainsail) in the left-hand side menu
- Choose Other Files → Config_Examples (Drop-down in Mainsail)
- Select the matching printer model or board, right click and select Download
- Move to Configuration (Machine in Mainsail) in the left-hand side menu
-
Open the downloaded file in a proper editor, e.g. Notepad++ (Windows only) or Sublime Text (also macOS)
Build and Flash the Firmware
In the previous step, the installation of the host components on the SBC was completed. The next task is to build and flash the firmware component on the printer-boards.
-
Carefully review the initial lines of the configuration file downloaded in the preceding step, as it contains important information.
- It provides instructions on how to build the firmware and which build settings to choose
- Information how to install it on the Printer-Board
-
To build the firmware, select 4) [Advanced] and then 2) [Build only] in KIAUH.
-
Enter the information from the configuration file in the screen that appears. To establish a connection to the board later on, it is crucial to adhere to all settings.
- Complete the setup by selecting
Q
to confirm and save the settings.
- Complete the setup by selecting
-
The firmware file will be generated at
~/klipper/out/klipper.bin
. Flash the board based on the instructions provided in the configuration file.- The flashing functions in KIAUH under 4) [Advanced] can be used as well, but for the first time setup, the manual approach is recommended
- If the instructions call for a specific flashing command, the command
will provide the required target addressls /dev/serial/by-id/*
- The most common command to flash the board is (also used if no other specific command is mentioned in the configuration file):
sudo service klipper stop make flash FLASH_DEVICE=<the_complete_target_address_from_above> sudo service klipper start
- If the instructions call for copying the bin-file to the SD card, tools like the above-mentioned WinSCP can be used. Only copy and potentially rename the
klipper.bin
to a SD card, not the entire folder
Configuring Klipper
Initial Configuration
-
In KIAUH call 4) [Advanced] and then 5) [Get MCU ID] or run the command
ls /dev/serial/by-id/*
in the shell.
-
Copy the complete path as displayed, e.g.
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
-
Paste the copied address into the configuration file that has been downloaded and opened in a editor above. It should then look like:
[mcu] serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
-
Also add the web interface specific macro to the configuration file. This can either be
fluidd.cfg
ormainsail.cfg
depending on the web interface that is used. The config shall then include a section like[include fluidd.cfg] # Alternatively: [include mainsail.cfg]
- Do not add both. One of them is sufficient for both web interfaces
- Note that this file contains macro definitions for
CANCEL_PRINT
,PAUSE
,RESUME
etc. Avoid adding duplicate definitions anywhere else in the configuration files. - For further information, refer to Mainsail Configuration
-
Save the adapted configuration as
printer.cfg
-
Upload the
printer.cfg
via the Configuration section in the web interface (Mainsail dropdown → config). The default path on OS level is~/printer_data/config
-
Restart Klipper either via the web interface or via issuing the command
sudo systemctl restart klipper
Verify Basic Functionality
With the above steps, the basic setup is completed and the web interface should show the temperatures of the bed and extruder and not display any errors.
The following step should now be performed to ensure a proper basic functionality: Configuration Checks and, if using a BLTouch (or clone), its Initial Tests.
Troubleshooting
If there are any problems or error messages at the end of this simple installation process, it is time to troubleshoot your installation.
-
Carefully work through How-To Trouble-Shoot and check About the Knowledge Base category / Table of Contents. Almost all typical errors are covered there
-
Reviewing the
klippy.log
file is necessary for all troubleshooting purposes. On the web interfaces, it’s easy to access or download and is prominently displayed on the home or dashboard page if there are any errors. -
If you encounter unanticipated or irregular behavior, the
klippy.log
can also be a helpful resource. It is always accessible via the navigation bar on the left side of the screen under Configuration (fluidd) or Machine (Mainsail). -
If you require aid, attach the
klippy.log
to your post at all times. Posts without the log will not receive a response. Use any compression tool like zip if the file is too big to attach.
Fine Tuning and Finishing Touches
The following steps are optional but will enhance the printing experience and quality:
-
Check and adjust potentially twisted X axis (requires a probe)
-
Perform bed_leveling
-
Create a bed_mesh (requires a probe)
-
Compensate for detrimental resonances (requires an Inertial Measurement Unit for the automatic process)
-
Calibrate the extruder’s rotation_distance
-
Dial in Pressure Advance for your filaments