Have questions? Call Us

Canada-Wide: Materials & Parts — FREE Shipping $150+*

Select ON & QC Areas: $10 Flat Rate Shipping • FREE $99+*

Have questions? Call Us

How to Wire an ADXL345 for Input Shaping and Configure Klipper

How to Wire an ADXL345 for Input Shaping and Configure Klipper

A correct signal path matters as much as the sensor itself. For Klipper input shaping, connect the ADXL345 to a Raspberry Pi over SPI, not I2C. The standard wiring uses the Pi’s 3.3 V and ground pins, plus GPIO08 for chip select, GPIO09 for MISO, GPIO10 for MOSI, and GPIO11 for the clock.

It’s easy to focus on the printer.cfg settings and overlook the physical setup. But secure mounting and correctly matched connections are essential starting points for collecting useful vibration data. This guide walks you through input shaping accelerometer ADXL345 wiring, from mounting the sensor on the right printer assembly to checking each connection before you power up.

You’ll also learn how to configure the Raspberry Pi MCU and ADXL345 in printer.cfg, then run the calibration steps in Klipper. Follow along at your own pace, and you’ll have a clear path from wiring the sensor to using its measurements to tune input shaping.

Key Takeaways

  • Use SPI to connect an ADXL345 to a Raspberry Pi, and match each sensor signal to the correct GPIO pin.
  • Mount the accelerometer on the moving assembly being tested so Klipper can measure the relevant vibration.
  • Check the wiring and voltage before configuring the sensor to help catch connection problems early.
  • Set up the Raspberry Pi MCU and ADXL345 in printer.cfg, then use Klipper’s calibration process to tune input shaping.
  • Use the measured resonance results to choose a suitable shaper for your printer rather than relying on a generic setting.

Configuring the Raspberry Pi MCU and ADXL345 in printer.cfg

Use SPI to connect an ADXL345 to a Raspberry Pi for Klipper resonance measurements. I2C throughput is too low for this use. This input shaping accelerometer adxl345 wiring setup starts with matching each sensor lead to the host’s SPI pin.

  1. Match the Raspberry Pi SPI pins. Connect the sensor’s 3V3 or VCC pin to Pi pin 01, and GND to pin 06. Connect CS to pin 24, GPIO08; SDO to pin 21, GPIO09; SDA to pin 19, GPIO10; and SCL to pin 23, GPIO11. Here, SDA carries MOSI, and SCL carries the clock. For input shaping accelerometer adxl345 wiring, follow the Pi pin numbers rather than relying on wire colours.
  2. Use the Pico pinout when that is your host. Connect the sensor’s power and ground to compatible pins on the Pico. Connect CS to pin 2, GP1; SDO to pin 1, GP0; SDA to pin 5, GP3; and SCL to pin 4, GP2. Klipper recommends powering the sensor from 3.3 V with a Pico to avoid damaging the Raspberry Pi.
  3. Configure the host MCU and accelerometer. In printer.cfg, add an MCU section for the Raspberry Pi host, then add an ADXL345 section that uses the host’s SPI device. Make sure the accelerometer refers to the same host MCU and that its chip-select setting matches the physical connection. Save the file and restart Klipper to load the updated configuration.
  4. Map signals correctly on a printer controller board. Use the board’s own SPI pin names for chip select, MISO, MOSI, and clock. Connect the sensor’s power and ground to compatible pins. Raspberry Pi header numbers don’t automatically match controller-board pin names. Klipper recommends three twisted pairs for SPI accelerometers: ground with MISO, 3.3 V with MOSI, and SCLK with CS.
  5. Confirm communication before calibration. Query the ADXL345, then run Klipper’s axis-noise measurement before resonance testing. Reported axis-noise values should be below 100. If the sensor doesn’t respond, compare the configured SPI device and chip-select setting with the actual host and wiring. Correct connection problems before running X- and Y-axis tests or saving shaper results.

ADXL345 requirements and mounting

The ADXL345 measures movement along three axes. Its mounting location affects which printer vibrations Klipper records. Follow these steps before running resonance tests.

  1. Choose the assembly that moves along the axis being tested. For X-axis resonance testing, mount the ADXL345 on the extruder. The sensor should move with the toolhead, so it captures vibrations associated with that moving assembly. For a bed-slinger’s Y-axis test, mount it on the heated bed. A sensor fixed to the frame won’t follow the same movement as the tested part.
  2. Use a firm, stable mounting point. Secure the ADXL345 so it doesn’t shift during printer movement. A loose mount can add unwanted motion to the readings, making the resonance data harder to interpret. Keep the sensor’s body against its bracket or mounting surface. Avoid a setup where the board can swing, rattle, or press against another moving part during a test.
  3. Keep the sensor clear of the printer’s travel. Check the extruder’s full X-axis movement before testing. On a bed-slinger, check the bed’s complete Y-axis travel. Ensure the board and cable cannot catch on the frame, bed, or gantry. A cable that pulls as the assembly moves can disturb the sensor or obstruct printer motion.
  4. Keep the mounting consistent between tests. Klipper compares measured movement with the tested axis, so a changed sensor position can affect the readings. If you remove the ADXL345 between X and Y measurements, record where it was mounted and how it was oriented. Refit it securely before the next test. On printers requiring sensor movement, use the correct assembly for each axis.
  5. Inspect the mount before connecting power. Confirm the ADXL345 sits flat and stays in place when the printer is moved by hand. Check for contact with belts, pulleys, wiring, or the build surface. Then route the sensor cable so it has enough slack for the test movement without dragging across the printer. Recheck the mount if you reposition the accelerometer.

If a hardware fault prevents stable movement or mounting, 3D printer repair services can address the printer issue before calibration.

For bed-slinger Y-axis resonance measurements, the recommended location is the heated bed. Treat the mounting point as part of the test setup: the sensor must move with the assembly being measured. Before each run, confirm the board is firmly seated and the cable follows the moving assembly without pulling on it. If you remove the sensor to measure another axis, note its placement and orientation so you can restore the setup consistently.

After refitting the sensor, move the printer assembly through its travel by hand and recheck the cable route. Look for looseness, snags, or contact with nearby components, then adjust the mount or routing before powering the sensor. A stable, repeatable installation helps distinguish sensor readings from motion caused by a shifting board or cable. If the mount changes, check it again before comparing measurements.

Accelerometer wiring safety

Protect the ADXL345 and printer electronics by controlling power, voltage, and cable movement during installation.

  1. Disconnect power before handling wires. Shut down the Raspberry Pi and printer controller before connecting or removing the ADXL345. This reduces the chance of accidental shorts while loose leads touch neighbouring pins. Keep the sensor disconnected while arranging its wiring, then inspect every connection before restoring power. If you need to change a wire, power down again first.
  2. Use the correct supply voltage. For the documented Raspberry Pi SPI connection, the sensor’s 3V3 or VCC pin connects to Pi pin 01. A Raspberry Pi Pico connection uses its 3.3 V supply pin, pin 36. Klipper recommends 3.3 V with a Pico to avoid damaging the Raspberry Pi. Don’t treat a connector marked VCC as permission to use any voltage.
  3. Keep ground and signal pins distinct. A Raspberry Pi SPI setup uses pin 06 for ground, pin 24 for CS, pin 21 for SDO, pin 19 for SDA, and pin 23 for SCL. Check the board labels and pin numbers before attaching each lead. A misplaced jumper can connect power to a signal pin, so compare the wiring against the correct host’s pinout.
  4. Separate the cable from moving hardware. The ADXL345 may sit on an extruder for X-axis tests or a heated bed for bed-slinger Y-axis tests. Route its cable away from belts, pulleys, and travel paths. Leave enough slack for the tested assembly to move, but prevent loops from catching on the printer frame or snagging another wire.
  5. Use twisted pairs for SPI wiring. Klipper wiring guidance recommends three twisted pairs: ground with MISO, 3.3 V with MOSI, and SCLK with CS. Keep each pair together along the cable route. This arrangement helps keep related signals organized and reduces loose-wire tangles near the printer. Secure the cable so printer motion won’t pull directly on the ADXL345 pins.
  6. Don’t substitute I2C wiring for SPI. The ADXL345’s I2C throughput is too low for this use. Use the SPI connections shown for the selected host instead of connecting SDA and SCL as an I2C bus. If the sensor fails to communicate after power-up, shut down before changing wires. Recheck the host pinout, supply, ground, and signal connections first.
  7. Inspect before switching on. Look for exposed conductor, loose jumper ends, crossed connections, or a cable pressing against moving parts. Check that the ADXL345 mount is secure and that the wire remains clear through the printer’s intended test movement. Restore power only after the connections match the chosen Raspberry Pi or Pico SPI layout.
Input shaping accelerometer adxl345 wiring

Checking wiring continuity and voltage

Test the ADXL345 wiring before starting Klipper. A multimeter can help identify open connections, shorts, and supply-voltage problems.

  1. Check wiring continuity

    Power off the Raspberry Pi and printer controller first. Set the multimeter to continuity and test each wire end to end. A good connection should register consistently; an open circuit can indicate a loose lead, broken wire, or poor contact. Also check adjacent conductors for unintended continuity. Never use continuity mode on a powered circuit, as this can damage the meter or electronics.

    For an SPI connection, trace each signal separately: CS, SDO, SDA, and SCL. Confirm the ground and power wires reach their intended endpoints. If a reading changes when you gently move a cable, inspect its terminals and crimps. Secure the lead, then repeat the test to make sure movement during printer testing will not interrupt the connection.

  2. Check the wiring voltage

    Inspect the circuit while powered only if you can safely reach its test points. Set the multimeter to DC voltage, then measure between the ADXL345 power input and ground. A Raspberry Pi or Pico setup should supply 3.3 V to the sensor. Keep the probes steady and separated; slipping across nearby pins can create a short.

    For I2C wiring, check each SCL and SDA line’s resistance to 3.3 V with power off. Klipper’s recommended range is 900 ohms to 1.8K for each line. This check applies to I2C, not the SPI wiring used for input shaping. Don’t apply the I2C resistance test to powered wiring or treat it as an SPI voltage check.

  3. Identify wiring and communication errors

    Compare every wire with the selected host’s pinout before changing printer.cfg. Common errors include swapped SPI signals, a missing ground, loose connections, and using I2C wiring for Klipper input shaping. On a Raspberry Pi SPI setup, SDA carries MOSI and SCL carries the clock. Those labels can mislead anyone expecting an I2C connection.

    If Klipper can’t communicate with the ADXL345, recheck the CS line and the SDO-to-MISO connection first. Then confirm the configured SPI device matches the host and physical wiring. Power down before moving a lead. After corrections, restart Klipper and query the sensor again. A successful connection should precede resonance testing, not follow it.

How does accelerometer input shaping work in 3D printers?

  1. Measure vibration during controlled printer moves. The ADXL345 is a three-axis accelerometer. It records printer movement during Klipper test moves, helping identify resonances along the X and Y axes. The printer’s structure, belts, and moving assemblies each influence those readings. Klipper uses the measured response to determine which vibration frequencies need attention. Reliable results depend on a secure sensor mount and a working connection.
  2. Run a resonance test for each axis. Klipper moves the printer through a frequency sweep, typically spanning 5-133 Hz. During this test, the ADXL345 records the motion produced at different frequencies. A resonance peak appears where the machine responds strongly. Cartesian printers can show a dominant Y-axis belt peak around 40-60 Hz, with a secondary peak around 70-90 Hz. CoreXY machines often show peaks around 80-120 Hz.
  3. Use the measured peaks to select a shaper. Input shaping applies timed motion adjustments to counter vibrations that cause ringing. Klipper evaluates the test data and recommends a shaper type and frequency. For example, one calibration recommends MZV at 55.2 Hz. That example illustrates how a measured frequency informs the setting, not a universal value for every printer. Use your own test results instead of copying another machine’s calibration.
  4. Balance reduced ringing against retained detail. A shaper can reduce visible ringing, but stronger filtering may soften details or limit usable acceleration. Klipper’s recommendation may include a maximum acceleration to prevent excessive smoothing. Consider that value alongside the selected shaper and frequency. A clean test result matters, but so does preserving sharp corners and surface detail in the prints you actually make.
  5. Validate the settings with a print. After applying the recommended shaper, run a ringing-test print at an exterior-perimeter speed of 100-150 mm/s. Inspect the walls and corners for residual ringing or bulging. Input shaping can reduce ringing without correcting every print-quality issue, so assess the actual result rather than relying only on the calibration output. If vibration or motion faults persist, get help with 3D printer repair.

When properly tuned, input shaping can eliminate 95%+ of visible ringing. That potential makes careful calibration worthwhile, but it should be treated as an outcome to verify on the printer rather than assumed from the settings alone. The measured response provides the basis for choosing the shaper and frequency, while the ringing-test print shows whether that choice works on actual walls and corners. If the result is still visibly affected, revisit the calibration instead of treating one recommendation as a universal answer. At the same time, judge the surface for softened detail and corner definition: reducing one artifact is useful only if the print still retains the features that matter. A balanced setting is therefore one that suppresses the observed ringing while keeping detail acceptable for the prints being made. Repeat the assessment after adjustments, using the printer’s own motion measurements and print results to guide the decision.

3D Printing Canada

3D Printing Canada helps you move from troubleshooting toward a working printer setup. If the ADXL345 connects but Klipper still reports communication errors, or printer motion seems unreliable, a hardware fault may need attention. 3D Printer Repair Services can help address printer hardware issues that interrupt calibration or everyday printing.

For setup questions, use the wiring checks and Klipper configuration steps above to narrow down whether the problem sits in the sensor connection, configuration, or printer hardware. Clear details about the printer model, controller, and error message can help frame the issue. If you’d like help with a printer problem affecting your input-shaping setup, contact 3D Printing Canada.

Put your calibration to work

Once the sensor setup is complete, make your next step a deliberate print-quality check. Treat input-shaping accelerometer ADXL345 wiring as the foundation for a repeatable tuning process, then observe how your own printer responds during ordinary jobs. Changes in filament, printer condition, or motion settings can affect what you notice, so let the finished print guide your next adjustment rather than chasing a setting in isolation.

If setup problems persist or printer hardware is disrupting calibration, 3D Printing Canada offers 3D Printer Repair Services. For questions about your printer or a hardware issue affecting your work, contact 3D Printing Canada. Take the next step with a clear observation and a specific issue to solve. Your next print is an opportunity to build on what you’ve learned.

Frequently Asked Questions

How to connect an ADXL345 to a Raspberry Pi for Klipper input shaping?

Connect the ADXL345 to the Raspberry Pi using SPI, then match the sensor pins to the Pi header. Wire 3V3 to pin 01, GND to pin 06, CS to pin 24, SDO to pin 21, SDA to pin 19, and SCL to pin 23. Configure the host MCU and accelerometer in printer.cfg. For example, don’t select I2C for Klipper resonance measurements.

How to mount an ADXL345 to a 3D printer toolhead safely and securely?

Fasten the ADXL345 firmly to the toolhead for an X-axis resonance test, with its board unable to rattle or shift. Before testing, move the toolhead through its full travel and confirm the sensor and cable clear the frame, belts, and other hardware. Leave enough cable slack for movement, but secure the wire so it won’t snag or pull on the sensor connection.