Skip to content

Instantly share code, notes, and snippets.

@ctmakro
Last active May 15, 2023 19:45
Show Gist options
  • Save ctmakro/c6749ca20798b8e3950f5baa47e05fba to your computer and use it in GitHub Desktop.
Save ctmakro/c6749ca20798b8e3950f5baa47e05fba to your computer and use it in GitHub Desktop.
20210526 How to compile and run Klipper (highest performance 3D printer firmware with most awesome features) on Anycubic Kossel (Arduino Mega / atmega2560) + OctoPrint from Windows 7 x64

How to compile and run Klipper on atmega2560 + OctoPrint from Windows 7 x64

Situation

  • I own an Anycubic Kossel delta 3D printer, running custom Marlin firmware, custom mainboard(atmega2560), connected to my PC via USB (USB Serial), controlled mostly via Printrun(Pronterface)
  • I want ultra high performance and latest improvements in my 3D printer, with the help from Klipper software/firmware
  • Normally you should go get an Raspberry Pi and do everything (compile/install Klipper / OctoPrint) from there, but I don't have a Pi, don't want to mess with the cables, decided to run Klipper from my PC

Steps

  1. install VirtualBox for Windows x64

  2. download ISO of Raspbian(for x86, not ARM) from https://downloads.raspberrypi.org/rpd_x86/images/

  3. create a new virtual machine in VBox, of type Linux (32-bit), with at least 512MB of memory

  4. install Raspbian into the HDD of that virtual machine via Graphical Installation in the Raspbian ISO bootup menu

    • here we assume you already know how to install Debian/Ubuntu on a virtual machine (one of the most basic skills in CS/IT). If you don't then this tutorial is not for you
    • it's strongly recommended that you install VBoxGuestAdditions on Raspbian to be able to share clipboard between VM and Windows. Only a few steps, Google for instrustions
  5. Open Preferences -> Raspberry Pi Configuration and enable SSH in the Interfaces tab. This way you can connect to your Pi via PuTTY or Bitvise SSH.

  6. install then run OctoPrint on Raspbian as per https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian-or-raspberry-pi-os/2337. Make sure you can access OctoPrint from http://<pi's IP>:5000

  7. Now let's do Klipper. Klipper is split into 2 parts, the host part and the microcontroller part. We'll have to compile and install both

    • Clone Klipper from GitHub to your home dir as per https://www.klipper3d.org/Installation.html. Run the commands mentioned in the page one by one.

    • the make command for building the microcontroller firmware may fail with an error regarding certain files. If that's the case, make clean and make again. ref: Klipper3d/klipper#3682

    • To flash via USB, you'll have to detach the USB-Serial device (that connects the printer) from your PC and attach it onto the Raspbian virtual machine.

      go to the bottom right corner of your VM window, where a bunch of device icons reside. right click on the USB icon and in the popup menu click USB settings. USB 1.1 controller should be enabled, if not, shutdown the VM and enable it.

      in the USB device filter, add a device filter using the plus button on the right, select the USB Serial device in the popup menu. this allows that particular device to be trasferred from Windows into this virtual machine. press OK and close the dialog.

      now go to the bottom right corner and right click USB icon. then tick the device you want attached to the VM. VBox may freeze for a few seconds during this. After that's done you should be able to see your USB Serial device removed from Windows (check your Device Manager) and attached to Raspbian, visible via ls /dev/serial/by-id/.

  8. Configure OctoPrint as per https://www.klipper3d.org/Installation.html "Configuring OctoPrint to use Klipper"

  9. the rest is similar to configuring on an actual Pi, just follow Installation.html

    • I own an Anycubic Kossel so I just ~/klipper/config $ cp printer-anycubic-kossel-2016.cfg ~/printer.cfg
    • I want precision so I uncommented the delta calibrate section in config It's okay to use delta calibration parameters from Marlin firmware, just do some math:
      • stepper a,b,c means tower x,y,z
      • arm_length = M665.L
      • delta radius = M665.R
      • [stepper a].angle = 210 + M665.X; [stepper b].angle = 330 + M665.Y; [stepper c].angle = 90 + M665.Z(usually zero)
      • [stepper a].position_endstop = M665.H - M666.X - M851.Z; [stepper b].pos_endstop = M665.H - M666.Y - M851.Z; and so on

Thoughts

  • 3D Printing is not for the faint of heart. Degree in CS/EE/ME is strongly recommended before entering the field
@StarSOziOne
Copy link

Congratulations on a great compilation. Thanks for your effort. There are places where I am stuck, I installed the operating system not in a virtual environment, but directly on an old notebook with an intel atom processor. I have completed almost all the steps. However, when I start Klipper due to lack of translation, I constantly encounter errors. I still keep trying. Isn't it possible to integrate mainsail os with this method. I don't want to spend money on raspberry when I have an idle notebook in my hand.

@arteuspw
Copy link

Congratulations on a great compilation. Thanks for your effort. There are places where I am stuck, I installed the operating system not in a virtual environment, but directly on an old notebook with an intel atom processor. I have completed almost all the steps. However, when I start Klipper due to lack of translation, I constantly encounter errors. I still keep trying. Isn't it possible to integrate mainsail os with this method. I don't want to spend money on raspberry when I have an idle notebook in my hand.

its possible if you got wifi module on your notebook im running it on vmware and i just dont know how to print lol

@lin-ycv
Copy link

lin-ycv commented Nov 19, 2022

Question, how'd you ssh into the vm that's behind a NAT on local network?
only the host of the vm can ssh using the 192.168.x.x ip, on another computer the vm is not visible.

or are you running the vm on your main computer?

@arteuspw
Copy link

Question, how'd you ssh into the vm that's behind a NAT on local network? only the host of the vm can ssh using the 192.168.x.x ip, on another computer the vm is not visible.

or are you running the vm on your main computer?

on my main computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment