Have you heard of this legendary operating system for 3D printers called Klipper? Tales of massive print speed and acceleration gains without losing print quality? But how do I install Klipper on my Ender 3? Raverobot is here with help for you.
What is Klipper?
Most 3D printers currently on the market use the Marlin firmware which runs directly on the main board of the printer and handles all calculations and movements of the printer. Klipper on the other hand requires a Raspberry Pi micro computer and offloads all that work to the much more powerful pi. The klipper firmware on the mainboard then simply acts as a relay sending the commands that the pi calculates to the stepper motors.
Why Do I Want Klipper on My 3D Printer?
Klipper takes all the heavy lifting off the 3D printer mainboard removing a significant bottleneck in 3D printing. Most 3D printers have 8bit or 32bit processors which are varying degrees of OK but they will still run into limitations if you try to get too fancy or move too fast. Klipper running on the much faster pi can handle whatever you throw at it. In addition Klipper has the option to correct for resonance frequencies created by the printer movements to further eliminate vibration related artifacts such as ringing or ghosting.
Are you convinced and want to give Klipper a try? Let’s get started and install Klipper on our Ender 3!
Disclaimer – This is a significant modification to your 3D printer. While the changes here only involve low voltage wires and flashing firmware, it is always a good idea to fully understand what you are doing before you do it. Raverobot is not responsible for any damage to your printer, yourself, or your workspace.
Shopping List
- Raspberry Pi Zero W (FYI you’ll need a Raspberry Pi 3 or 4 if you want to run Octoprint or run a high resolution camera)
- Four female dupont connector cables (for the Pi Zero) OR a USB cable and pi power supply
- A Micro SD card (16-32GB will be fine)
- A 3D printed case for the Pi Zero W
- Optional – A raspberry pi camera and ribbon cable
How to Install Klipper on an Ender 3
Step 1 – Decide on your Klipper Interface
Octoprint, Fluidd, or Mainsail are the choices. Fluuid and Mainsail are designed to be lightweight and will run nicely on a pi zero. Octoprint has a ton of plugins and advanced options but it requires a more expensive pi in order to run successfully. I’m going to select Mainsail here as I’m using a pi zero.
Step 2 – Download Mainsail OS
Head to the mainsail website and download the most recent OS image file.
Step 3 – Flash Mainsail OS to the Micro SD Card
We are going to need a clean SD card to install the mainsailos image onto. For this we’ll use Balena Etcher so you will need to download and install that as well. Make sure after it is done that if Windows offers to format the new drive it detected to say No.
Step 4 – Add Your WiFi Credentials to the SD Card
Open the mainsailos-wpa-supplicant.txt file with a text editor, notepad or VSCode, do not use Wordpad of MS Office or you will corrupt the file. You need to add in the SSID of your network and the password in the relevant section based on the security on your network. Save this file and replace it on the SD card.
Step 5 – Add Your Camera Settings to the SD Card
If you are planning to run a pi camera then open the mainsail.txt file with a text editor. Uncomment the line camera = “raspi” to enable the raspberry pi camera. Then uncomment the line camera_raspi_options= and in between the quotes add the settings you need for the resolution and frame rate of the pi. I’m setting mine to a 640 by 480 resolution and 5 frames per second to start. If this ends up being too much for the pi zero then I’ll reduce the resolution and/or frame rate until it is stable.
The point of the camera here is just to be able to see if the printer is ok without me needing to go to the basement to check on it. I have no expectations of taking nice resolution time lapses with this setup, if that is a priority for you then you should invest in the pi4 and a good quality USB webcam such as this Aukey model.
Step 6 – Insert the Raspberry Pi into the Printed Case and Attach to the Printer
I designed and printed this case for the Pi Zero to allow for it to attach to the outside of the Ender 3. It should work on any 2020 extrusions. It is available free on Cults3d if you want to try it.
Step 7 – Connect the Rasberry Pi to the Ender 3
As I’m using an SKR mini e3 v1.2 board on my printer I have a TFT serial port header on the board so I can connect and power the Pi directly from the printer. If you are using a stock Ender 3 board or one without the serial port pins then you will need to connect via USB and then also power the Pi from an external power supply.
In order to connect the Pi to the SKR over these pins we are going to need to make some changes to the Pi to disable bluetooth and allow for UART control over the serial pins (We’ll get to that in a bit). One of the limitations to doing this method is that my TFT35 touch screen will not work anymore in this configuration so I’ll be swapping it back to the stock screen for the time being.
Step 8 – Boot the Raspberry Pi With the SD Card
Insert the SD card into the pi and then power on the printer and the pi. If you are using an external power supply for the Pi then you can do this with the printer powered down for now.
Step 9 – Make Changes to the Raspberry Pi
I’m connecting to the pi using PuTTY with the IP address of the pi. Check your router to find the IP assigned and set it to static first to make sure it doesn’t get changed later. The default user name is “pi” and the default password is “raspberry”.
You are going to want to set up the Pi similar to how I’ve detailed in my Octoprint installation guide. Changing the default password and setting up localization options.
In addition to these changes you will also need to tell the Pi to use the GPIO pins for UART and not bluetooth by opening config.txt and adding the following line to the bottom “dtoverlay=pi3-miniuart-bt”.
We also need to open cmdline.txt and remove everything before “console=ttyl”.
Open raspi-config tool and under Interface Options you need to enable the serial port and then reboot the Pi.
Step 10 – Configure Klipper and Build the SKR Firmware
This part may feel a bit foreign to those used to compiling Marlin on their PCs but Klipper will create the firmware for the printer on the pi for you with a configuration tool. run the make menuconfig tool and follow the prompts and select the settings for your board.
Step 11 – Get the Compiled Firmware Off the Raspberry Pi
For some of the older 8 bit board types you can flash the firmware directly from the pi but for the SKR series we need to pull the .bin file off the pi and then transfer it onto the SD card of the printer to flash it. For this I’m going to use WinSCP a free tool that will let us see the folder structure of the pi and copy the firmware to my Windows PC.
Step 12 – Flash the 3D Printer Firmware
Once I have the .bin file I need to rename it to firmware.bin and then copy it to an empty SD card. Insert it into the printer and power it on and the printer will flash the new firmware to the board. Depending on what screen you have attached you may see a menu or you may see nothing but a background.
Step 13 – Download a Mainsail Configuration File and Make Required Edits
Head on over to the klipper github to download one of the example config files. You’ll see stock files for a lot of popular main boards and printers. In my case I downloaded the generic config for my board and also the stock ender 3 config. I then replaced portions of the BTT config with the ender specific details. I’ve attached my current config and required files here (printer.cfg, mainsail.cfg, macros.cfg) to help you get started.
Step 14 – Log Into the Mainsail Web Interface
Launch a web browser and enter the IP address of your pi to start the Mainsail interface. Here you can upload the printer.cfg file you’ve prepared and reboot the pi, the printer, and the interface.
Step 15 – Start Using Klipper
Well you’ve done it and completed a Klipper install on and Ender 3. Klipper is very different from the interface you are used to from a stock of semi-modified Ender 3 running Marlin. The best way to really understand how this all works is to just start using it. Slice a file with your previous slicer profile, upload it, and print it.
Something you may want to change in your slicer is your start and end gcode. If you run into issues look at the terminal and the error messages displayed, they’ll tell you what is wrong and what you need to fix. A common mistake is to run gcode commands which Marlin recognizes but Klipper doesn’t, like G29. To get G29 working in Klipper you need to write a macro named G29 which handles bed mesh, this is already done if you are using my config as a base.
Once you have your printer working as expected then it is time to look into the more advanced features.
Acceleration tuning, Pressure Advance tuning, and Input shaper are a few of these advanced features. Klipper is capable of significantly faster accelerations and print speeds than Marlin is, you’ll want to try a tuning tower for acceleration and find the settings at which things start to have issues. All printers vibrate and resonate, this is where artifacts like ringing/ghosting come from. Input shaping allows you to measure the resonance of the printer and then compensate for it. Pressure Advance is Klipper’s improved version of Linear Advance, with this you can gain sharper corners and features.
I’m not detailing a fully working list of tuning my Ender 3 right now as I’m actively working on building a Voron 2.4 CoreXY printer and plan to detail that journey on this site which will include all these advanced features, the process of tuning them will be nearly identical between the two printers.
Hopefully you found this guide on how to install Klipper and an Ender 3 helpful, if you have any questions or comments let us know below.
I’m not seeing where you have attached the current config file you mentioned?
Hey Elliott,
Evidently I forgot to include the link. I’ve modified my cfg since then to have the main printer.cfg and then all my macros in an included macros.cfg and of course you need mainsail.cfg as well. They all go into the same place and there should now be links to all of them. I hope this helps and thanks for catching my error and letting me know! Thanks for reading.
can you tell us how to backup the factory ender3 firmware before we flash the new generated firmware?
Hey Cindy,
To backup your eeprom settings you would connect the printer to a terminal, either through Octoprint or connected to a Windows PC with Pronterface. Run an M503 command and copy everything in the output into a txt file and save that.
As to the firmware you really just want to recompile it if it is custom or download the .bin file from Creality’s github for your printer model. Reverting from Klipper to Marlin is as simple as ejecting the sd card, putting the marlin firmware.bin onto it, then plugging it in and powering on the printer for a few minutes.
Hope this helps.