How I Set Up Klipper + Mainsail + OrcaSlicer on My TwoTrees SP5 V3 for Smooth Filament Color Swaps

Setting up a reliable color‑change workflow on a high-speed CoreXY printer like my TwoTrees SP5 V3, with a V6 clone hotend, was a game-changer. Below I walk you through exactly how I did it — from flashing Klipper, configuring Mainsail, slicing in OrcaSlicer, to doing a safe pause + resume for color changes at the right Z height.


1. Why I Chose This Setup

  • Speed & Precision: The SP5 V3 is much faster than typical printers, and Klipper unlocks even more speed with motion tuning and input shaping.
  • Advanced Web UI: Mainsail (or Fluidd) gives me full control via a web UI; I can pause, resume, tune, and monitor in real-time.
  • Flexible Filament Changes: Using OrcaSlicer with a filament-change pause macro means I can reliably swap colors mid-print — no clipping, no stringing, and resuming exactly where I left off.

2. Installing Klipper + Mainsail on TwoTrees SP5 V3

Here’s how I installed and configured Klipper and Mainsail on my printer.

  1. Compile and flash Klipper
    • I downloaded the Klipper source and configured it for my MKS‑style controller on the SP5 V3.
    • In make menuconfig, I selected the correct MCU, enabled USB communication, and built the firmware.
    • I copied klipper.bin to an SD card and flashed it via the printer’s bootloader.
  2. Set up Mainsail on my Raspberry Pi
    • I installed Raspberry Pi OS Lite, then installed Klipper, Moonraker, and Mainsail via their GitHub scripts.
    • I enabled auto-start for Moonraker and Mainsail so that the web UI is always available on my LAN.
  3. Connect Klipper & Mainsail
    • In Mainsail, I entered the Klipper host URL (http://<pi-ip>:7125) under Devices → Add.
    • I then configured the printer.cfg via Mainsail’s file editor, adding safe homing, input shaper, and my core‑XY motion parameters.

3. Configuring Macros for Pause / Filament Change / Resume

To reliably pause and resume prints for filament color swaps, you must define certain macros in your Klipper config (printer.cfg). Here’s what I did for my “filament change” workflow:

[pause_resume]

[gcode_macro M600]
description: Filament change (color swap)
gcode:
  SAVE_GCODE_STATE NAME=filament_change
  PAUSE
  # park coordinates
  G91
  G1 Z40 F600       ; lift Z by 40 mm (customized)
  G90
  G1 X10 Y10 F3000  ; move to front-left for easier access
  # retract filament a bit to avoid oozing
  G1 E-1.0 F1500
  G92 E0

[gcode_macro RESUME]
description: Resume after filament change
rename_existing: RESUME_BASE
gcode:
  RESTORE_GCODE_STATE NAME=filament_change
  # optional, you can prime filament here
  G1 E1.0 F1500
  RESUME_BASE
  • I use SAVE_GCODE_STATE and RESTORE_GCODE_STATE to preserve where the printer was when I paused, so I can resume precisely from the same spot.
  • Z-lift (40 mm) ensures the head clears the print for safe filament swapping.

4. Setting Up OrcaSlicer for Filament Change Pause

OrcaSlicer gives you a very flexible way to inject filament change commands at certain layers. Here’s how I configured it for my workflow:

  1. Open Printer Setup
    • In OrcaSlicer, go to Printer Settings.
    • Create or edit a printer profile, matching bed size, nozzle (0.4 mm V6 clone), filament diameter, and other specs. Orca Slicer+1
    • Under Printer Settings → Machine G-code, I put M600 in both the “Pause G-code” and “Change Filament G-code” boxes. This ensures OrcaSlicer knows to call my M600 macro. orcaslicer.pro
  2. Enable Pause at Layer
    • In OrcaSlicer’s Print Settings → Scripts, I use the “Pause at Layer” script. I enter the layer number where I want the color to change. orcaslicer.pro
    • This inserts the M600 command in the G-code exactly where I need it.
  3. Verify in Preview
    • After slicing, I go to Preview. I check the layer where the pause is, and verify that the G-code shows M600 (or PAUSE, depending on how you set it) at the right height.
    • If I want to fine-tune, I can manually adjust or reopen the G-code in a text editor. Orca’s export + manual-edit method is very powerful. Orca Slicer

5. Running a Filament Color Change Print

Here’s the exact step-by-step print flow I now run when changing filaments for color:

  1. Slice the model in OrcaSlicer, setting the “Pause at Layer” script correctly for where the color change should happen.
  2. Export the G-code and upload it to Mainsail.
  3. Start the print from Mainsail. The printer will follow the normal start macro, home, heat up, and begin printing.
  4. When it reaches the layer with M600, Klipper runs the M600 macro:
    • Saves the print state
    • Pauses
    • Lifts the Z-axis by 40 mm
    • Moves to X10/Y10 (park)
    • Retracts a small amount of filament
  5. I manually unload the old filament and reload the new color.
  6. Once the filament is loaded, I use Mainsail’s Resume button (or send RESUME from the console). Klipper calls the RESUME macro, which restores the saved state and resumes the print exactly where it left off.
  7. I optionally prime a bit of filament (via the G1 E1.0 in the resume macro) so the new color flows correctly.
  8. The print continues — now printing with the new color — without seams or blobs at the transition.

6. Tuning Tips for TwoTrees SP5 V3 with High Speed + V6 Hotend

Because my printer is a high‑speed CoreXY and uses a V6-like hotend, I made the following tuning decisions to prevent issues during the color-change:

  • Retraction: I set a modest retraction of 1.0 mm in the M600 macro to avoid stringing, but not too much to stall the extruder.
  • Z-lift height: 40 mm is enough to clear the print without going max-X or Y.
  • Park position: X10/Y10 is comfortable for me to reach when swapping filament.
  • Prime after resume: The small G1 E1.0 extrude helps ensure the first few mm of the resumed layer are solid color, avoiding a weak seam.

7. Why This Setup Works Better Than Alternatives

MethodProsCons
Dual‑extruder or AMSAutomatic, no manual interventionExpensive / complex hardware
Split G-code into separate filesSimple logic, no macro neededManual resume, risk of misalignment, slow overhead
OrcaSlicer + Klipper pause macro (my method)Full control, reliable resume at correct Z, cost-effectiveRequires manual filament swap; macro setup needed

By combining OrcaSlicer’s layer‑pause with Klipper’s macros, I get the best of both worlds: a clean, predictable manual filament swap with perfect resume behavior.


8. Common Pitfalls & How to Avoid Them

  • Pause command missing in OrcaSlicer: If you don’t put M600 (or PAUSE) in the “Change Filament G-code” setting, the slicer might not generate the correct command. Reddit users have run into this. Reddit+1
  • Resume fails because no SAVE_GCODE_STATE / RESTORE_GCODE_STATE: Without these, Klipper doesn’t remember where it was, and resuming can go wrong.
  • Too much or too little Z-lift: If your lift is too low, you risk collision; too high and print time suffers. Tune for your printer.
  • Retraction mismatch: If retraction on pause doesn’t align with your firmware or extruder type, you may get under or over extrusion when resuming.
  • Temperature mismatch: Make sure your resume macro restores the hotend temperature before resuming, or you risk printing with cold filament.

9. Final Thoughts & Benefits for PrintLabSA / CraftConnectSA Readers

  • For PrintLabSA, this setup dramatically improves the finish of multi-color prints — I can change filament mid-print cleanly, with no gaps or blobs.
  • For CraftConnectSA, this gives makers flexibility to make multi-tone prints cheaply, without buying expensive multi-material hardware.
  • Once set up, the workflow is repeatable: slice → print → pause & change → resume → finish, all controlled via Mainsail from any browser.

10. What You Should Do Next If You Try This

  1. Back up your printer.cfg before adding macros.
  2. Test the M600 macro by manually sending M600 from Mainsail console before doing a real print; make sure it lifts, parks, retracts.
  3. Slice a simple test object, like a cylinder, with a pause at an early layer and try a real filament change.
  4. Tune retraction and prime as needed — different colors/filaments behave differently.
  5. Document your parameters, so you can replicate the workflow on future prints or share with your CraftConnectSA audience.

Conclusion

Getting Klipper + Mainsail + OrcaSlicer dialed in for filament color swaps on a high-speed TwoTrees SP5 V3 was absolutely worth the effort. The combination gives me the flexibility to pause exactly at a desired layer, change filament safely, and resume precisely without scrap or mess. Whether you’re a hobbyist printing multi-color models or a small business maker, this setup delivers professional-grade control without the cost or complexity of multi-extruder hardware.

💬 WhatsApp Now