Skip to main content

Accelerometer Usage Tutorial

Accelerometer Usage Limitations

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

If you need to use the accelerometer function on a device based on the LITE2 series, please choose one of the following two options:

OptionRecommended ProductConnection/Description
1. USB AccelerometerFLY-USB-LIS2DWA USB-based LIS2DW accelerometer. Simply plug it into the USB port of the host computer for use, no need to connect it to the mainboard.
2. Toolboard with Built-in AccelerometerExpansion toolboard with integrated LIS2DW or ADXL345Communicates with the mainboard via CAN or other interfaces; the accelerometer is recognized and utilized as part of the toolboard.

Important Reminder: Do not attempt to connect modules such as 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 accelerometers.

Dependency Installation

Notes
  • If the device is running the FlyOS-FAST system, the required dependencies are pre-installed in the system, and this step can be skipped.
  • If using a non-FLY upper computer, please ensure the following installation steps are completed.
  • It is recommended to use SSH tools such as MobaXterm or PuTTY for connection before proceeding.
  • This tutorial is based on 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 the installation is complete.
  3. If the device has insufficient memory (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 the 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).

Tip

Some older versions of Klipper require executing ACCELEROMETER_QUERY twice to retrieve acceleration data.

Common Issue Handling

  1. First execution fails: Some Klipper versions may have command recognition delays. If no data is returned on the first execution, run the same command again.
  2. Command not recognized: If the command remains unrecognized after multiple attempts, the Klipper version may be too old. It is recommended to:
    • Update Klipper to the latest version
    • Or reflash the latest system version (e.g., the latest FlyOS-FAST version)

Result Interpretation

  • Normal output: If continuous data streams are returned (as shown in the figure below), the accelerometer is working correctly and resonance compensation measurements can proceed.
  • Error output: If timeout, no data, or communication errors are reported, check the following in order:
    1. Ensure the accelerometer wiring is secure
    2. Verify the sensor configuration and SPI settings in the configuration file are correct
    3. Confirm 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

The printer may generate intense vibrations during calibration. If vibrations become excessive, immediately press the emergency stop button or send the M112 command for an emergency stop.

Adjusting Vibration Intensity

If vibrations during testing are too strong, you can reduce the accel_per_hz parameter value (default 75):

[resonance_tester]
accel_per_hz: 50

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

Loading...