Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Adafruit H3LIS331 pumping out bad data
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit H3LIS331 pumping out bad data

by overdrive1 on Mon Mar 15, 2021 1:28 pm

I got the H3LIS331 to run on a raspberry pi zero w. I am using the I2C ports on the sensor soldered into the pi. I am also using the circuit python library.

Below is an example of the data I am getting when I use the sensor, it seems wacky, what am I doing wrong?

I have I2C enabled and I believe the dependency's are all installed correctly

(-22.9843359375, -7.6614453125, 19.15361328125)
(-13.407529296875, -5.746083984375, 26.81505859375)
(-36.391865234375, -15.322890625, 42.137949218749995)
(-28.730419921874997, -17.238251953125, 13.407529296875)
(-26.81505859375, -7.6614453125, 19.15361328125)
(-36.391865234375, -17.238251953125, 24.899697265625)
(-15.322890625, -9.576806640625, 26.81505859375)
(-24.899697265625, -17.238251953125, 30.64578125)


here is my code

Code: Select all | TOGGLE FULL SIZE
import time
import board
import busio
import adafruit_lis331


i2c = busio.I2C(board.SCL, board.SDA)
lis = adafruit_lis331.H3LIS331(i2c)

# use a nice fast data rate to for maximum resolution
lis.data_rate = adafruit_lis331.Rate.RATE_1000_HZ

# get the accleration as high as it goes
lis.range = adafruit_lis331.H3LIS331Range.RANGE_400G


#time of the end of the loop
t_end = time.time() + 3

f = open("gtestdata.txt","w+")

while time.time() < t_end:
    print(lis.acceleration)
    f.write("Acceleration : X: %.2f, Y:%.2f, Z:%.2f ms^2 \n" % lis.acceleration)


f.close()

overdrive1
 
Posts: 2
Joined: Mon Mar 15, 2021 1:11 pm

Re: Adafruit H3LIS331 pumping out bad data

by adafruit_support_carter on Mon Mar 15, 2021 6:05 pm

Just to be sure, you have one of these?
https://www.adafruit.com/product/4627
and not one of these?
https://www.adafruit.com/product/4626

They are different but share the same library.

adafruit_support_carter
 
Posts: 20126
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit H3LIS331 pumping out bad data

by overdrive1 on Mon Mar 15, 2021 6:28 pm

I 100 % have the H3LIS331 not the LIS331

overdrive1
 
Posts: 2
Joined: Mon Mar 15, 2021 1:11 pm

Re: Adafruit H3LIS331 pumping out bad data

by adafruit_support_carter on Mon Mar 15, 2021 7:25 pm

OK, hooked one up and recreated this behavior. Opened a new issue here:
https://github.com/adafruit/Adafruit_Ci ... 1/issues/2

adafruit_support_carter
 
Posts: 20126
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.