How To Install Klipper 3D Printing Firmware On Raspberry Pi

There are many reasons why 3D printing hobbyists eventually gravitate towards Klipper firmware. Some want to print faster, whereas others seek killer features like input shaping exclusive to this open-source 3D printer firmware. Then you have pathological tinkerers who value Klipper's ability to change key printer settings without the tedium of recompiling and flashing the firmware from scratch. It doesn't matter how far along you are in your 3D printing habit, Klipper has something for everyone simply because it is at the very bleeding edge of the open-source 3D printing revolution.

Advertisement

Switching to Klipper will undoubtedly improve your 3D printing experience, but it pays to ask yourself why consumer 3D printers don't ship with it pre-installed. Like all things in life, the answer boils down to money — it's expensive because it adds the cost of a Raspberry Pi single-board computer to your printer's bill of materials. That's a difficult proposition compared to the bog-standard Marlin firmware operating off a significantly cheaper 3D printer controller board instead.

Granted, the Pi's ability to chew up G-Code (the programming language most 3D printers use) and drip feed it to the controller board without overwhelming it enables much faster printing speeds from the same hardware. While that alone is worthwhile for 3D printing geeks, you can also undertake the daunting task of reconfiguring Klipper settings for a new printer. If you don't mind some serious tinkering, read on to learn how to install Klipper on a Raspberry Pi.

Advertisement

Create Klipper image on the SD card

Unlike other 3D printer firmware that resides on the tiny programmable memory module of a 3D printer controller board, the Klipper host requires a Python-capable Linux environment. In other words, we must install a Linux distro pre-baked with Klipper on a microSD card – just like you would while installing any other OS on a Raspberry Pi.

Advertisement

Download and install Raspberry Pi Imager and follow these steps to install Klipper on the microSD card.

  1. Run the Raspberry Pi Imager and click on the "Operating System" button to select "Mainsail OS" by navigating to the "Other specific-purpose OS" and subsequently the "3D printing" submenus.
  2. Set the installation location by clicking on the "Storage" button and selecting the microSD card from the subsequent menu. This process will remove all existing data on the microSD card, so make sure it is free of important data.
  3. Click on the gear icon right under the "Write" button to pre-configure your Wi-Fi router's access credentials by checking the "Configure Wi-Fi" box. Enter the relevant details required to access your Wi-Fi network and select the correct geographical location. Commit these settings by hitting the "Save" button.
  4. Click on the "Write" button and give it a few minutes for the process to complete.

Access the Raspberry Pi remotely with PuTTY

Power on the Raspberry Pi with the prepped microSD card installed. Be patient, as the first boot can take a minute or two. Monitoring the Pi's activity LED, which will stop blinking once the Raspberry Pi is ready to use, is a more accurate way to ensure successful initialization.

Advertisement

We must figure out the local IP address of the Raspberry Pi before we proceed further. Logging into your router as the administrator and heading to the page showing connected devices is the best way. Once you note down the IP address, download PuTTY. This is a free SSH client for remotely accessing the Raspberry Pi.

Logging into the Pi with PuTTY is easy. Enter the IP address noted earlier into the "Host Name (or IP address)" box and use the default Port 22. The connection type is SSH. Finally, click the "Open" button to start the SSH session. This will take you to a command line interface prompting the login ID and password. Enter "pi" and "raspberry," respectively, in lowercase to access the Raspberry Pi remotely.

Advertisement

Create Klipper firmware for the 3D printer controller board

After successfully logging in, you will find yourself at the familiar Linux command line prompt. Your first order of business here is configuring the firmware file for the controller board. Enter the Klipper directory by typing "cd ~/klipper/" followed by the command "make menuconfig" to begin the configuration process.

Advertisement

This will bring up a GUI allowing you to create a firmware file specific to the controller board found in your 3D printer. Don't let the configuration menu intimidate you. All settings relevant to your 3D printer controller board are listed at the top of the corresponding configuration file, available in the Klipper master configuration repository.

If you are presented with a "permission denied" error message upon entering any command, prefix the command with "sudo" to override all access restrictions. For example, the previous command will be "sudo make menuconfig" instead.

The config repository has ready-to-use files for most major consumer 3D printers. It also includes example configurations for custom 3D printers built upon popular controller boards, such as RAMBo, MKS Robin, Duet, and BigTreeTech. Once the controller board settings are configured correctly, type "make" to generate the firmware file titled "klipper.bin."

Advertisement

While you are still SSHed into the Pi, type out the command "ls /dev/serial/by-id/*" and note down the output value. We will need it later to tell Klipper how to access the MCU on the controller board.

Flashing the microcontroller on the 3D printer mainboard

Although it is technically possible to flash Klipper firmware onto your 3D printer's controller board over USB, that only holds true for custom 3D printers sporting Arduino MCUs as controller boards. Unfortunately, you cannot access the controller's EEPROM over USB in most consumer 3D printers, such as the ones from Creality or even custom ones built using BigTreeTech or Mellow controller boards.

Advertisement

Physically flashing the firmware onto the controller board via a microSD card is our only recourse. That requires installing a third-party tool like FileZilla to transfer the "klipper.bin" file from the Pi to the controller board. Connecting to your Raspberry Pi involves the same parameters used while logging in with PuTTY earlier.

After that, browse to "/home/pi/klipper/out." Download the generated firmware file "klipper.bin" to your computer, rename it as "firmware.bin," and transfer it to a fresh microSD card. Insert the microSD card into the controller board and power it on. Monitor the status lights for activity and wait until the firmware is flashed successfully. In most controller boards, the copied firmware file is renamed to FIRMWARE.CUR to prevent overwrites. That's how you know for sure the firmware update is complete.

Advertisement

Finalizing your Klipper installation

With Klipper installed on the Raspberry Pi and the controller board, you can install both components in your 3D printer. Head over to the Klipper configuration reference repository to find the correct configuration file depending on the make/model of your 3D printer or that of the controller board if you are running a custom 3D printer. You'll need it subsequently to configure your 3D printer.

Advertisement

Switch on the 3D printer and browse to the IP address of the Raspberry Pi to access the Mainsail front-end we had chosen for Klipper. Browse to the "Machine" menu on the left-hand side panel and create a new file titled "printer.cfg." For stock printers, copying the contents of the reference configuration file into "printer.cfg" is all you need to do. Please note that modified and custom-built printers require relevant settings to be customized.

Remember the MCU address we noted earlier after using the command "ls /dev/serial/by-id/*" the last time we SSHed into the Pi? You must update this value in the "[MCU]" section of the configuration file to allow the Raspberry Pi to communicate with the controller board. Congratulations, you have successfully Klipperized your printer, provided you have got all the printer settings right in the configuration file.

Advertisement

Recommended

Advertisement