Input Shaper Crash Course

Published: 12 May, 2023
Share:

 

Install Python Libs

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

 

Install Numpy

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

 

Install the rc script

If you want to use the host as a secondary MCU the klipper_mcu process must run before the klippy process.

After installing Klipper, install the script. run:

cd ~/klipper/
sudo cp ./scripts/klipper-mcu.service /etc/systemd/system/
sudo systemctl enable klipper-mcu.service

To compile the Klipper micro-controller code, start by configuring it for the "Linux process":

cd ~/klipper/
make menuconfig

In the menu, set "Microcontroller Architecture" to "Linux process," then save and exit.

To build and install the new micro-controller code, run:

sudo service klipper stop
make flash
sudo service klipper start

If klippy.log reports a "Permission denied" error when attempting to connect to /tmp/klipper_host_mcu then you need to add your user to the tty group. The following command will add the "pi" user to the tty group:

sudo usermod -a -G tty pi

 

Configure ADXL345 With RPi

Make sure the Linux SPI driver is enabled by running sudo raspi-config and enabling SPI under the "Interfacing options" menu.

Veryfi SPI Interface

Method 1: Using raspi-config

  1. Open a terminal.
  2. Type sudo raspi-config and press Enter. This will open the Raspberry Pi configuration tool.
  3. Use the arrow keys to navigate to "3 Interface Options" and press Enter.
  4. Navigate to "P4 SPI" and press Enter.
  5. If SPI is enabled, you will see "SPI is enabled" on the screen.

Method 2: Checking /boot/config.txt

  1. Open a terminal.
  2. Type sudo nano /boot/config.txt and press Enter. This will open the config.txt file in the nano text editor.
  3. Look for a line that says dtparam=spi=on. If this line exists and isn't commented out (i.e., it doesn't have a '#' at the start of the line), SPI is enabled.
  4. Press Ctrl+X to exit the editor.

Method 3: Checking the /dev directory

If SPI is enabled, the system will create device files for SPI.

  1. Open a terminal.
  2. Type ls /dev/spi* and press Enter.
  3. If SPI is enabled, you will see something like /dev/spidev0.0 /dev/spidev0.1.

Please remember that the Raspberry Pi needs to be restarted for changes to take effect. If you've just enabled SPI, be sure to reboot your Pi.

Update printer.cfg:

[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
    100, 100, 20  # an example

Checking the setup

Now you can test a connection.

  • For "non bed-slingers" (e.g. one accelerometer), in Octoprint, enter ACCELEROMETER_QUERY
  • For "bed-slingers" (e.g. more than one accelerometer), enter ACCELEROMETER_QUERY CHIP= where is the name of the chip as-entered, e.g. CHIP=bed (see: bed-slinger) for all installed accelerometer chips.

You should see the current measurements from the accelerometer, including the free-fall acceleration, e.g.

Recv: // adxl345 values (x, y, z): 470.719200, 941.438400, 9728.196800

Printer Config

[printer]
kinematics: corexy
max_velocity: 300  
max_accel: 10000             #Max 4000
max_accel_to_decel: 10000
max_z_velocity: 15          #Max 15 for 12V TMC Drivers, can increase for 24V
max_z_accel: 350
square_corner_velocity: 5.0

Measuring the resonances

Now you can run some real-life tests. Run the following command:

TEST_RESONANCES AXIS=X
 

 

 

Share:

0 Comments

Leave us your comments

Related Information

Accept an invitation to join a Canvas course as an instructor

If you are using Canvas through your institution, you will most likely already have a Canvas account...

How to solve Canvas overload Issue: This website is under heavy load (queue full)

If you are the self-hosted Open source Canvas LMS administrator, you would get this error message fr...

How do I copy content from another Canvas course using the Course Import tool?

You can copy course content such as assignments, modules, pages, and discussions from previous Canva...

How do I add or edit details in an assignment?

When you create an assignment, you'll add details for the assignment such as the description, file s...