Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Accelerometer Usage

    Scheduled Pinned Locked Moved
    Beta Firmware
    25
    191
    19.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mendenmhundefined
      mendenmh
      last edited by mendenmh

      One could apply a statistical hack if one really knows the problem is every 20 samples, and either the first or last sample in a batch. One can just replace the (known) bad point with the average of the point before and after. This doesn't change the power spectrum significantly. This is equivalent to adding a random Dirac comb of small amplitude (the difference between the correct, missing point and the average) to the data, which has only a very weak effect on the spectrum. The noise floor at frequencies which are harmonics of (sampling rate / 40) will be slightly raised.

      CCS86undefined 1 Reply Last reply Reply Quote 2
      • tecnoundefined
        tecno @dc42
        last edited by

        @dc42
        How critical is the way the board is mounted?

        9bef51ba-f0e2-48e7-b888-c960a53d2c5a-image.png

        Above picture is a mockup with another accelerometer.

        As I am only going to use only X axis in this case does it really matter how it is mounted?

        1 Reply Last reply Reply Quote 0
        • CCS86undefined
          CCS86 @mendenmh
          last edited by

          @mendenmh said in Accelerometer Usage:

          One could apply a statistical hack if one really knows the problem is every 20 samples, and either the first or last sample in a batch. One can just replace the (known) bad point with the average of the point before and after. This doesn't change the power spectrum significantly. This is equivalent to adding a random Dirac comb of small amplitude (the difference between the correct, missing point and the average) to the data, which has only a very weak effect on the spectrum. The noise floor at frequencies which are harmonics of (sampling rate / 40) will be slightly raised.

          As a straightforward fix I think that is a great idea.

          1 Reply Last reply Reply Quote 0
          • CCS86undefined
            CCS86
            last edited by CCS86

            I did some more testing and found something interesting. This makes me think that the erroneous spikes don't have anything to do with wiring.

            Running back to back tests, with the only change being the inclusion / omission of the "X" parameter in the M956 call (just X axis, or XYZ):

            Just X:
            107d3623-53ae-49d2-9b13-bde053b4ef2a-image.png

            XYZ:
            09f70d2c-2a0f-4b8a-b2f5-fd7734dfc8fb-image.png

            Just X still has some spike on the 20 sample intervals, but they appear much worse when logging all 3 axes (~double).

            And here are the analyzed results. Not vastly different, but different enough to warrant elimination of that bad data:

            a292211c-a637-4c61-b6e5-3e87394e8af7-image.png
            5d89c08d-da4a-4f7f-8ee1-0e4904deef63-image.png

            1 Reply Last reply Reply Quote 0
            • CCS86undefined
              CCS86
              last edited by

              Somewhat off topic, but this is wild. Here is the analysis of X at 5k / 10k / 15k accel. I did not expect such a big difference when increasing accel to 15k. Makes me suspicious:

              5k:
              53a62047-179d-4ae7-b8ae-e2cb287c2928-image.png

              10k:
              4f651040-250b-4d50-835c-ca38b144439d-image.png

              15k:
              013a1699-1a98-43f0-9e8f-a070d51486ea-image.png

              dc42undefined 1 Reply Last reply Reply Quote 0
              • CCS86undefined
                CCS86
                last edited by

                At this point, I am getting almost no overflows reported, without actually changing anything. Odd.

                Is it possible to log at faster than 1344 Hz? The sensor seems to be capable of 5000 Hz, but the "S" parameter doesn't seem to work in the M955 command. I have only ever gotten 1344 Hz and 400 Hz replies in the console.

                Also, DWC seems to infer a sampling rate of 1331 Hz, while RRF says 1344 Hz. Only a 1% difference, but I'm guessing it shifts the analysis result slightly. Not sure whether DWC is accurately sensing a 1331 Hz logging rate, on a desired 1344 Hz. Or, if it should be changed to match.

                dc42undefined 1 Reply Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators @CCS86
                  last edited by dc42

                  @ccs86 said in Accelerometer Usage:

                  Somewhat off topic, but this is wild. Here is the analysis of X at 5k / 10k / 15k accel. I did not expect such a big difference when increasing accel to 15k. Makes me suspicious:

                  If the time taken to accelerate or decelerate is about half the period of ringing, that will tend to suppress the ringing. That is how DAA worked. I suggest you calculate the acceleration/deceleration time, i.e. the feed rate of your test move in mm/sec divided by the acceleration.

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  CCS86undefined 1 Reply Last reply Reply Quote 0
                  • dc42undefined
                    dc42 administrators @CCS86
                    last edited by

                    @ccs86 said in Accelerometer Usage:

                    Is it possible to log at faster than 1344 Hz? The sensor seems to be capable of 5000 Hz, but the "S" parameter doesn't seem to work in the M955 command. I have only ever gotten 1344 Hz and 400 Hz replies in the console.

                    In theory the code support 5kHz, but it's unlikely to work when using a direct SPI connection. The LIS3DSH supports 1600Hz instead of 1344Hz.

                    Also, DWC seems to infer a sampling rate of 1331 Hz, while RRF says 1344 Hz. Only a 1% difference, but I'm guessing it shifts the analysis result slightly. Not sure whether DWC is accurately sensing a 1331 Hz logging rate, on a desired 1344 Hz. Or, if it should be changed to match.

                    The sensor data rate is only approximate (the manufacturer told me +/-20% AFAIR), so RRF measures it and includes the actual data rate in the .csv file.

                    Duet WiFi hardware designer and firmware engineer
                    Please do not ask me for Duet support via PM or email, use the forum
                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                    CCS86undefined 1 Reply Last reply Reply Quote 0
                    • CCS86undefined
                      CCS86 @dc42
                      last edited by

                      @dc42 said in Accelerometer Usage:

                      @ccs86 said in Accelerometer Usage:

                      Somewhat off topic, but this is wild. Here is the analysis of X at 5k / 10k / 15k accel. I did not expect such a big difference when increasing accel to 15k. Makes me suspicious:

                      If the time taken to accelerate or decelerate is about half the period of ringing, that will tend to suppress the ringing. That is how DAA worked. I suggest you calculate the acceleration/deceleration time, i.e. the feed rate of your test move in mm/sec divided by the acceleration.

                      Is that calculation only valid with jerk set to zero, or do you think it holds?

                      1 Reply Last reply Reply Quote 0
                      • CCS86undefined
                        CCS86 @dc42
                        last edited by CCS86

                        @dc42 said in Accelerometer Usage:

                        @ccs86 said in Accelerometer Usage:

                        Is it possible to log at faster than 1344 Hz? The sensor seems to be capable of 5000 Hz, but the "S" parameter doesn't seem to work in the M955 command. I have only ever gotten 1344 Hz and 400 Hz replies in the console.

                        In theory the code support 5kHz, but it's unlikely to work when using a direct SPI connection. The LIS3DSH supports 1600Hz instead of 1344Hz.

                        Also, DWC seems to infer a sampling rate of 1331 Hz, while RRF says 1344 Hz. Only a 1% difference, but I'm guessing it shifts the analysis result slightly. Not sure whether DWC is accurately sensing a 1331 Hz logging rate, on a desired 1344 Hz. Or, if it should be changed to match.

                        The sensor data rate is only approximate (the manufacturer told me +/-20% AFAIR), so RRF measures it and includes the actual data rate in the .csv file.

                        @dc42

                        Is there a reason that we can't set a specific sampling rate with the "S" parameter, as documented?

                        and do you have any thoughts on the erroneous spike data I posted above?

                        dc42undefined 1 Reply Last reply Reply Quote 0
                        • A Former User?
                          A Former User
                          last edited by

                          I discovered in my setup that attaching the accelerometer directly to the coils of a driven stepper motor produces less than useful results.

                          noise.png

                          A Former User? 1 Reply Last reply Reply Quote 1
                          • dc42undefined
                            dc42 administrators @CCS86
                            last edited by

                            @ccs86 said in Accelerometer Usage:

                            Is there a reason that we can't set a specific sampling rate with the "S" parameter, as documented?

                            The accelerometer chip only supports a few specific sampling rates. You can specify the S parameter and the firmware will pick the nearest available one. Send M955 P# where #is the accelerometer ID to find which one has been selected.

                            Duet WiFi hardware designer and firmware engineer
                            Please do not ask me for Duet support via PM or email, use the forum
                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                            CCS86undefined 1 Reply Last reply Reply Quote 0
                            • A Former User?
                              A Former User @A Former User
                              last edited by A Former User

                              @94v0 said in Accelerometer Usage:

                              I discovered in my setup that attaching the accelerometer directly to the coils of a driven stepper motor produces less than useful results.

                              That wasn't the problem, the combination of Mini5+ and LIS3DSH does seem to be pretty sensitive to the quality of the wiring. I thought I'd get away with some shielded DB9 cable, but there's obviously a lot being coupled along the length.

                              I think the CAT6a I have has individual shielding on the pairs, I'm going to try that and see how it goes. Unfortunately my tool board is a 1.0 so I didn't get this sensor connected to the CAN bus like everything else.

                              nasty.png

                              I guess the most optimal solution is to make an absolutely minimal version of the SAMMYC21 development board with the LIS3DSH and CAN transceiver on board, drop the pin headers and the USB UART side of things.

                              dc42undefined 1 Reply Last reply Reply Quote 0
                              • A Former User?
                                A Former User
                                last edited by A Former User

                                Digikey and Mouser have quite literally no stock of that chip, and only a couple of thousand expected before 2022 across all the variants. Other than scalpers selling them in 2 quantity for $20 each, that's not really an option sadly.

                                mouser.png

                                1 Reply Last reply Reply Quote 0
                                • dc42undefined
                                  dc42 administrators @A Former User
                                  last edited by

                                  @94v0 I updated the accelerometer wiki page recently with details of the cables I used, which are 1m long and work with the Duet 3 Mini. I think the secret is to keep the CS wire away from the other signal wires.

                                  Duet WiFi hardware designer and firmware engineer
                                  Please do not ask me for Duet support via PM or email, use the forum
                                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                                  1 Reply Last reply Reply Quote 0
                                  • CCS86undefined
                                    CCS86 @dc42
                                    last edited by

                                    @dc42 said in Accelerometer Usage:

                                    @ccs86 said in Accelerometer Usage:

                                    Is there a reason that we can't set a specific sampling rate with the "S" parameter, as documented?

                                    The accelerometer chip only supports a few specific sampling rates. You can specify the S parameter and the firmware will pick the nearest available one. Send M955 P# where #is the accelerometer ID to find which one has been selected.

                                    It looks like the sensor does jump from:

                                    HR / normal (1.344 kHz);

                                    to

                                    Low-power mode (5.376 kHz)

                                    Have you tried that highest rate? I can't get RRF to go above the 1344 Hz

                                    dc42undefined 1 Reply Last reply Reply Quote 0
                                    • dc42undefined
                                      dc42 administrators @CCS86
                                      last edited by

                                      @ccs86 I haven't tried the higher sampling rate. My guess is that you won't be able to use that rate except for very short sampling times, without getting overrun errors. The resolution at that speed is only 8-bit, which may not be sufficient. The LIS3DSH does 1600Hz @ 16 bit resolution.

                                      Duet WiFi hardware designer and firmware engineer
                                      Please do not ask me for Duet support via PM or email, use the forum
                                      http://www.escher3d.com, https://miscsolutions.wordpress.com

                                      CCS86undefined 1 Reply Last reply Reply Quote 0
                                      • CCS86undefined
                                        CCS86 @dc42
                                        last edited by

                                        @dc42 said in Accelerometer Usage:

                                        @ccs86 I haven't tried the higher sampling rate. My guess is that you won't be able to use that rate except for very short sampling times, without getting overrun errors. The resolution at that speed is only 8-bit, which may not be sufficient. The LIS3DSH does 1600Hz @ 16 bit resolution.

                                        Cool. I actually was able to get some logs at 8-bit 5376 Hz. I'm not sure the loss in resolution is worth the increased sampling rate, with these low magnitude vibrations.

                                        Are we any closer to testing input shaper on Maestro hardware?

                                        1 Reply Last reply Reply Quote 0
                                        • A Former User?
                                          A Former User
                                          last edited by

                                          I'm a bit curious if these "LIS3DSH" boards being sold on aliexpress, ebay, adafruit and others are actually using a LIS3DSH. The chip is no longer manufactured, there's only a small number of them in stock on digikey and practically nowhere else and for much greater cost than the breakout boards are.

                                          dc42undefined o_lampeundefined 2 Replies Last reply Reply Quote 0
                                          • dc42undefined
                                            dc42 administrators @A Former User
                                            last edited by

                                            @94v0 said in Accelerometer Usage:

                                            I'm a bit curious if these "LIS3DSH" boards being sold on aliexpress, ebay, adafruit and others are actually using a LIS3DSH. The chip is no longer manufactured, there's only a small number of them in stock on digikey and practically nowhere else and for much greater cost than the breakout boards are.

                                            The one I purchased definitely has a LIS3DSH on it.

                                            According to the ST web site, the chip is still being manufactured but only in response to volume orders. Worldway claims to have 10000 of them.

                                            Duet WiFi hardware designer and firmware engineer
                                            Please do not ask me for Duet support via PM or email, use the forum
                                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA