Skip to main content

Accelerometer Usage

Tip
  • The Mini Pad can directly connect an accelerometer via the onboard interface or use a tool board with a built-in accelerometer.

Connecting an External Accelerometer via Onboard Interface

Loading...
  • Reference Configuration
[mcu host]
serial: /tmp/klipper_host_mcu

[adxl345]
cs_pin: host:None
spi_bus: spidev1.0

[resonance_tester]
accel_chip: adxl345
#accel_chip_y: adxl345 bed
probe_points:
100, 100, 20 # an example

Accelerometer Usage

Accelerometer Testing and Calibration

Dependency Package Installation

Notes
  • If the device is running the FlyOS-FAST system, the required dependencies are pre-installed, and this step can be skipped.
  • If using a non-FLY host device, please ensure the following installation steps are completed.
  • It is recommended to use SSH tools like MobaXterm or PuTTY for connection before proceeding.
  • This tutorial is based on a Raspberry Pi; other platforms are for reference only.

Installation Steps

  1. Execute the following commands in sequence to install the dependency packages.
  2. The installation time depends on CPU performance and network conditions, typically taking 10–20 minutes. Please wait patiently until completion.
  3. If the device has insufficient RAM, the installation may fail.

Step 1: Install system dependency packages

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

Step 2: Install Klipper virtual environment dependency packages

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

Accelerometer Testing

Prerequisites

  • The printer has performed a Homing operation.
  • Ensure the accelerometer has been correctly enabled in the Klipper configuration file.

Test Commands

Enter the following command in the Klipper console:

ACCELEROMETER_QUERY

If multiple accelerometers are connected, specify the chip for testing:

ACCELEROMETER_QUERY CHIP=<ADXL chip name>

Replace <ADXL chip name> with the actual accelerometer identifier (e.g., adxl345).

Tip

Some older versions of Klipper require executing ACCELEROMETER_QUERY twice before obtaining accelerometer data.

Common Issue Handling

  1. First execution fails: Some Klipper versions may have a command recognition delay. If the first execution does not return data, re-execute the same command.
  2. Command not recognized: If repeated executions still indicate an unknown command, it may be due to an outdated Klipper version. It is recommended:
    • Update Klipper to the latest version
    • or reflash the latest system version (e.g., the latest FlyOS-FAST version)

Result Interpretation

  • Normal output: If a continuous data stream is returned (as shown in the figure below), the accelerometer is working correctly, and resonance compensation measurement can proceed.
  • Error output: If there is a timeout, no data, or communication error, please check in order:
    1. Whether the accelerometer wiring is secure
    2. Whether the sensor configuration and SPI settings in the configuration file are correct
    3. Whether the power supply is stable
Loading...

Accelerometer Calibration

Calibration Steps

  1. Ensure the printer has homed.

  2. Enter the following command in the console to start automatic calibration of the X and Y axes:

    SHAPER_CALIBRATE
  3. After calibration is complete, save the configuration:

    SAVE_CONFIG

Single-Axis Calibration

To calibrate only a single axis, use:

SHAPER_CALIBRATE AXIS=X

Or replace X with Y.

Safety Tip

During calibration, the printer may produce intense vibrations. If the vibration is excessive, immediately press the emergency stop button or send the M112 command for an emergency stop.

Adjusting Vibration Intensity

If the vibration is too strong during testing, appropriately reduce the accel_per_hz parameter value (default 75):

[resonance_tester]
accel_per_hz: 50

Note: The above steps apply to the resonance compensation configuration of most Klipper-based 3D printers. Please adjust according to the actual hardware and system environment.

Loading...