I am using an Arduino Uno board to interconnect to an accelerometer (Adafruit LIS3DH) through I2C protocol. I am using the millis function in my project to plot the data w.r.t to time. I have however run into two issue
When i use 400Hz selection the data is fine but for 5KHz the data point for 1sec is about 500. It should have been nearly 5000.
The accelerometer range selected is 4g but there has been instances wherein the value has overshoot beyond 4g
If you are using millis(), that might explain that you aren't reading 5000 times a second.
Perhaps you should be using micros()? 5kSPS is one reading every 200µs
Also if you do read at 5kSPS, you have to get the data out across serial to plot it, which is
a tall order as even 115200 baud is probably too slow - consider a higher baud rate
(this may involve having to find a faster computer-side serial program than the Arduino
serial window, note)