Gathering & Interpreting accelerometer data for input shaping
-
I'm a little unsure about how to interpret the accelerometer data I am gathering for use with input shaping.
I post this so that those more learned on the matter, might make comment that will help all of us trying to implement this.This is my method of of gathering.
I have a series of macros which allow me to test each axis dependent on the orientation of the accelerometer. These are available here
Please note, you will need to edit these to suit your printer type and dimensions!
The two main files are test_x.g and test_y.g
These accept parameters which issue the correct commands for various acceerometer mounting orientations.In my case, due to the wy I have the accelerometer mounted, when I am testing the X axis, I am actually moving the accelerometer in the Z direction, so I would run the file "Test_X_Z_Orientation.g"
;0:/macros/accelerometer/1.Test_X-Z-Orientation.g ; run test on X axis with Z accelerometer orientation M98 P"0:/macros/accelerometer/test_x.g" S"Z"
The macro to test X axis looks like this
; 0:/macros/accelerometer/test_x.g ; Run accelerometer test. S parameter passed in M98 call determines orientation while iterations < #move.axes echo "Check if " ^ move.axes[iterations].letter ^ " homed.." if !move.axes[iterations].homed echo move.axes[iterations].letter ^ " axis not homed... Homing all" G28 break M593 P"none" ; disable DAA echo "Moving to start position" G1 X50 Y90 Z20 F3600 echo "In position" M98 P"0:/macros/accelerometer/increase_max_speeds.g" G4 S2 if exists(param.S) echo "testing only " ^ param.S ^ " axis of accelerometer" G4 P500 if param.S="X" M956 P0 X S1200 A0 G4 P50 elif param.S="Y" M956 P0 Y S1200 A0 G4 P50 elif param.S="Z" M956 P0 Z S1200 A0 G4 P50 else M956 P0 S1200 A0 ; invalid S parameter so use default echo "invalid parameter ['" ^ param.S ^ "'] must be X,Y,Z. Testing all." G4 P50 else echo "Testing all axes" G4 P50 M956 P0 S1200 A0 ; No S parameter so use default G4 P10 G1 X150 F18000 ; adjust distance and travel speeds as required. echo "Test complete" M98 P"0:/sys/set_max_speeds.g" ; adjust this file to restore original acceleration values.
If all goes well, we should have a file we can examine with the accelerometer plugin.
But how to read it?
Here is the raw reading
Here is the data after analysis
And again after "wide band analysis"
So how to analyze ?
We see a couple of main levels of amplitude and a couple of levels of frequency for these amplitude levels.
-
@owend
I'm no expert of this subject, but to me it seems, you should calculate the required minimum length of the move to fully accelerate and decelerate. That would greatly improve the 'sample rate' which to me seems pretty low in your samples. (1385Hz)
I guess this could be done in the macro, based on your accel parameter and the target speed.
I'd also use print speed, not travel speed( or is F18000 your print speed?) In the end we want to fight ringing/ghosting, right?
Furthermore (now that you've seen it works) you should start sampling at the beginning of a move (A1)And finally, from the back of my mind, I remember that the sensors I used to use for multicopters were better for sampling XY axis. The Z-axis resolution wasn't the best. They were designed for Car-ABS and airbag sensors, but that's long ago and doesn't have to apply here.
Will be interesting to see, where this threads leads us to
watching -
@o_lampe said in Gathering & Interpreting accelerometer data for input shaping:
calculate the required minimum length of the move to fully accelerate and decelerate.
common formulas for constant acceleration
v = a * t => t = v/a s = 1/2 a * t² => s= 1/2a * (v/a)²
For a printspeed of 100mm/s and acceleration of 4000mm/s² I got 1.25mm for fullspeed .
Deceleration is the same, so 2.5mm would be minimum travel distance. -
@owend I have changed to sampling the data right after the end of a move. Something like this (X0 Y0 is bed centre on all my printers):
G1 X-100 F6000 G4 S2 G1 X0 M400 M956 P0 S1000 A0
The advantage is that you don't get motor or belt noise in the data.
-
@dc42
does that mean the sampling rate is fixed and the length of the move isn't important?
If so, is the sampling rate the same for Duet2 / Duet3mini / Duet 3 HC? -
@dc42
I changed the method per your suggestion and seem to get more readable samples.
Depending on the number of samples I specify, I get either a single peak at 21.9Hz or two peaks at about 21.9 & 55Hz -
@owend what does the raw data look like? Do you get the same peaks for both X moves and Y moves?
-
@o_lampe said in Gathering & Interpreting accelerometer data for input shaping:
@dc42
does that mean the sampling rate is fixed and the length of the move isn't important?
If so, is the sampling rate the same for Duet2 / Duet3mini / Duet 3 HC?The sampling rates are those available on the LIS3DH, so they are the same on all boards. The highest sampling rate available at standard resolution is 1344 samples/sec and that is the one I normally use (it's also the M955 default). If you select 8-bit resolution instead, then you can get 1620 or 5376 samples/sec; but I don't think it's useful to go that high, and at 5376 samples/sec writing the data fast enough to the SD card might be problematic.
-
@dc42 said in Gathering & Interpreting accelerometer data for input shaping:
@owend what does the raw data look like? Do you get the same peaks for both X moves and Y moves?
Here are images from another test.
The accelerometer is mounted on the X axis of a bed slinger and is in the "06" orientation.Interestingly, whatever I enter in M955, DWC reports it as being 20 orientation.
e.g.
The M955 setting for these tests was
M955 P0 I06 R10 S2000 Q2000000 C"spi.cs3+spi.cs4" ; configure accelerometer
Gcode issued was
G1 X50 F6000 G4 S2 G1 X135 M400 M956 P0 S1000 A0
Results Raw
Results filtered
-
@owend
Wouldn't it be even better to put 'M84' before the actual sampling starts?
In your sample I think I see the motor noise, which then builds the 22Hz peak -
@o_lampe said in Gathering & Interpreting accelerometer data for input shaping:
Wouldn't it be even better to put 'M84' before the actual sampling starts?
No. If you do that then the motor will become much more elastic, because only the detent torque will hold it in place, and this will reduce the frequency of any resonance due to the mass+belt+motor combination.
-
@owend I can see two resonances in your raw data: a fairly strong but damped one at about 60Hz, and a slightly weaker one with very little damping at about 22Hz. They could be resonances of different axes. What does a plot of a Y move look like?
-
This looks like so much fun. Are these graphs from DWC?
-
@dc42
I don't yet have a mount made for the bed, so no Y axis data
I'll work on it this week
I'd appreciate some reference marks on the images to define what you see as resonance and what's just noise.