Skip to main content

Accelerometer Usage Tutorial

Accelerometer Usage Limitations

Due to the hardware design of the LITE2 series, it cannot directly connect to and drive independent SPI/I²C accelerometer modules (such as ADXL345).

If you need to use accelerometer functionality on devices based on the LITE2 series, please choose one of the following two solutions:

SolutionRecommended ProductConnection/Description
1. USB AccelerometerFLY-USB-LIS2DWA USB interface LIS2DW accelerometer that plugs directly into the host computer's USB port for use, no connection to the mainboard is required.
2. Toolboard with Built-in AccelerometerExpansion toolboards integrated with LIS2DW or ADXL345Communicates with the mainboard via CAN or other interfaces; the accelerometer is recognized and called as part of the toolboard.

Important Reminder: Do not attempt to connect modules like ADXL345 directly to the pins of the C8P mainboard. To ensure compatibility and proper functionality, it is recommended to use the FLY-USB-LIS2DW USB accelerometer specifically designed for external acceleration measurement.

Dependency Installation

warning

Important Notes

  • If your device is running the FlyOS-FAST system, the required dependencies are pre-installed, and you can skip this step.
  • If using a non-FLY host, you must complete the following installation steps.
  • It is recommended to connect via SSH tools such as MobaXterm or PuTTY before proceeding.

Installation Steps

  1. Execute the following commands sequentially 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 the installation is complete.
  3. If the device has insufficient RAM, the installation may fail.

Install system dependencies:

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

Install Klipper virtual environment dependencies:

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

Accelerometer Testing

Prerequisites

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

Test Command

Enter the following command in the Klipper console:

ACCELEROMETER_QUERY

If multiple accelerometers are connected, you can specify a chip for testing:

ACCELEROMETER_QUERY CHIP=<ADXL Chip Name>

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

Troubleshooting Common Issues

  1. First Execution Failure: Some Klipper versions may have command recognition delays. If the first execution does not return data, please re-execute the same command.
  2. Command Not Recognized: If the command is still unrecognized after multiple attempts, it may be due to an outdated Klipper version. It is recommended to:
    • Update Klipper to the latest version
    • Or re-flash 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 image below), it indicates the accelerometer is functioning correctly and resonance compensation measurements can proceed.
  • Error Output: If a timeout, no data, or communication error is reported, please check the following 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...

  • Note: Some older versions of Klipper require executing ACCELEROMETER_QUERY twice to obtain acceleration values.

Accelerometer Calibration

Calibration Steps

  1. Ensure the printer has performed Homing.
  2. Enter the following command in the console to start automatic calibration for the X and Y axes:
    SHAPER_CALIBRATE
  3. After calibration is complete, save the configuration:
    SAVE_CONFIG

Single-Axis Calibration

If you only need to calibrate a single axis, use:

SHAPER_CALIBRATE AXIS=X

Or replace X with Y.

caution

Safety Warning

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

Adjusting Vibration Intensity

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

[resonance_tester]
accel_per_hz: 50

Note: The above steps are applicable to most Klipper-based 3D printer resonance compensation configurations. Please adjust according to your actual hardware and system environment.

Loading...