Understanding acceleration data from IIS2DH
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:
- 00001000 /00001001
- 00001001 /00001010
- 00001001 /00001001
- 00001001 /00001010
- 00001000 /00001010
- 00000111 /00000111
- 00000110 /00001000
- 00000110 /00001001
- 00001000 /00001001
- 00000111 /00001000
- 00000101 /00000111
- 00001001 /00001001
- 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.