Skip to content

Instantly share code, notes, and snippets.

@adelyser
Last active February 17, 2024 11:40
Show Gist options
  • Save adelyser/0b2123f1800155ef45aae392eecf097e to your computer and use it in GitHub Desktop.
Save adelyser/0b2123f1800155ef45aae392eecf097e to your computer and use it in GitHub Desktop.

Klipper on the BIQU BX

So you want to run Klipper on your BIQU BX? Well too bad it's not supported.... but I do have some good news. I have a preliminary branch ready to submit to Klipper to support the BIQU BX. Here's what you need to know in order to get started.

NOTE: If you have a V3 board, click here

_**UPDATE: The Biqu BX is now supported in mainstream klipper!

NOTE: CAN will not work on this board due to a hardware mis-configuration

NOTE: I2C is not quite working yet!

First, a few requirements:

  1. You need Klipper setup on your Raspberry PI with your favorite control interface (Octoprint, Fluidd, Mainsail, etc..).
  2. You need your favorite Touchscreen UI installed (unless you just want to run headless). There is more on the HDMI config for the RPI below.
    • For Octoprint, I recommend OctoDash
    • For Fluidd and Mainsail, I recomment KlipperScreen
  3. You MUST have removed the Z endstop physical switch. Not disconnected, but completely removed.

Ok, so let's get started.


Klipper firmware configuration

When configuring the klipper firmware to run on the BTT SKR SE BX board, there are a couple things to know about.

  1. Use the main klipper branch.
  2. In order for the toucscreen to work, you will need to set GPIO pins PB5 and PE5 to an initial state during the config
  3. Use the config/printer-biqu-bx-2021.cfg file for your intial printer.cfg
  4. Once you are setup, you will need to calibrate your sensorless homing: https://www.klipper3d.org/TMC_Drivers.html?h=sensorless+ho#sensorless-homing

Klipper Firmware Configuration

A note on connection methods:

There are 4 different connections you can make from the Raspberry Pi to the mainboard, 2 Serial and 2 USB.

Communication Interface

  • USB (on PA11/PA12) is the USB port on the front base of the machine.
  • USB (on PB14/PB15) is the USB port on the right side of the touchscreen.
  • Serial (on USART1 PA10/PA9) is the TFT connector on the mainboard.
  • Serial (on UART4 PA0/PA1) is the WiFi connector on the mainboard.

To use serial connections, you have to enable the serial port on the raspberry pi and compile the correct serial port for the BX mainboard. Once you have the serial port enabled on the raspberry pi, it will show up as /dev/ttyAMAx, with x being the port number.

Follow this guide for setting up the RPI serial connection: https://gist.github.com/looxonline/89e79b2554771eee8aa8b6492f30400d

Once you have it setup, your printer.cfg should then contain the following under the MCU section: serial: /dev/ttyAMAx, substituting the x for your port number.


HDMI configuration

For the HDMI to work properly with the Raspberry Pi, you need the following set in /boot/config.txt on the Raspberry Pi. If you are currently using the RPI touchscreen, this should already be setup.

config_hdmi_boost=7
hdmi_group=2
hdmi_mode=87
hdmi_drive=1
hdmi_cvt=1024 600 60 6 0 0 0

Slicer configuration

For your slicer, you need to call the PRINT_START macro instead of any preliminary gcode. The NOZZLE and BED temps get passed in as arguments. Some examples for the more popular slicers:

  • Cura: PRINT_START BED={material_bed_temperature_layer_0} NOZZLE={material_print_temperature_layer_0}
  • PrusaSlicer: PRINT_START NOZZLE=[first_layer_temperature] BED=[bed_temperature]
  • Ideamaker: PRINT_START NOZZLE={temperature_heatbed} BED={temperature_extruder1}
  • Simplify3D: PRINT_START NOZZLE=[extruder0_temperature] BED=[bed0_temperature]
  • Kiri:Moto: PRINT_START NOZZLE={temp} BED={bed_temp}

Klipper Functionality

Here are some notes on how I have Klipper setup and working quite well for my machine.

Touchscreen Sleep

The Touchscreen will go dark when the printer idle timeout occurs. This happens when there is not a print job in action and currently set for 5 minutes. Pressing the Menu Knob on the display will wake up the Touchscreen.

LEDS

The Neopixels are setup and will cycle through colors on bootup. I have the idle timeout set to shut off the LEDS when the printer is inactive. The LEDs automatically come on when a print is started or when the LCD is wakened.

Homing Routine

I have programmed a reliable homing routine that works well for me, however you can adjust or setup your own to taste. My routine will do the following:

  1. Raise the Z axis
  2. Home the X axis
  3. Home the Y axis
  4. Move the probe to the center of the bed (different than the nozzle at center)
  5. Home the Z with the probe.
  • When starting a print, additionally:
  1. After the bed reaches temp, the printer waits for 90 seconds with the probe close to the bed to warm up the probe.
  2. Steps 1-5 are repeated with a warm probe
  3. Move to the origin to start the print.

OctoDash custom buttons

I wanted some custom configs for OctoDash to control the LEDs and the extruder from the control screen. Here are my entries to make that happen. Edit /config/octodash/config.json from the home directory on the Raspberry Pi with the icons you want from below.

		"octodash": {
			"customActions": [
				{
					"icon": "home",
					"command": "G28 X Y Z",
					"color": "#dcdde1",
					"confirm": false,
					"exit": true
				},
				{
					"icon": "snowflake",
					"command": "M140 S0; M104 S0",
					"color": "#0097e6",
					"confirm": false,
					"exit": true
				},
				{
					"icon": "long-arrow-alt-down",
					"command": "M83; G1 E5 F100",
					"color": "#00ff00",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "long-arrow-alt-up",
					"command": "M83; G1 E-5 F100",
					"color": "#800080",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "sun",
					"command": "SET_LED LED=led RED=1.0 BLUE=1.0 GREEN=1.0; SET_LED LED=knob RED=1.0 BLUE=1.0 GREEN=1.0",
					"color": "#ffff00",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "moon",
					"command": "SET_LED LED=led RED=0.0 BLUE=0.0 GREEN=0.0; SET_LED LED=knob RED=0.0 BLUE=0.0 GREEN=0.0",
					"color": "#bc8f8f",
					"confirm": false,
					"exit": false
				},
				{
					"icon": "redo-alt",
					"command": "[!RELOAD]",
					"color": "#7f8fa6",
					"confirm": true,
					"exit": false
				},
				{
					"icon": "power-off",
					"command": "[!SHUTDOWN]",
					"color": "#e84118",
					"confirm": true,
					"exit": false
				}
@bboybattlemage
Copy link

Do you have a v3 screen and controller board ?

No it is V2.0!

I did manage to study this out (of sorts). I switched the CB1 for a raspberry pi; there was just something wrong/strange about the kernel in the BTT CB1 image that prevent proper setup. Using a pi I was able to get the proper resolution and screen output without issue.

Thanks for the reply!

@varazir
Copy link

varazir commented May 7, 2023

Do you have a v3 screen and controller board ?

No it is V2.0!

I did manage to study this out (of sorts). I switched the CB1 for a raspberry pi; there was just something wrong/strange about the kernel in the BTT CB1 image that prevent proper setup. Using a pi I was able to get the proper resolution and screen output without issue.

Thanks for the reply!

Okay, I have the v3 and I can't get it to work :(

@bboybattlemage
Copy link

With a raspberry Pi?

Are you using a separate power supply for the screen or powering it off the raspberry pi?

What exactly are your issues?

@varazir
Copy link

varazir commented May 7, 2023

With a raspberry Pi?

Are you using a separate power supply for the screen or powering it off the raspberry pi?

What exactly are your issues?

I have a RPI3b+
Have connected it as shown here https://github.com/bigtreetech/BIQU-BX/blob/master/BIQU-BX-manual.pdf

Issue I have all the time is the screen looks like this https://i.imgur.com/cvIyzjO.jpg
I have tried different images and settings. If I add the 1024x600 mode and force the screen to use it, it goes white/blank.

Right now is the problem with Klipper can't connect to the MCU. It times out
My settings https://i.imgur.com/bR66AFR.png

[mcu]
serial: /dev/ttyAMA0
restart_method: command

@varazir
Copy link

varazir commented May 8, 2023

I got Klipper to work with using the UART4 PA0/PA1 port in Klipper setup.

@TMOD3D
Copy link

TMOD3D commented Nov 11, 2023

Hi All, thx for the post helps alot, have successfully installed klipper and klipperscreen on V2 screen but touch is not working on my screen, can it be because i am using a pi zero

@adelyser
Copy link
Author

Hi All, thx for the post helps alot, have successfully installed klipper and klipperscreen on V2 screen but touch is not working on my screen, can it be because i am using a pi zero

Did you plug in the usb cable to the screen for touch? That’s required for touch to work.

Also, you shouldn’t be using a Pi Zero to run Klipper with a touchscreen, it’s a bit underpowered to handle a UI or a webcam. A Pi Zero 2 would be fine though.

@TMOD3D
Copy link

TMOD3D commented Nov 11, 2023

no the usb on the side of the screen to the pi's usb

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