Quantcast
Channel: EngineerZone: Message List
Viewing all articles
Browse latest Browse all 36216

ADXL345 Data read rate

$
0
0

Hello, I'm having some issues with the data read rate on my ADXL345.

 

I'm using I2C to connect the ADXL345 to a Raspberry Pi using the Python library here: http://think-bowl.com/raspberry-pi/i2c-python-library-3-axis-digital-accelerometer-adxl345-with-the-raspberry-pi/

 

I'm finding the device isn't updating the readings as regular as it should, I'm not sure if this is the code limiting this or the accelerometer.

 

I'm detecting freefall then measuring the g-forces in each 3-axis for 3 seconds after freefall has been detected to calculate the maximum g-force.

Here's the code I'm using;

while True:          [dataready, singletap, doubletap, activity, inactivity, freefall, watermark, overrun] = adxl345.getInterruptStatus()          xg = []          yg = []          zg = []          if freefall:                    start = time()                    while time() < start+3:                              (accel_x, accel_y, accel_z) = adxl345.getAxes()                              xg.append(accel_x)                              yg.append(accel_y)                              zg.append(accel_z)

 

I've attached a graph of the results where you can see the data isn't updating. The amount of data recorded in the three seconds  varies from 1150 to 1300 for each axis, this is equal to a measurement taken every 2.61ms. But the data only seems to change after every ~15 data recordings so it only updates every ~40ms. So it seems the data in the accelerometer isn't updating.

 

I have 0x08 written in the bandwidth register (0x2C).

 

Does anyone have any advice or know the reasoning behind this?

 

Thanks in advance,

Peter


Viewing all articles
Browse latest Browse all 36216

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>