Skip to content

HelgeKeck/klipper_linear_movement_analysis

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klipper Linear Movement Vibrations Analysis

This is a klipper extension allowing to measure vibrations on linear movements on different axis. Unlike with previous solutions, the acceleration phases in the moves are not part of the analysed data.

Usage

This extension adds two new GCODE commands:

MEASURE_LINEAR_VIBRATIONS

In most usecases it is sufficient to only use MEASURE_LINEAR_VIBRATIONS [VELOCITY=<velocity>] [AXIS=<x|y|a|b>]

This will measure the vibrations frequency spectrum and create a file in the directory defined in the config as follows:

linear_movement_responce_500mmps_2022-11-06T17_09_49 535678

Full set of options:

MEASURE_LINEAR_VIBRATIONS [VELOCITY=<velocity>] [AXIS=<x|y|a|b>] [FMAX=<maximum frequency considered default 120>] [FMIN=<minimum frequency considered default 2xVELOCITY>] [D_IDLER=<diameter of idler>] [XMIN=<VALUE>] [XMAX=<VALUE>] [YMIN=<VALUE>] [YMAX=<VALUE>] [STARTX=<VALUE>] [STARTY=<VALUE>] [ENDX=<VALUE>] [ENDY=<VALUE>]

The settings XMIN, XMAX, YMINN, YMAX overwrite the measurement rectangle defined in the config.

The settings STARTX, STARTY, ENDX, ENDYallow to define a movement between any two points. Be aware that this causes the movement to possibly happen on a path different to the defined axis. In this case the axis is only used to find the adxl corresponding to the axis in case of multiple accelerometers. Also make sure that the defined points have a distance big enough to reach target velocity.

D_IDLER defines the diameter of an idler in mm. If set, the peak frequency graph will show a frequency corresponding to a full rotation of set idler. This is a way to identify decentered idlers. Please be aware, that those frequencies are usually pretty low. To get useful results measure at the fastest speed possible and set FMIN to a low value as well as you need to choose the longest travel distance possible.

FMIN, FMAX define the frequency range considered. All data outside this range are ignored. Be aware, due to the nature of an fft it does not make sense to use extremely low frequencies that correspond to less than half the measuring time.

MEASURE_LINEAR_VIBRATIONS_RANGE

A minimal, and in most cases sufficient approach is to use MEASURE_LINEAR_VIBRATIONS_RANGE [AXIS=<x|y|a|b>] [VMIN=<minimal velocity>] [VMAX=<maximal velocity>] [STEP=<steps size of veloctity changes>]

This goes through a range of velocities, plots the frequency responses and calculates the power of the vibrations as well as the frequencies of the main peak for each tested velocity, creating plots as following:

frequency_responses_v-range2022-11-06T17_08_02 433594 peak_frequencies_logscale2022-11-06T17_07_59 372651 peak_frequencies2022-11-06T17_07_59 372548 relative_power2022-11-06T17_07_58 922808

Full set of options:

MEASURE_LINEAR_VIBRATIONS_RANGE [AXIS=<x|y|a|b>] [VMIN=<minimal velocity>] [VMAX=<maximal velocity>] [STEP=<steps size of veloctity changes>] [D_IDLER=<diameter of pulley or idler>] [FMIN=<minimum frequency considered default 5>] [FMAX=<maximum frequency considered default two times VMAX>] [XMIN=<VALUE>] [XMAX=<VALUE>] [YMIN=<VALUE>] [YMAX=<VALUE>] [STARTX=<VALUE>] [STARTY=<VALUE>] [ENDX=<VALUE>] [ENDY=<VALUE>]

Please read above about the different options, as most of them are identical to MEASURE_LINEAR_VIBRATIONS.

Installation

Log into your raspberry pi via ssh. Clone the git repo via

git clone https://github.com/worksasintended/klipper_linear_movement_analysis.git

Copy, paste and excecute the following command:

bash klipper_linear_movement_analysis/install.sh

This will install the extension. The installation of matplotlib requires some time and creates significant load on the rpi, I suggest NOT to do this, while the rpi is used for printing.

To update the package via Moonraker or a web frontend, add this to your moonraker.conf:

[update_manager LinearMovevementAnalysis]
type: git_repo
path: ~/klipper_linear_movement_analysis
primary_branch: main
origin: https://github.com/worksasintended/klipper_linear_movement_analysis.git
install_script: install.sh
env: ~/klippy-env/bin/python
requirements: requirements.txt
managed_services: klipper

The moonraker config can either be accesed via ssh or via one of the common klipper webfronts, like Fluidd or Mainsail.

Add the section [linear_movement_vibrations] to your printer.cfg to activate the plugin Example configuration:

[linear_movement_vibrations]
accel_chip: adxl345
x_min: 5
x_max: 175
y_min: 5
y_max: 175
output_directory: /home/pi/printer_data/config/linear_vibrations/

Make sure the defined output directory is writable. The one in the example configuration shown above will create a folder linear_vibrations that can be accessed via the file browser in the web frontend, assuming you are using RatOS. Similar to the input_shaper folder, you can find it in the machine tab in the config root. If you are not using RatOS and are unsure which directroy to use /tmp/ is a save bet. Be aware, that the pngs will not be automatically removed. x_min, x_max,y_min, y_maxdefine a triangle in which the measuremnts will be performend. z If you are using multiple accelerometers, you can also define them as such (untested feature)

accel_chip_x: adxl345 rpi
accel_chip_y: adxl345

After these steps, reboot your raspberry, as otherwhise the newly installed pythin libraries are not loaded into the env.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.4%
  • Shell 3.6%