If you’ve been dipping your toes in the 3D printing world, odds are you’ve heard about Klipper, the open-source firmware that enables input shaping, PID tuning, and Z offset calibration, among other practical features, to improve your 3D printing experience.
Installing Klipper can be useful, to say the least, and it’s what we’ll go over in this article. That said, this tutorial is long. It has to be, because of the complex nature of the software components and the need to understand what you’re configuring to get Klipper running.
Where possible, we’ll try to give you a reason as to why you need a piece of information or to run a check before moving on. Because a walk-through of this scale can’t answer all possible questions that you may have, you can also get help from a very active Klipper Discord, the official Klipper forums, and the relevant subReddits.
Due to how long and involved the process of installing and configuring Klipper is, we recommend that you read from beginning to end first. Give yourself a chance to look up concepts you may not know in advance. This will be really helpful later on as you work your way through the installation because you won’t get distracted having to look things up, or you’ll avoid misunderstanding things and having to backtrack.
So, let’s start by taking a closer look at what Klipper is before going over what you’ll need to set it up, then walk our way through the tutorial.
Before we begin installing Klipper, let’s go over the basics of how it actually works. This is important to understand, as these concepts will translate into why Klipper is going to help you (or not).
So first, let’s begin with the first definition of what Klipper is: 3D printer firmware. What, exactly, is the firmware doing in a 3D printer?
You may already have an intuitive understanding of what software and hardware are. Software is code, something that can be easily modified, while hardware is anything tangibly physical, like an integrated circuit chip. Firmware is that little elusive piece of software that depends on the actual hardware. That is, it’s code that is both dependent on and provides basic functionality to electronic hardware.
In a 3D printer, firmware is responsible for managing how stepper motors, endstops, heaters, and fans all behave. All the electronically controlled features of the printer are managed through firmware code. It acts as the brain of your machine.
All open-source 3D printer firmware relies on configuration parameters to accomplish those tasks correctly for the printer’s hardware. Proprietary firmware may work differently, but unless you’re the one writing it, you can’t know that. Things to know include what microcontroller unit (MCU) is managing the real-time sequencing of events and inputs, what stepper driver parameters to use, which endstops are on which inputs, and the PID parameters of the heaters that are set as a configuration file. This is true whether your firmware is Klipper, Marlin, or RepRap. Just the form of the configuration file differs from one to the other, and the way the configuration is passed to the firmware.
Let’s take a brief look at how Klipper stands apart from Marlin and RepRap.
Marlin, one of the main pillars of open-source 3D printing, is based on the Arduino programming framework for microcontrollers. The configuration file is normally divided in two files, “configuration.h” and “configuration_adv.h”. These files are used by the Arduino framework to write hard values in the program generated being stored in the controller’s on-board memory. So if you then want to change the direction or plug of one stepper motor, you need to modify the configuration file, recompile the firmware, and re-upload it to the board. This also means the number of features available is limited by the amount of memory the controller possesses.
RepRap firmware, used primarily on Duet boards, is a little different. The configuration is a series of custom G-code instructions that are stored on an SD card alongside the firmware, and whenever the controller starts up, it loads the firmware, and then reads the G-code instructions file to load the configuration into memory. This eliminates Marlin’s memory limit issue. That said, because the machine configuration is entirely written in G-code, it’s harder to read by someone who isn’t used to it.
Klipper, on the other hand, is more than just firmware. It’s unique in the 3D printing world in that the most complex bits of the code run on a standard Linux installation, written in Python, which anyone can easily learn to read and modify, and that part is called Klippy. Klippy runs on any type of computer, but most commonly on a Raspberry Pi. Klipper also has a firmware component (also referred as the MCU Klipper component) that gets uploaded to the controller, but it is much simpler. The controller is always in serial communication with the Python code.
The configuration for Klipper is in a Yaml format, and is only read by Klippy. The configuration file is a lot easier to read than RepRap’s G-code, and has names that are often less confusing than Marlin’s “configuration.h” file. Because Klippy runs as a program on a computer, you can edit and restart the program really quickly, without restarting the machine or the computer, meaning configuration changes are active in a matter of seconds. When things do get confusing, the inline comments and online documentation go into a lot of depth to clarify what they actually mean and how to obtain the right value to insert for a given parameter.
Now that we understand how Klipper actually runs, let’s take a look at the benefits and limitations this brings to the firmware layer on a 3D printer.
Having covered the basics (or as much as can be done), let’s step into the tutorial.
Installing Klipper will require a bit of research ahead of time. What that research looks like will be different based on whether you’re using stock hardware or an upgraded system where you’ve replaced the entire controller board.
To run Klipper on existing hardware, you need to identify with certainty what hardware it is you have. For example, if you have a Creality machine, you can identify the Creality board with the version number that is printed on it. Similar methods and Google searches will help you with other brands and controllers. Some controllers may not be documented, or are documented not to work for whatever reason. In those cases, you’ll need to buy not just a single-board computer like a Raspberry Pi, but also a new electronics controller for the printer. If this is the case, you’ll want to do research for new hardware.
The best way to make sure Klipper runs well is to look up the best electronics to use before you start buying anything. You’ll of course need a computer running Linux – generally recommended to be a Raspberry Pi because of size and cost. Controller boards compatible with Klipper are a dime a dozen, but choosing the right one isn’t trivial. Some are good, some are bad. Search online communities, forums, and manufacturer documentation before putting money down.
Make sure you understand how your printer is wired. For instance, some printers use two motors on the Z-axis, but with a single driver for both, instead of dedicated channels for each motor. Check the display interface compatibility (USB, single or double 8-pin connectors), and check that you know where the individual wires go on the old and new boards. Particularly important is the order of wires for your stepper motors, Z probe, and fans, as polarity matters on those components. Temperature sensors, unless you have a thermocouple or PT100 amplifier board, are polarity agnostic. Compare the type of connectors you have with the new board.
Now you know what you will run Klipper on. You’ve identified what microcontroller board it is and know how to disconnect, rewire, and connect all the elements of your printer to that new board.
Next is determining what type of 3D printer you have. Is it a Prusa i3-style bedslinger Cartesian printer? Does it have a CoreXY gantry or a Delta design, or is it a more esoteric Core-XZ kinematic setup? Aside from robotic arms, Klipper supports all commercial 3D printer kinematics.
After this, you want to write down what types of sensors your printer uses; are they mechanical or optical endstops? Is there a bed leveling probe, a specific temperature sensor type for the hot end and the bed, maybe for an enclosed chamber or electronics compartment?
Check the limits of what your printer can handle hardware-wise. Beyond just speed, acceleration and accuracy, the more critical aspects are the usable temperatures – what is the maximum hot end or bed temperature? What diameter nozzle is mounted, what type of maximum extrusion flow can it handle?
Finally, you have reached the end of the information gathering after you determine how many individual axes to control. Generally you account for one axis per stepper motor. Sometimes it’s fewer than that, if two or more motors are wired together.
Okay, so we now have all the required knowledge in hand to start installing Klipper. How do we do this? For this set of instructions, we’re assuming the use of a Raspberry Pi 3 or 4 and a controller board of your choosing, connected over USB to the Pi. We’re also assuming the Pi is connected to your network, either Wi-Fi or ethernet, and you know how to find its IP address when it boots up (usually by looking at the admin interface on your router or using a network scanner).
pi@printer:~ $
– this is the normal Linux prompt. You will want to go into the Klipper directory with the command cd klipper
. Then, configure the parameters for the controller firmware component of Klipper. To do so, a text-based interface exists and can be launched with the command make menuconfig
. In this interface, you’ll want to navigate the various elements to choose the type of MCU on the controller, and a few other parameters.
make -j
.This is where things begin to get a bit more complex. The controller boards come in two major categories: those where the bootloader is present, allowing for flashing them over a USB connection, such as the Arduino boards, and those where a bootloader was purposefully omitted, to prevent people from flashing the firmware over USB. This is commonly the case with the BigTreeTech or Creality controller boards.
Now, let’s start with the easy way, where the bootloader is there and allows flashing over USB:
ls /dev/serial/by-id/*
.make flash FLASH_DEVICE=/dev/serial/by-id/<value returned by the previous command>
.ls /dev/serial/by-id/*
and this time write down what the complete path is. You’ll want it for when we edit the configuration file.If your controller doesn’t flash over USB, there may be custom steps required to do so. The Klipper configurations repository should have your controller board listed, and the matching configuration file will have a header explaining what steps to take to flash the MCU with Klipper. Often, the procedure will roughly follow the steps:
ls /dev/serial/by-id/*
and write down the output value somewhere. You’ll need it for the config file.Okay, now we’re done with the SSH stuff, you can close the connection there. The rest we will do with the Mainsail interface directly.
The next two sections will describe using the Mainsail web interface for Klipper machines. These last steps are technically easier, but can lead to more frustration because of simple syntax errors in the configuration file (i.e. where to enter a new value, placement of space characters etc.). Go slow, grab your favorite relaxing beverage, and read through the steps several times before hitting “Save”.
STEPPER_BUZZ STEPPER=STEPPER_X
. Make sure to have all your axes towards the center of the machine so there’s a lot of room to move in. The command will make the X stepper move 1 mm in the positive axis direction, then 1 mm back in repeat for a few seconds. This lets you check that the wiring is good and the direction is correct. If you see the nozzle going left then right instead of right then left, you need to switch the axis direction. On Z, switch the axis direction if you see the nozzle moving away from the bed, then back towards it.QUERY_PROBE
to verify its correct settings.PID_CALIBRATE HEATER=extruder TARGET=215
. You can replace 215 with your preferred target temperature for the hot end PID tuning. For the heated bed, replace extruder
with heater_bed
and set the target appropriately (usually between 60 and 80 degrees).So far, we have Klipper running, a snazzy web interface in the form of Mainsail, a printer that doesn’t destroy itself when told to move or heat up, so what’s left? A first print of course! In general, Klipper reads Marlin G-code perfectly fine. However, some printer manufacturers have implemented a few custom commands for modifying acceleration or driver current values depending on the features being printed. Those are generally ignored by Klipper, and the only thing you will notice are the occasional error message appearing in the console when they are encountered.
It’s really not a big deal, but if you want to clean up your G-code files, you’ll want to edit your slicer profile to modify the G-code flavor output to Klipper’s if it’s supported. PrusaSlicer 2.6.0 and up does, as well as SuperSlicer and Orca Slicer. There may be others that incorporate it later. So go ahead and slice that G-code, then in Mainsail, next to the emergency stop, just “Upload & print”!
Klipper is complex firmware, with a lot of in-depth options that affect a number of features enabling faster and more precise printing. But if you got to the end of this article, you’re likely able to get prints off your machine now.
That said, it’s only the beginning. Klipper keeps improving, and adding features. And there are many features that this article hasn’t even mentioned yet! Like how to define macros, use an accelerometer to compensate for the machine’s resonance during movements, or tune the input shaper for really fast and accurate prints. There are plug-ins to control optional NeoPixel LEDs, generate time-lapses, or get automated failure detection with Obico! In short, the Klipper community has been busy generating a lot of plugins to add extra functionality.
And what about keeping your printer’s firmware and software up to date? In the Machine tab in Mainsail we were using there’s an update frame at the bottom right which will let you automatically install updates to Mainsail, Moonraker, Klipper, and the Raspberry Pi’s system. Do note, though, that it won’t update the MCU component for you. That you’ll still need to do manually, but as the saying goes, “if it ain’t broke, don’t fix it”.
Being so complex, Klipper needs a lot of time to be tuned to perfection. And once you’ve tuned Klipper to your machine, Murphy’s law mandates that something’s going to break or that you’ll want to upgrade something on the hardware side of it. And you’ll need to tune it all over again. But as you go down this rabbit hole, keep in mind there’s a lot of community around, and if you get to the point where the printer just works well enough for you, nobody will force you to continue tweaking. You can just stop tuning and print your parts, which is presumably why you got the machine in the first place.
License: The text of "How to Install Klipper: Step-By-Step Tutorial" by All3DP is licensed under a Creative Commons Attribution 4.0 International License.