Accelerometer Usage
Usage Tutorial
Dependency Installation
- 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
- Execute the following commands in sequence to install the dependency packages.
- The installation time depends on CPU performance and network conditions, typically taking 10–20 minutes. Please wait patiently until the installation is complete.
- 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).
Some older versions of Klipper require executing ACCELEROMETER_QUERY twice to retrieve acceleration data.
Common Issue Handling
- 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.
- 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:
- Ensure the accelerometer wiring is secure
- Verify the sensor configuration and SPI settings in the configuration file are correct
- Confirm the power supply is stable
Accelerometer Calibration
Calibration Steps
-
Ensure the printer has homed.
-
Enter the following command in the console to start automatic calibration of the X and Y axes:
SHAPER_CALIBRATE -
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.
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.