Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

LIS3DH sampling at 5KHz
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

LIS3DH sampling at 5KHz

by merlymk on Mon May 03, 2021 6:22 am

Hi all

I am working on Arduino project wherein i use the Arduino UNO board and an Adafruit sensor LIS3DH.
I am using the sample code from the Adafruit library.
The code works fine for setDataRate of 400Hz (I have outcommented the default data rate in the library) but not for the 5KHz.
I am quite new to using Arduino and accelerometers therefore would like some help in understanding how to sample at 5KHz between the accelerometer and the Ardunio.
I am currently doing a table top testing for proof of concept before i start actual field work.
Attachments
Screenshot_2.jpg
Screenshot_2.jpg (17.97 KiB) Viewed 175 times
UnderstandArduino.ino
(1.13 KiB) Downloaded 1 time

merlymk
 
Posts: 5
Joined: Thu Feb 04, 2021 1:02 am

Re: LIS3DH sampling at 5KHz

by adafruit_support_bill on Mon May 03, 2021 7:30 am

The internal sample rate is asynchronous to the i2c interface. The registers will be updated at the configured sample rate and timely interrupts will be generated based on that data.

The maximum i2c poll rate is determined by the speed of the master device and what code it is running.

adafruit_support_bill
 
Posts: 81312
Joined: Sat Feb 07, 2009 10:11 am

Re: LIS3DH sampling at 5KHz

by merlymk on Thu May 06, 2021 8:29 am

Hi

I am sorry i did not understand the reply completely.
The UNO board can communicate to the LIS3DH over I2C protocol at 250000Hz setting.

merlymk
 
Posts: 5
Joined: Thu Feb 04, 2021 1:02 am

Re: LIS3DH sampling at 5KHz

by adafruit_support_bill on Thu May 06, 2021 8:57 am

i2c bus speed is completely unrelated to the internal sample rate of the sensor. Reading the xyz data from the device consumes at least 100 bus cycles, so in theory, with a 250KHz clock rate on the bus your maximum possible poll rate would be no more than 2.5KHz. Of course that does not take into account the software overhead in the driver required to convert and scale the data - or the software overhead in your code to make the calls and print the results.

adafruit_support_bill
 
Posts: 81312
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.