Klipper Input Shaper Calibration: ADXL345 Setup and Resonance Compensation
You’ve seen the Input Shaper graphs — that satisfying before-and-after where the resonance peak drops from a mountain to a molehill. The reality behind those graphs is that ringing artifacts (ghosting around sharp corners, vertical banding on flat walls) are the single biggest quality killer on fast CoreXY printers like the Voron 2.4. Input Shaper, when calibrated correctly, eliminates these artifacts while letting you print at speeds that would otherwise turn your prints into a vibrating mess. Here’s exactly how to set it up with an ADXL345 accelerometer.
Why Input Shaping Works
Every printer has resonant frequencies — specific vibration modes where the frame, gantry, and toolhead naturally oscillate. When your printer accelerates for a direction change, it excites these resonances. The vibration transfers to the extruded plastic, creating visible artifacts on the print surface. Input Shaping works by pre-filtering the motion commands: it applies a precisely-timed counter-pulse that cancels the resonance before it reaches the print head. The math is complex (the original research paper is from the 1950s — it’s been used in industrial CNC for decades), but the implementation in Klipper is straightforward if you have the right hardware.
Hardware: The ADXL345 Accelerometer
The ADXL345 is a 3-axis accelerometer that costs $3-8 on a breakout board. It communicates via SPI (preferred for Klipper) or I2C and measures acceleration up to ±16g with 13-bit resolution. You need two measurements: one on the toolhead (X-axis resonance) and one on the bed (Y-axis resonance on a CoreXY, or the Y-axis on a bedslinger).
Wiring to the Raspberry Pi (SPI mode, recommended):
| ADXL345 Pin | Raspberry Pi GPIO |
|---|---|
| VCC | 3.3V (Pin 1) |
| GND | Ground (Pin 6) |
| CS | GPIO8 (Pin 24) — SPI CE0 |
| SDO | GPIO9 (Pin 21) — SPI MISO |
| SDA | GPIO10 (Pin 19) — SPI MOSI |
| SCL | GPIO11 (Pin 23) — SPI SCLK |
Some ADXL345 breakout boards have a voltage regulator and accept 5V — check your board’s documentation. If your board only accepts 3.3V, do NOT connect to the Pi’s 5V pin or you’ll fry it. The Pi’s 3.3V rail can supply enough current for the accelerometer (it draws under 1mA).
Mounting the ADXL345 to the toolhead: This is the finicky part. The accelerometer must be rigidly mounted — any wobble in the mount introduces false readings. Options: – A printed bracket that screws into existing toolhead holes (best) – Double-sided tape directly on the hotend fan shroud (works in a pinch, but resonant frequencies may be damped by the plastic) – Zip-tied to the hotend (worst — avoid) The X and Y axes of the ADXL must be aligned with the printer’s X and Y axes. Most boards have axis markings silkscreened on the PCB.
Klipper Configuration
Add this to your printer.cfg:
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
spi_bus: spidev0.0
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # Center of bed; adjust for your build volume
The [mcu rpi] section enables the Raspberry Pi itself as a secondary MCU, which allows Klipper to directly control the Pi’s GPIO pins for the SPI connection. After adding this configuration, run sudo raspi-config and enable SPI under Interface Options, then restart Klipper.
Running the Calibration
With the ADXL345 mounted on the toolhead:
- Home the printer:
G28 - Heat the nozzle to printing temperature (this matters — a cold hotend has different resonant characteristics than a hot one)
- Run the X-axis test:
TEST_RESONANCES AXIS=X - Run the Y-axis test:
TEST_RESONANCES AXIS=Y
Each test takes about 30-60 seconds. The printer will vibrate through a frequency sweep from low to high while the ADXL345 records the response. When complete, Klipper generates a PNG graph in /tmp/resonances/ showing the frequency response curve.
Now mount the ADXL345 on the bed (or use a second ADXL345 permanently mounted there) and repeat for the bed resonances. On a CoreXY, the bed only needs Y-axis measurement. On a bedslinger (Ender 3 style), you need X-axis measurement on the bed too.
Interpreting the Graphs
Klipper’s calibrate_shaper.py script analyzes the graphs and recommends shaper types and frequencies for each axis. It will output something like:
Fitted shaper 'zv' frequency = 46.2 Hz (vibrations = 2.1%, smoothing ~= 0.031)
Fitted shaper 'mzv' frequency = 41.8 Hz (vibrations = 1.2%, smoothing ~= 0.042)
Fitted shaper 'ei' frequency = 49.8 Hz (vibrations = 0.7%, smoothing ~= 0.062)
Recommended shaper is mzv @ 41.8 Hz
The trade-off: ZV (Zero Vibration) gives the least smoothing but leaves some residual vibration. EI (Extra Insensitive) eliminates nearly all vibration but adds more smoothing (rounds corners slightly). MZV (Modified Zero Vibration) is the middle ground and is usually the best choice for FDM printing.
Apply the recommended shaper in your printer.cfg:
[input_shaper]
shaper_type_x: mzv
shaper_freq_x: 41.8
shaper_type_y: ei
shaper_freq_y: 52.3
Verification: The Ringing Test Print
Print the Klipper ringing test model (a simple square with sharp corners) at your target speeds. Use a light color filament — ringing artifacts are most visible on matte light-colored surfaces. Inspect the corners for ghosting. If you see faint echoes of the corner repeating at ~1-2mm intervals, your shaper frequency or type needs adjustment. Re-run the calibration with the ADXL345 mounted more rigidly, or try a different shaper type.
Input Shaper is one of those upgrades that, once dialed in, you’ll wonder how you ever printed without it. The $5 ADXL345 and 30 minutes of setup time is the best return on investment in 3D printing — turning a printer that produces acceptable parts into one that produces professional results at speeds that make stock firmware users do a double-take.
