VoronLab
Isometric drawing of a blue Raspberry Pi board with a microSD card, linked by USB cable to a 3D printer making a blue cube beside a filament spool.
firmware

How to Install Klipper on Raspberry Pi

Install Klipper with MainsailOS or KIAUH, flash the correct printer firmware, configure printer.cfg, and check heaters and motion before printing.

By VoronLab Editorial · ·Updated · 6 min read

Install MainsailOS on the Raspberry Pi, flash Klipper firmware built for your printer’s controller, then load the matching printer configuration and verify the heaters and motion. If the Pi already runs Raspberry Pi OS Lite, you can install the host software with KIAUH. Klipper installation guide.

Install Klipper on Raspberry Pi with MainsailOS

For a dedicated printer Pi, use MainsailOS. It includes Klipper, the Moonraker API server, and the Mainsail browser interface. MainsailOS overview.

Gather a Raspberry Pi, microSD card, card reader, and USB data cable for the printer. The MainsailOS guide recommends Pi Zero 2, Pi 3, or Pi 4 and specifies at least 16 GB of storage, with 32 GB or more recommended. MainsailOS setup guide.

Use a power supply matched to your model. Raspberry Pi specifies 5 V at 3 A for the Pi 4 Model B. Raspberry Pi setup and power requirements.

Follow these steps in Raspberry Pi Imager. MainsailOS Imager instructions, Raspberry Pi Imager verification.

  1. Select your Pi model, then Other specific-purpose OS → 3D printing → MainsailOS. Choose the recommended image for that model.
  2. Select the microSD card. Writing the image erases it, so back up anything needed first.
  3. Set a hostname, username, unique password, timezone, and Wi-Fi details if needed. Enable SSH.
  4. Write the image, finish verification, and insert the card into the Pi.

Boot with Ethernet or the configured Wi-Fi. Open http://mainsailos.local, substituting your hostname. If that fails, use the Pi’s IP address from your router. Under Machine, select Update all components in Update Manager before building firmware. A missing printer.cfg error is expected at this stage. First-boot instructions.

Open a terminal on your computer. In this SSH example, replace pi with the username you set in Imager and mainsailos.local with your Pi’s hostname or IP address. Enter the Pi account password when prompted. Voron SSH guide.

ssh pi@mainsailos.local

Alternative: install with KIAUH

KIAUH installs the printing components on an existing Raspberry Pi OS Lite system. Connect to the Pi through SSH and run the installer commands below. KIAUH prerequisites and commands.

sudo apt-get update && sudo apt-get install git -y
cd ~ && git clone https://github.com/dw-0/kiauh.git
./kiauh/kiauh.sh

In the KIAUH menu, install Klipper, then Moonraker, then Mainsail. Enter the Pi’s IP address or hostname in your browser to open Mainsail. Mainsail’s KIAUH installation guide.

KIAUH also offers Fluidd as an alternative interface. The configuration steps below use Mainsail. KIAUH components.

Build and flash the printer controller

With printer power disconnected, identify the controller board and MCU. Select a matching printer configuration or board template and read its build instructions. Firmware preparation. Keep the original firmware and settings available for recovery.

Open the firmware configuration menu on the Pi. Firmware build commands.

cd ~/klipper
make menuconfig

For the stock 2020 Ender 3 V2 configuration with STM32F103, the upstream configuration specifies:

Menu settingValue
ProcessorSTM32F103
Bootloader offset28 KiB
CommunicationSerial on USART1 PA10/PA9

Apply these settings only to matching hardware. Press Q to exit, then Y to save. Run make to build the firmware. Klipper firmware build instructions.

For this Ender example, download ~/klipper/out/klipper.bin from the Pi through an SFTP client. Firmware file location, SFTP instructions.

Copy the file to the printer’s SD card with a .bin filename that differs from the previous flash. With the printer off and USB disconnected, insert the card and power on the printer to flash it. Follow the board’s own flashing instructions for other hardware. Ender 3 V2 configuration, Klipper flashing guidance.

For a Voron with a BigTreeTech Octopus V1 and an STM32F446, use the firmware settings in the matching template’s header. Build and flash using those instructions, then use the template as the starting printer.cfg. Voron Trident template, Voron 2.4 template.

Create printer.cfg and connect the MCU

Upload the matching configuration as printer.cfg through Mainsail’s Machine page. On MainsailOS, add [include mainsail.cfg] at the top to load the preinstalled Mainsail configuration. Configuration setup.

Reconnect USB and run this on the Pi:

ls /dev/serial/by-id/*

If several paths appear, disconnect the controller and repeat the command to see which path disappears. Reconnect it and set the existing [mcu] section’s serial: value to that full path. MCU connection procedure.

If you started with either Voron template, apply its build-specific settings before the final ready check and full homing. Review the template’s change checklist for hardware settings such as thermistor types and heater and probe pins, then make these size and homing edits. Voron Trident template, Voron 2.4 template.

  • In both templates, uncomment the position_endstop and position_max lines for your build size in [stepper_x] and [stepper_y]. On the 2.4, also uncomment the matching position_max in [stepper_z].
  • On a Trident, uncomment the z_positions and points lines and their coordinate rows for your build size in [z_tilt]. On a 2.4, do the same for gantry_corners and points in [quad_gantry_level].
  • For the physical Z endstop in these templates, replace the -10,-10 placeholder in [safe_z_home] under home_xy_position with the measured X and Y coordinates of the endstop pin.

If you still need to measure those coordinates, save and restart Klipper with the other build settings in place, then follow Voron’s startup checks for your model. After the endstop and motor checks, use G28 X Y to home X and Y only, jog the nozzle over the Z endstop pin, and read X and Y with M114. Klipper configuration reload, Voron initial startup guide.

Once the build-specific settings are in place, save and restart Klipper, then run STATUS in Mainsail’s console to confirm Klipper loaded the configuration and connected to the controller. Klipper readiness check.

How to verify before printing

Follow the Klipper configuration checks with the power switch accessible:

  1. Confirm cold nozzle and bed readings are plausible and stable. Test emergency shutdown with M112, then recover with FIRMWARE_RESTART.
  2. Command each heater separately to 50°C, confirm the correct temperature rises, then switch it off and confirm cooling. Cut power if heating is uncontrolled.
  3. Run QUERY_ENDSTOPS with switches released and pressed. Verify each state changes correctly.
  4. With axes clear of their limits, run STEPPER_BUZZ STEPPER=stepper_x, then repeat for the other axis steppers. Expect a 1 mm positive move and return.
  5. After the endstops and steppers pass, issue G28 to home. Cut power if the printer homes incorrectly.

Calibrate the hotend PID in the console using a target suitable for your printer. The example below uses 170°C. Wait for calibration to finish before running SAVE_CONFIG. Klipper PID calibration instructions.

PID_CALIBRATE HEATER=extruder TARGET=170
SAVE_CONFIG

If your heated bed supports pulse-width modulation (PWM), calibrate its PID separately. Klipper gives 60°C as a typical bed target. Klipper PID calibration instructions.

PID_CALIBRATE HEATER=heater_bed TARGET=60
SAVE_CONFIG

Level the bed and calibrate the nozzle-to-bed distance before printing. The procedure depends on whether your printer uses a Z probe, a traditional endstop, or delta kinematics. Klipper bed leveling instructions.

Check that any START_PRINT call in your slicer has a matching macro in printer.cfg. Disable coasting and follow the pressure advance tuning procedure once basic printing works. Klipper slicer documentation.

Fix common installation failures

  • Dashboard unavailable. Try the Pi’s IP address and recheck the network settings before rewriting the card. First-boot instructions.
  • MCU unavailable. Check power, USB data connectivity, firmware, and the serial path. Inspect ~/printer_data/logs/klippy.log. Connection diagnostics.
  • MCU protocol error after an update. Rebuild and flash the outdated controllers listed in the error. Protocol-error repair.

Keep remote control behind a VPN or another protected access service. Mainsail remote-access guidance.

The steps are based on the online MainsailOS, Klipper and Voron documentation as of November 26, 2026. No hands-on testing was performed for this guide.

Sources

  1. Klipper installation
  2. MainsailOS overview
  3. MainsailOS Raspberry Pi installation
  4. Raspberry Pi getting started
  5. MainsailOS first boot
  6. Voron SSH and file transfer guide
  7. KIAUH installation helper
  8. Mainsail installation with KIAUH
  9. Klipper stock Ender 3 V2 configuration
  10. Voron Trident stock Klipper config (BTT Octopus)
  11. Voron 2.4 stock Klipper config (BTT Octopus)
  12. Voron initial startup guide
  13. Klipper configuration checks
  14. Klipper bed leveling
  15. Klipper slicer configuration
  16. Mainsail MCU protocol error
  17. Mainsail remote access

Related