AnsweredAssumed Answered

Understanding acceleration data from IIS2DH

Question asked by Hackney.Michael on Jan 2, 2017
Latest reply on Nov 28, 2017 by Ranjith Ravindra Shanbhag

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, normal resolution mode, ZHIE enabled, ZLOW disabled, THS set 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 probes in 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!