Klipper + ADXL345 Input Shaper guide: Difference between revisions
m (→Guide) |
|||
Line 52: | Line 52: | ||
=== You are now ready to run the actual tests on the two axis. === | === You are now ready to run the actual tests on the two axis. === | ||
# " | |||
<h2 style="margin:10px; background:#dd0; font-size:100%; font-weight:normal; border:0px solid #fff; text-align:left; color:#000; padding:0.2em 0.4em;"><b>NOTE:</b></br>If you are here to do the test/calibration again after say a relocation of your printer REMEMBER TO DISABLE EXSISTING Input Shaper calibration configuration in printer.cfg BEFORE yor run the test... ;-)</h2> | |||
# Issue the "G28 X0 Y0 Z0" command in your klipper terminal window - I use OctoPrint for this. | # Issue the "G28 X0 Y0 Z0" command in your klipper terminal window - I use OctoPrint for this. | ||
# Run the test on X axis: | # Run the test on X axis: | ||
Line 113: | Line 115: | ||
pi@octopi:~ $ | pi@octopi:~ $ | ||
</pre> | </pre> | ||
=== Credits === | === Credits === | ||
I wrote this guide using [https://www.youtube.com/channel/UCmV40QWkVeRs_nAvEOE_P-g NERO 3Ds] [https://youtu.be/OoWQUcFimX8 Youtube video] as inspiration, so I had the commands needed handy to cut'n paste into my Raspberry Pi when ever I want to rerun the calibration. | I wrote this guide using [https://www.youtube.com/channel/UCmV40QWkVeRs_nAvEOE_P-g NERO 3Ds] [https://youtu.be/OoWQUcFimX8 Youtube video] as inspiration, so I had the commands needed handy to cut'n paste into my Raspberry Pi when ever I want to rerun the calibration. | ||
[[Category:Klipper]][[Category:3D Print]][[Category:Creality]][[Category:Ender 5 Plus]][[Category:RaspBerry Pi]][[Category:OctoPrint]] | [[Category:Klipper]][[Category:3D Print]][[Category:Creality]][[Category:Ender 5 Plus]][[Category:RaspBerry Pi]][[Category:OctoPrint]] |
Revision as of 15:08, 13 August 2023
Guide
- Aquire an ADXL345
- Solder 6 wires on to the ADXL345.
- Mount the ADXL to you Extruder. If you got a moving printbed as X you need to move the ADXL345 halfway into the calibration guide. Watch NEROs Youtube video!
- Connect the 6 wires to your Raspberry Pi - Do it correct please or you COULD risk frying either your ADXL345, Your Raspberry Pi... or both ;-)
- Install the software - if you havent done so already.
- Update your Raspberry Pi:
sudo apt update -y
sudo apt upgrade -y
- Install "numpy" - Note: this will take quite some time - NERO says 20 minutes. It was faster on my Raspberry Pi 4 but still...
~/klippy-env/bin/pip install -v numpy
- Install additional dependencies
sudo apt install python-numpy python-matplotlib
- Configure your Raspberry Pi as a secondary MCU - Note: I got this working together with screen on my Creality Ender 5 Plus :-)
sudo cp ~/klipper/scripts/klipper-mcu-start.sh /etc/init.d/klipper_mcu
sudo update-rc.d klipper_mcu defaults
- Rebuild the microcontroller code:
cd ~/klipper/
make menuconfig
- Select "Micro-controller Architecture (Linux process)"
- Select "(X) Linux process" - make sure the X is set.
- Press Q
- Respond Yes to save changes.
- Stop the klipper service:
sudo service klipper stop
- Build and flash the new code to the microcontroller.
make flash
- Start the klipper service again.
sudo service klipper start
- Make sure the Linux SPI driver is enabled:
sudo raspi-config
- Select "3 Interface Options"
- Select "P4 SPI"
- Respond Yes to the question "Would you like the SPI interface to be enabled?"
- Respond Ok to the information that "The SPI interface is enabled"
- Press TAB twice to mark the "Finish" button.
- Press Enter.
- Open your klipper configuration file in your favorite linux text-editor. I use nano.
nano ~/printer.cfg
- copy the Additional lines below.
- paste the Additional lines into your klipper configuration file above the [mcu] section.
- In the [printer] section set max_accel: to 10000
- In the [printer] section set max_accel_to_decel: to 10000
- Save the changes in the klipper configuration file.
- Exit the texteditor.
- Issue the "restart" command in your klipper terminal window - I use OctoPrint for this.
- Software is now fully installed and configured.
- Test if the ADXL345 is recognised and talking with Klipper.
- Issue the "ACCELEROMETER_QUERY" command in your klipper terminal window - I use OctoPrint for this.
- You should get a resonse that looks like this:
Recv: // adxl345 values (x, y, z): 611.934960, 305.967480, 11473.780500
You are now ready to run the actual tests on the two axis.
NOTE:
If you are here to do the test/calibration again after say a relocation of your printer REMEMBER TO DISABLE EXSISTING Input Shaper calibration configuration in printer.cfg BEFORE yor run the test... ;-)
- Issue the "G28 X0 Y0 Z0" command in your klipper terminal window - I use OctoPrint for this.
- Run the test on X axis:
- Issue the "TEST_RESONANCES AXIS=X" command in your klipper terminal window - I use OctoPrint for this.
- Run the test on Y axis:
- Issue the "TEST_RESONANCES AXIS=Y" command in your klipper terminal window - I use OctoPrint for this.
- Now you can convert the X and Y .CSV files to actual readable charts:
~/klipper/scripts/calibrate_shaper.py /tmp/resonances_x_*.csv -o /tmp/shaper_calibrate_x.png
~/klipper/scripts/calibrate_shaper.py /tmp/resonances_y_*.csv -o /tmp/shaper_calibrate_x.png
- You can copy the two files to your computer using some kind of file-transfer software - WinSCP is great.
- I guess that the calibrate_shaper.py script have been updated since NERO made the great video. Because the recomendations have changed a lot. And I find that really great. I don't yous the png images anymore - I just go with the recomendation that the script result lists. See the example output below.
- Open your klipper configuration file in your favorite linux text-editor. I use nano.
nano ~/printer.cfg
- I want to use the MZV recomendation from the exampel below and write them into a new section called [input_shaper]
- Remember to change the max_accel and max_accel_to_decel as per the MZV recomendation too.
- Issue the "restart" command in your klipper terminal window - I use OctoPrint for this.
Your printer is now running Klipper including Input Shaper calibration - enjoy!
Additional lines
[mcu rpi] serial: /tmp/klipper_host_mcu [adxl345] cs_pin: rpi:None [resonance_tester] accel_chip: adxl345 probe_points: 150,150,20 # This is where the extruder will be positioned during the resonance test.
Example output
pi@octopi:~ $ ./klipper/scripts/calibrate_shaper.py /tmp/resonances_x_20211127_095450.csv -o /tmp/shaper_calibrate_x.png Fitted shaper 'zv' frequency = 41.4 Hz (vibrations = 2.7%, smoothing ~= 0.094) To avoid too much smoothing with 'zv', suggested max_accel <= 6700 mm/sec^2 Fitted shaper 'mzv' frequency = 40.4 Hz (vibrations = 0.0%, smoothing ~= 0.125) To avoid too much smoothing with 'mzv', suggested max_accel <= 4800 mm/sec^2 Fitted shaper 'ei' frequency = 48.2 Hz (vibrations = 0.0%, smoothing ~= 0.139) To avoid too much smoothing with 'ei', suggested max_accel <= 4300 mm/sec^2 Fitted shaper '2hump_ei' frequency = 60.0 Hz (vibrations = 0.0%, smoothing ~= 0.150) To avoid too much smoothing with '2hump_ei', suggested max_accel <= 4000 mm/sec^2 Fitted shaper '3hump_ei' frequency = 72.2 Hz (vibrations = 0.0%, smoothing ~= 0.157) To avoid too much smoothing with '3hump_ei', suggested max_accel <= 3800 mm/sec^2 Recommended shaper is mzv @ 40.4 Hz pi@octopi:~ $ ~/klipper/scripts/calibrate_shaper.py /tmp/resonances_y_*.csv -o /tmp/shaper_calibrate_x.png Fitted shaper 'zv' frequency = 31.6 Hz (vibrations = 6.6%, smoothing ~= 0.154) To avoid too much smoothing with 'zv', suggested max_accel <= 3700 mm/sec^2 Fitted shaper 'mzv' frequency = 32.4 Hz (vibrations = 0.0%, smoothing ~= 0.194) To avoid too much smoothing with 'mzv', suggested max_accel <= 3100 mm/sec^2 Fitted shaper 'ei' frequency = 38.6 Hz (vibrations = 0.0%, smoothing ~= 0.216) To avoid too much smoothing with 'ei', suggested max_accel <= 2800 mm/sec^2 Fitted shaper '2hump_ei' frequency = 48.2 Hz (vibrations = 0.0%, smoothing ~= 0.232) To avoid too much smoothing with '2hump_ei', suggested max_accel <= 2500 mm/sec^2 Fitted shaper '3hump_ei' frequency = 58.0 Hz (vibrations = 0.0%, smoothing ~= 0.244) To avoid too much smoothing with '3hump_ei', suggested max_accel <= 2400 mm/sec^2 Recommended shaper is mzv @ 32.4 Hz pi@octopi:~ $
Credits
I wrote this guide using NERO 3Ds Youtube video as inspiration, so I had the commands needed handy to cut'n paste into my Raspberry Pi when ever I want to rerun the calibration.