Installing Klipper

Welcome to the klipper installation guide! I will go over steps to install klipper on your machine. If you use a 2021 TronXY Board(F103), you will first have to flush the stock firmware. A guide on how to do so can be found here. This method does not apply to the STM32F446 (V6-191121 and V10-20210309) boards that began shipping in early 2022. These can also be updated with klipper, and can be flashed following the XXX steps below, once you've completed the klipper installation by following the steps below.

## Installing Klipper

Once the chitu firmware is gone from your board (yay!), we can get started on configuring klipper. For this guide I will be using Octoprint, in combination with a V6 tronxy board. Example configuration will be included.

First, you need to flash octopi on your Raspberry Pi. This is fairly easy to do, a guide can be found here.

After this, we need to get klipper started on your Raspberry pi! Don't worry, we still need to flash the mainboard, but that step will come later.

1. You need to establish an SSH connection to your raspberry pi. This can be done through Putty, or through your CMD window. Default SSH login is: `ssh pi@octopi`, default password is `raspberry`.
2. Once you are in your pi, it should say `pi@octopi:` on the first line from the bottom. Great! Now we are in our raspberry pi.
3. After this, we need to install klipper on our machine. You need to run the following commands in the SSH window to install klipper on the pi:
```
git clone https://github.com/Klipper3d/klipper
#Followed by:
./klipper/scripts/install-octopi.sh
```
4. If you get the following error:
```
E: Repository 'http://raspbian.raspberrypi.org/raspbian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
```
you should run
```
apt-get update --allow-releaseinfo-change
```
and allow it to run through completion. After that, run
```
./klipper/scripts/install.octopi.sh
```
and allow it to complete.
5. Great! You should have installed klipper correctly, if no error messages pop up. To verify, you can run `cd ~/klipper/`. Awesome! Let's continue.
6. Now, we need to build our klipper file, for our mainboard. While inside of the klipper folder (step 3), run the following command: make menuconfig
7. This command should open up a window, where we will start to configure the klipper.bin for our machine

**F103 (V6) motherboards**:

**F446 (V10 and V6-191121) motherboards**:

Now that we have our klipper firmware ready, we need to compile it for our board. For this, press `Q` to exit the menu and save when prompted. `Y`.

Next, run the following command: **make**

This will compile our klipper.bin!

## Flashing Klipper

### F103 (V6) motherboards

Sadly, TronXY Boards do not use .bin files, but .cbd . We can do that using the following command (while cd'd in the klipper folder):

```
./scripts/update_chitu.py ./out/klipper.bin ./out/update.cbd
```

Put this update.cbd on an SD card, and insert it in your board! It should beep twice.

Next, it is important we make sure the pi can see the board. Connect a USB from the pi to the board, and configure `/tmp/printer` as an additional port in your web interface. (should be in settings -> connection on octoprint).

After that, we can connect to our board! Awesome.

### F446 (V10 and V6-191121) motherboards

1. Download Tronxy's official Marlin update files **for YOUR printer model**
2. Extract the zip file's contents, you should see an **update** directory that contains a few .bin files
3. Rename your klipper.bin file to match the name of the fmw\_\*.bin file in the **update** directory (ex: fmw\_x5sa\_400.bin)
4. Overwrite the fmw\_\*.bin file with your renamed klipper bin file
5. Copy the **update** dir to your printer's SD card
6. Turn your printer off
7. Insert the SD card
8. Turn on the printer and wait for it to flash the firmware (should see some green progress bars)
9. Once the update process is complete the LCD screen will be stuck with the last completed progress bar, and your LCD will no longer be of any use as long as klipper firmware is installed
	1. NOTE: Even after you've flashed klipper you can still flash the original Tronxy firmware onto your printer following the same steps above (but keeping the Tronxy fmw\_\*.bin file)
10. That's it! You should now be able to connect your Pi to your Tronxy via USB.

## Printer.cfg Setup

Many pin configurations can be found in marlin. For V6 boards, I will try to include some pins, which should work on your board. Please refer to the marlin zip at here. Go to `Marlin/src/pins/` and look for your corresponding board.

We shall start configuring the board! First, we need to check the MCU serial ID. Run **`ls /dev/serial/by-id/\*`** in the command line through SSH. It should say something similar to **`/dev/serial/by-id/usb-1a86\_USB\_Serial-if00-port0`.**

In some cases '**ls /dev/serial/by-id/\*' does not work. Use 'ls /dev/serial/by-path/\*' and the resulting string instead. It should be similar to '/dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0-port0'**

This will be the first entry in our printer.cfg file! This file needs to be created in **`/home/pi/printer.cfg`.** A good utility to use is Visual Studio Code, with the SSH Extension. It allows you to make edits over SSH on your own real quick.

The first entry in your file will be your MCU:

```
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
```
If your serial port is different, replace it with your own.

Once you run `FIRMWARE\_RESTART` through your web interface, it should give a different error, which is great! That means your klipper will work correctly for sure.

Next, you need to configure klipper. This can be done using this documentation reference. Please read through it thoroughly.

You may use the Printer.cfg files below, however, **MAKE SURE TO NOT RELY ON THIS ALONE. You should always follow the documentation reference.**

### F103 (V6) motherboard Printer.cfg

```
[mcu]
serial: /dev/serial/by-id/usb-1a86\_USB\_Serial-if00-port0
restart\_method: command

[printer]
kinematics: corexy
max\_velocity: 300
max\_accel: 3000
max\_z\_velocity: 25
max\_z\_accel: 30

[stepper\_x]
step\_pin: PE5
dir\_pin: !PE6
enable\_pin: !PC13
microsteps: 32
rotation\_distance: 40
endstop\_pin: !PG10
position\_endstop: -1
position\_min: -1
position\_max: 350 # for bed mesh
homing\_speed: 50
homing\_retract\_dist: 10
second\_homing\_speed: 10.0

[stepper\_y]
step\_pin: PE2
dir\_pin: !PE3
enable\_pin: !PE4
microsteps: 32
rotation\_distance: 40
endstop\_pin: !PA12
position\_endstop: 0
position\_max: 330
homing\_retract\_dist: 10
homing\_speed: 50.0
second\_homing\_speed: 10.0

[stepper\_z]
step\_pin: PB9
dir\_pin: PE0
enable\_pin: !PE1
microsteps: 32
rotation\_distance: 8
endstop\_pin: probe:z\_virtual\_endstop
position\_max: 400
position\_min: -2

[extruder]
step\_pin: PB4
dir\_pin: !PB5
enable\_pin: !PB8
microsteps: 32
rotation\_distance: 22.478 # Titan Extruder Clone Rotation Distance
gear\_ratio: 66:22 # Titan Extruder Clone Gear Ratio
nozzle\_diameter: 0.400
filament\_diameter: 1.750
heater\_pin: PG12
sensor\_type: Generic 3950
sensor\_pin: PA1
control: pid
pid\_Kp: 18.831
pid\_Ki: 0.821
pid\_Kd: 108.044
min\_temp: 0
max\_temp: 260
max\_extrude\_only\_distance: 350

[heater\_bed]
heater\_pin: PG11
sensor\_type: Generci 3950
sensor\_pin: PA0
min\_temp: 0
max\_temp: 130
control: pid
pid\_Kp: 73.932
pid\_Ki: 1.521
pid\_Kd: 898.279

[heater\_fan hotend\_fan]
pin: PG14

[fan]
pin: PG13

[controller\_fan drivers\_fan]
pin: PD6

[filament\_switch\_sensor filament\_sensor]
pause\_on\_runout: True
runout\_gcode:
 M25
switch\_pin: !PA15

[output\_pin beeper]
pin: PB0

[safe\_z\_home]
home\_xy\_position: 165, 165
speed: 50
z\_hop: 10
z\_hop\_speed: 5

[bed\_screws]
screw1: 5, 5
screw2: 165, 5
screw3: 325, 5
screw4: 5, 325
screw5: 165, 325
screw6: 325, 325

[bed\_mesh]
speed: 120
probe\_count: 5, 5
horizontal\_move\_z: 5
algorithm: lagrange
mesh\_min : 20, 20
mesh\_max : 310, 310
mesh\_pps: 0

[probe]
x\_offset: -35
y\_offset: 0
pin: !PG9
speed: 30
z\_offset: 1

```

### F446 (V10 and V6-191121) motherboard Printer.cfg

NOTE: This cfg is still being perfected as it's quite new. Newer and better cfg files should be coming in the near future.

```
[mcu]
serial: /dev/serial/by-id/usb-1a86\_USB\_Serial-if00-port0
restart\_method: command

[virtual\_sdcard]
path: ~/gcode\_files

[printer]
kinematics: corexy
max\_velocity: 300
max\_accel: 4500
max\_accel\_to\_decel: 4500
square\_corner\_velocity: 5
max\_z\_velocity: 25
max\_z\_accel: 30

[stepper\_x]
step\_pin: PE5
dir\_pin: !PF1
enable\_pin: !PF0
microsteps: 16
rotation\_distance: 20
endstop\_pin: !PC15
position\_endstop: 0
position\_min: 0
position\_max: 350 # for bed mesh
homing\_speed: 50
homing\_retract\_dist: 10
second\_homing\_speed: 10.0

[stepper\_y]
step\_pin: PF9
dir\_pin: !PF3
enable\_pin: !PF5
microsteps: 16
rotation\_distance: 20
endstop\_pin: !PC14
position\_endstop: -2
position\_min: -2
position\_max: 330
homing\_retract\_dist: 10
homing\_speed: 50.0
second\_homing\_speed: 10.0

[stepper\_z]
step\_pin: PA6
dir\_pin: PF15
enable\_pin: !PA5
microsteps: 16
rotation\_distance: 4
endstop\_pin: probe:z\_virtual\_endstop
position\_max: 400
position\_min: -2

[extruder]
step\_pin: PB1
dir\_pin: PF13 #change to !PF13 for X5SA Pro Titan Extruder
enable\_pin: !PF14
microsteps: 16
rotation\_distance: 16.75 #Needs to be adjusted. Starting value for Titan extruder is 4
nozzle\_diameter: 0.400
filament\_diameter: 1.750
heater\_pin: PG7
sensor\_type: ATC Semitec 104GT-2
sensor\_pin: PC3
control = pid
pid\_kp = 23.292
pid\_ki = 1.294
pid\_kd = 104.812
min\_temp: 0
max\_temp: 250
min\_extrude\_temp: 170
max\_extrude\_only\_distance: 300

[heater\_bed]
heater\_pin: PE2
sensor\_type: EPCOS 100K B57560G104F
sensor\_pin: PC2
min\_temp: 0
max\_temp: 130
control = pid
pid\_kp = 72.353
pid\_ki = 1.227
pid\_kd = 1066.301

[heater\_fan hotend\_fan]
heater: extruder
heater\_temp: 50.0
pin: PG9

[fan]
pin: PG0

[controller\_fan drivers\_fan]
pin: PD7

[filament\_switch\_sensor filament\_sensor]
pause\_on\_runout: True
runout\_gcode: M25
switch\_pin: !PE6

[output\_pin beeper]
pin: PA8

[safe\_z\_home]
home\_xy\_position: 165, 165
speed: 50
z\_hop: 10
z\_hop\_speed: 5

[bed\_screws]
screw1: 5, 5
screw2: 165, 5
screw3: 325, 5
screw4: 5, 325
screw5: 165, 325
screw6: 325, 325

[bed\_mesh]
speed: 120
probe\_count: 5, 5
horizontal\_move\_z: 5
algorithm: lagrange
mesh\_min : 30, 30
mesh\_max : 300, 300
mesh\_pps: 0
fade\_start: 1
fade\_end: 10
fade\_target: 0

[bed\_screws]
screw1: 5, 5
screw2: 165, 5
screw3: 325, 5
screw4: 5, 325
screw5: 165, 325
screw6: 325, 325

[probe]
x\_offset: -40
y\_offset: -10
pin: !PE3
speed: 30
#z\_offset = 2.12

```

You now have klipper! Any further questions should not be related to the TronXY board anymore, but can be found on the Klipper website at https://www.klipper3d.org/ .

Example config was pulled from this link, which has more example configs for TronXYs.

Hope you enjoyed the guide! Happy printing. For any comments, contact knarfie#0001 through the TronXY discord.