Setting up Klipper on my Neptune 3 Pro
Initial Pi setup
This section just covers the initial setup of any Raspberry Pi as the future thinkin' rhombus of your printer (well I don't really recommend anything below a Pi 3 but you do you)
- Use the Raspberry Pi Imager to flash Raspberry Pi OS Lite (64-bit) (under Raspberry Pi OS (Other))
- Log in to the pi, and run:
sudo apt update
sudo apt full-upgrade
sudo apt install git
sudo systemctl --now enable ssh
- While in there, go ahead and edit
/boot/firmware/cmdline.txt
:- Remove
console=serial0,115200
unless you're actually using a serial console to control your Pi -- must be removed if we're using the GPIO UART instead of USB. - Add
usbcore.autosuspend=-1
to the end of the command line -- this prevents the Pi's USB port power saving option which Klipper intensely dislikes.
- Remove
- Edit
/boot/firmware/config/txt
, and add these lines before the first[section]
:
# needed to use the GPIO UART
enable_uart=1
dtoverlay=disable-bt
# turn off wifi unless you need it
dtoverlay=disable-wifi
- Reboot the Pi
I actually ended up soldering some wires on to the Robin Nano's UART and running them to my Pi's GPIO header UART, because even with some of the USB tweaks in this section I still had buggy USB issues that I don't get paid enough to troubleshoot. If you wanna go that route, don't bother adding that usbcore
line.
KIAUH setup
This section covers installing the Klipper Installation And Update Helper (KIAUH), which is a helper script that installs Klipper, its dependencies, a web UI, and more, and facilitates building klipper.
I chose Fluidd for my web interface, but you can install Mainsail, or both. If you choose to run both just run the second one on a different port. This guide, however, is written from the perspective of Fluidd.
Base installation
- ssh into the pi and run
git clone https://github.com/dw-0/kiauh.git
./kiauh/kiauh.sh
- Hit 1 to confirm to use the new version
- Hit 1 to install stuff
- Install, at minimum:
- Klipper
- Moonraker (API that facilitates communication between Klipper and web UIs)
- A web interface
- The client config for your UI
- Install extra stuff if you want -- you can always run KIAUH again:
- Touchscreen support if you have a pi touchscreen -- this isn't about the screen on the printer
- Crowsnest if you want webcam, which is great
- Don't exit KIAUH; we're not done in there.
Building your firmware
Prepare an SD card by formatting it with an msdos partition table, one partition, in fat32. I intend to write a subsequent article regarding this.
- Go back, then go to Advanced, and hit 1 to build. You will find yourself in klipper's
menuconfig
- Enable Enable extra low-level configuration options
- Set Micro-controller Architecture to STMicroelectronics STM32
- Set Processor model to STM32F401
- Set Bootloader offset to 32KiB bootloader
- Ensure Clock Reference is set to 8 MHz crystal (default)
- Set Communication interface to:
- If you're using USB: Serial (on USART1 PA10/PA9) -- (NOT the USB entry -- this really screwed me up at first!)
- If you're using the UART: Serial (on USART2 PA3/PA2)
- Hit Q to save and exit. This will immediately build a
klipper.bin
firmware file, and place it in~/klipper/out/klipper.bin
. - Copy
klipper.bin
to the root of your SD card and rename it toZNP_ROBIN_NANO.bin
I did have some problems with USB after writing this section, so I ultimately ended up wiring the Pi's GPIO header to the printer's UART.
Flashing the printer's firmware
You cannot, as far as I know, actually brick the printer doing this! It will either:
- flash successfully (yay!)
- flash unsuccessfully (in which case just redo the flash)
- just not flash
- Shut the printer down
- Insert the SD card with your
ZNP_ROBIN_NANO.bin
file on it, and power on the printer - The Neptune's screen will say something like "UPGRADE FIRMWARE" with a progress bar that will not show any progress. This is normal.
- Wait about two minutes, and power off the printer.
- Remove the SD card and unplug the Netptune's touchscreen -- Klipper does not support it. (natively™)
- Power on the printer. All future communication will be done over USB (or serial) unless you revert this process.
Fluidd
If you installed Fluidd (or mainsail) you can just paste your Pi's IP address in your browser's address bar. The first WebUI installed with KIAUH runs on port 80 by default. On your first open of Fluidd there'll be all sorts of errors and warnings and what.
- Click on the hamburger in the top left, if the sidebar is collapsed, or otherwise just go to the Configuration (Fluidd) or Machine (Mainsail) section of the sidebar.
- Find printer.cfg and open it. I used TheFeralEngineer's one as a starting point, but since I'm actively doing this, you can check out (and use!) my configs, which I chose to make public for this guide. I suggest viewing TFE's or my printer.cfg raw, and copying and pasting it into your printer.cfg in your webui.
- Find the
[mcu]
section and edit it:
# USB: /dev/ttyUSB0 probably
# UART: /dev/ttyAMA0 probably
[mcu]
serial: /dev/ttyUSB0
restart_method: command
- Find the
[virtual_sdcard]
section and edit it:
[virtual_sdcard]
path: /home/YOURUSERNAME/printer_data/gcodes
- Now's a great time to scroll through the file to get a feel for what settings are available. I suggest paying extra attention to the
[extruder]
,[heater_bed]
, and[probe]
sections, because we'll want to calibrate those. - At this point it should be configured enough that you can hit Save & Restart, which will restart... well, I think at least Klipper and Moonraker but I'm honestly not sure.
Once you save and restart, Klipper on the Pi should be able to connect to Klipper on the printer. Click Dashboard in the sidebar -- if everything's working, you should see some controls instead of some errors.
Calibration
If everything's gone well so far, you should have a printer that can't print anything, which is far better than a printer that can't boot! If your printer is connecting, the most important next step is calibration. I got a ton of my information from Ellis' Print Tuning Guide (honestly, mostly Ellis) -- however, this comment, this comment, and klipper3d.org make great honorable mentions.
Setting the essentials in printer.cfg
Whether you're using my configs or TheFeralEngineer's, you will need to set a few things right off the hop. I've included some doc links for these steps as relevant. I found the first listed link in each step to be the easiest to follow.
Follow the steps in this section in order.
The example commands I provided should be enough to get you started, but please do not blindly send commands to your printer without understanding them!
- Extruder and bed PID - klipper3d.org
- Extruder:
PID_CALIBRATE HEATER=extruder TARGET=205
- Wait until the calibration finishes
SAVE_CONFIG
- Bed:
PID_CALIBRATE HEATER=bed TARGET=60
- Wait until the calibration finishes
SAVE_CONFIG
- Extruder:
- Rotation distance ("E-Steps") - ellis3dp.com, klipper3d.org
- Z offset - klipper3d.org Probe Calibrate and klipper3d.org The Paper Test
- Do this calibration cold
- Click the Home All button or send
G28
to home all axes - Run
PROBE_CALIBRATE
to start calibration; Your UI will pop up with a window - This calibration starts about 6.5mm too high, so lower the extruder and tweak until the extruder just barely touches the paper
- Once you are finished, run
SAVE_CONFIG
- Bed mesh - fluidd.xyz
- Do this calibration hot
- Click the Home All button or send
G28
to home all axes - Visit the Tune tab in Fluidd. If a profile is listed, ideally one called default, load it
- Click Calibrate.
- Once the calibration is complete:
- If you loaded your default profile, send a
SAVE_CONFIG
- If you didn't have a profile, or didn't load one, click Save As and name it default, then send a
SAVE_CONFIG
- If you loaded your default profile, send a
- Pressure advance - ellis3dp.com, klipper3d.org
Next steps
- Follow Ellis' Print Tuning Guide as if it were a sacred text.
- Consider calibrating resonance compensation ("input_shaper"), particularly if you are interested in speeding up your prints.