cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding acceleration data from IIS2DH

mhackney
Associate II
Posted on January 02, 2017 at 16:15

I've been trying to understand how to interpret and format the data I'm getting from the accelerometer. First, my setup:

Low power, 5.376KHz ODR, 16G full scale, normalresolution mode, ZHIE enabled, ZLOW disabled, THSset to 30

(First I need to understand how to interpret and format the data with the above configuration, then I can work on tuning things for my application).

I am using an Arduino to interface to the IIS2DH and getting AOI interrupts on INT1. All of this is working in my Arduino and code.

This is a Z probe for a 3D printer, so when the probe (accelerometer) strikes a solid surface, it generates an interrupt for the Z axis event (X and Y are not enabled). This all works. I get the interrupt and then fetch the OUT_Z_L and OUT_Z_H registers as 8 bit integers. It is from here that I need help understanding what I am getting and how to interpret it.

When I run my tests, I can print the output to the console to see what's going on. When I do this, for a typical probe 'hit', I see, in binary:

Z_H = b00001000

Z_L = b00001010

I do see small differences from probe point to probe point - there are 13 probesin a typical run so I see 13 pairs of values. Here's a full set in Z_H / Z_L order:

  1. 00001000 /00001001
  2. 00001001 /00001010
  3. 00001001 /00001001
  4. 00001001 /00001010
  5. 00001000 /00001010
  6. 00000111 /00000111
  7. 00000110 /00001000
  8. 00000110 /00001001
  9. 00001000 /00001001
  10. 00000111 /00001000
  11. 00000101 /00000111
  12. 00001001 /00001001
  13. 00001011 / 00001001

Does this make sense? It doesn't to me. I never see data in the high 4 bits of the low or high byte. I thought the data was left aligned and with my normal resolution (10 bits, correct?) I would expect to see nothing in the lower 6 bits of the low byte. Am I retrieving sensible data and if so, how do I reconstruct it into a value?

Thanks in advance!

#iis2dh

Note: this post was migrated and contained many threaded conversations, some content may be missing.
15 REPLIES 15
Posted on January 03, 2017 at 15:56

Miroslav, I am making progress! Thank you for your help. I think I have a much better understanding of the accelerometer now but have some more learning to do. I implemented the Stream-to-FIFO mode and print the 32 bytes of data after each INT1. The results are logical and they should allow me to start to tune the system. Here are the data for a single probe contact:

#1 - Time: 68s - Since Last: 68s

acceleration data (FIFO):

0: 0.74g

1: 0.74g

2: 0.70g

3: 0.80g

4: 0.86g

5: 0.99g

6: 1.15g

7: 1.18g

8: 1.31g

9: 1.34g

10: 4.06g

11: 1.86g

12: 0.38g

13: 1.92g

14: 1.60g

15: 0.13g

16: 1.02g

17: 1.44g

18: 1.12g

19: 1.18g

20: 1.66g

21: 1.28g

22: 1.09g

23: 1.22g

24: 1.28g

25: 1.34g

26: 0.99g

27: 0.64g

28: 0.77g

29: 1.02g

30: 0.86g

31: 0.86g

Note point # I see exactly this same pattern in all 13 probe contacts. The value is 4.06g for 9 of the probe contacts but there are a few points as low as 3.26g. This may be due to the hard plastic surface or other factors related to the mechanical aspects of the printer. This data was collected with FS=4g and low power 8-bit data mode with threshold value set to 95 (3.04g). No high pass filter.

I next need to understand high pass filter and how to use it.

I also need to experiment to see if I can makethe contact impact lower by adjusting the probe speed, etc.

What do you think about this data? Does it give you any ideas on how best to tune the system now?

Posted on November 22, 2017 at 18:19

Hello,

I am new to this accelerometer sensor. I have configured the Interrupt 2 to work for my application and it finally is working great. But, I just don't understand how did you guys decide on the FS and THS value for your application? I had to do trial and error method and it was a tedious work. My goal for this question is to understand this concept so that I do not have to do this trial and error method all over again for different applications as well.

Please help me. 

Posted on November 22, 2017 at 21:32

I depends what is your objective.

- You can do some teoretical analysis. For example for tilt detection, you know the gravity is 1g and the you can use trigonometric functions to calculate the value for certain angle.

- You can record acceleration data during some movement which you want to detect or analyze and then you process them offline in you computer, check the maximu and minuimum values and levels which the value raech during stimulation. This give you the information what FS and threshold you should use.

- Trial and error is sometimes also used approach

Posted on November 27, 2017 at 19:15

Hello,

Thank you for the advice and teaching me the method to arrive at better configuration of the accelerometer for different application. However, I have an another doubt regarding the THS register. According to the datasheet when I have configured my accelerometer at FS8, '1 LSb is 62 mg'. So, what does that exactly mean ?

For example, when I have THS register set at 0x10 with INT1_CFG = 0x02(XHIE). So when exactly does the interrupt get enabled and what is the value of Threshold for that value of THS register ? I am sorry if I am being vague? I am not sure what will be the threshold value ?

Also, you said for tilt it has to be 1g. Can I make the interrupt enabled 'only' when its tilted and not vibration ? If so, how would you configure the interrupt and accelerometer in whole? (Consider the tilting is at a normal place)

Posted on November 28, 2017 at 15:55

In your particular case if INT1_THS = 0x10 and INT1_CFG = 0x02(XHIE) with Full Scale 8g, it means the interrupt will be triggered if the absolute value of acceleration in X axis is higher then 16 * 62 mg = 992mg.

To avoid interrupt triggering by noise or random peaks you can set the INT1_DURATION. It the acceleration is above/bellow threshold for more then the time period defined by the DURATION register then interrupt will be triggered.

Posted on November 28, 2017 at 20:06

Thank you sir. Now, I understand how to configure the Accelerometer interrupt for different applications. 

Regards

Ranjith