Category_DocumentationCategory_Install Guide

ADXL345 and BIGTREETECH CB1 (Input Shaper Setup)

Input shaper is a technique used by Klipper firmware on a 3d printers to reduce ringing (aka ghosting or echoing) in 3d prints. Ringing is caused by vibrations in your 3d printer. Usually caused by insufficiently rigid printer frame, non-tight or too springy belts, alignment issues of mechanical parts, heavy moving mass, etc. Those should be checked and fixed first, if possible.

In control theory, input shaping is an open-loop control technique for reducing vibrations in computer-controlled machines. The method works by creating a command signal that cancels its own vibration. That is, a vibration excited by previous parts of the command signal is cancelled by vibration excited by latter parts of the command. Input shaping is implemented by convolving a sequence of impulses, known as an input shaper, with any arbitrary command. The shaped command that results from the convolution is then used to drive the system. If the impulses in the shaper are chosen correctly, then the shaped command will excite less residual vibration than the unshaped command. The amplitudes and time locations of the impulses are obtained from the system’s natural frequencies and damping ratios. Shaping can be made very robust to errors in the system parameters.


The setup of input shaper on BIGTREETECH’s Raspberry Pi alternative the CB1 has a few extra and different steps compared to the guide supplied on the klipper documents. The CB1 either runs on the BIGTREETECH M5P, M8P, or Pi4 adapter board. We still recommend reading through klippers documents on measuring resonances for all the commands you are able to use with input shaper. At the time of writing this the only differences were the wiring, and a small number of extra configuration steps to get input shaper setup on the BTT CB1 compared to the Raspberry Pi. This guide is based off you using BIGTREETECH’s release of mainsail available on their github.

The ADXL 345 we will be using as a reference in this guide is the exact same version as you will find here.


To wire the ADXL 345 Accelerometer to your BTT CB1 you can follow the wiring diagram below

ADXL345 pin PI4B CB1 Pin name
GND 25 Ground
VCC 17 3v3
CS 15 GPIO22

Secondly, you will have to enable SPI on your CB1. To do so you use a program such as WinSCP to connect to your cb1. The standard username and password for the cb1 will be biqu/biqu. If you navigate yourself to the /boot/ directory youll find a file named BoardEnv.txt

Edit 07/08/23

To edit BoardEnv.txt you will have to remove the SD card from the cb1 and insert it into your PC. You are unable to edit this file while the board is powered on. Thank you to LGN22’s comment and bringing this to our attention.

Download this file to your computer. Using a text editor like Notepad++ and un-comment the following lines of like i have pasted below to enable SPI.

# uncomment the following overlays and parameters to release 'spidev1.1' to user space
# NOTE: 'spidev1.1' cannot be used together with TFT35_SPI and MCP2515

Save the file and upload writing over the old file and reboot your CB1.

Thirdly, we will install the software. We will be quoting the steps found in the klipper documentation.

Note that resonance measurements and shaper auto-calibration require additional software dependencies not installed by default. First, run on your Raspberry Pi the following commands:

sudo apt update
sudo apt install python3-numpy python3-matplotlib libatlas-base-dev

Next, in order to install NumPy in the Klipper environment, run the command:

~/klippy-env/bin/pip install -v numpy

Note that, depending on the performance of the CPU, it may take a lot of time, up to 10-20 minutes. Be patient and wait for the completion of the installation. On some occasions, if the board has too little RAM the installation may fail and you will need to enable swap.

You may find this has already been installed if your used the image from the btt cb1 github page.

Forth step is adding the lines to your printer.cfg file via mainsail. While on your 3d printers mainsail page navigate to “Machine” on the left. Then find printer.cfg. Open and edit printer.cfg adding the following lines.

[mcu rpi]
serial: /tmp/klipper_host_mcu

cs_pin: rpi:gpiochip0/gpio74
spi_bus: spidev1.1

accel_chip: adxl345
 100, 100, 20

You now should be fine to follow the steps on klipper docs for using commands to get input shaper outputs.