Skip to main content

Accelerometer Usage

Update Klipper

  • Klipper supports the LIS3DH accelerometer as of November 13, 2024. If you need to use the LIS3DH accelerometer, you need to update Klipper.
  • After connecting to the host computer via the network, enter the following code (update may fail due to network issues):
    cd ~/klipper 
    git pull

Add Configuration

#####################################################################
# LIS3DH Accelerometer Configuration (Enable if needed)
#####################################################################
[lis3dh]
cs_pin: SHT36:gpio9
spi_software_sclk_pin: SHT36:gpio10
spi_software_mosi_pin: SHT36:gpio11
spi_software_miso_pin: SHT36:gpio12

[resonance_tester]
accel_chip: lis3dh
probe_points:
125, 125, 20 # Set this to the coordinates of the nozzle during resonance measurement


Usage Tutorial

Install Dependencies

tip

It is recommended to use SSH tools such as MobaXterm_Personal for operation.

tip

The FLY host does not need to be executed, as it already comes with the accelerometer dependency package.

  • Please execute the following commands sequentially to install the dependency package.

  • Note that, depending on the CPU's performance, it may take a lot of time, up to 10-20 minutes. Please wait patiently for the installation to complete. In some cases, if the motherboard's RAM is too low, the installation may fail.

    sudo apt install python3-numpy python3-matplotlib libatlas-base-dev
    ~/klippy-env/bin/pip install matplotlib numpy

Test Accelerometer

  • You need to reset before proceeding.
  • Execute ACCELEROMETER_QUERY in the console.
  • For multiple accelerometers, specify which one to test using ACCELEROMETER_QUERY CHIP=<ADXL>, where <ADXL> needs to be replaced with the corresponding accelerometer name.
  • If there are errors, please check the wiring and configuration.
  • The normal output is shown below:
  • This allows you to perform resonance compensation measurement.

Calibrate Accelerometer

  • Reset.
  • Enter SHAPER_CALIBRATE in the console to start automatic calibration of X, Y.
  • After calibration is complete, execute SAVE_CONFIG to save the data.
  • You can also use SHAPER_CALIBRATE AXIS=X to automatically calibrate one axis.
  • The calibration process may take a while, so please be patient.
tip

Attention! If the printer vibrates too violently during testing, please press the emergency stop immediately or send M112 to stop.

  • Excessive accel_per_hz can make the vibration intense, so you can reduce it appropriately.

    [resonance_tester]
    accel_per_hz: 50 # Default value is 75