ADXL345 activity/inactivity interrupts

26 Oct 2017

Hello Everyone,

I am using an ADXL345 as an I2C slave to a PIC 16F874. I am happy they are communicating well. I am getting readings satisfactorily. I want to use activity interrupt to Int1 to B0 to wake the PIC from sleep and use inactivity to Int2 to B1 to invoke sleep. I have been unable to get these interrupts to work satisfactorily. I have used dummy inputs to the PIC to check the software will respond correctly which it does.

I am using an Adafruit 1231 module designed to interface to an Arduino. This has the chip and support components in particular ones that allow connection to a 5v system. ( including a 3.3v regulator) I purchased this from Rapid Electronics in UK www.rapidonline.com catalogue no 73-5332 . This has a ling to the ADXL345 data sheet.

Register settings I am using are below. They are written to in the order listed.

Interrrupt Map (0x2F) 0x08 Act int to Int1, Inact Int to Int2

Data Formatt (0x31) 0x09 Full res, Right Justify, 4g

Activity Threshold ( 0x24) 0x02 1/8g

Inactivity Threshold (0x25) 0x04 1/4g

Inactivity Time (0x26) 30 (decimal) seconds

Act Inact Control (0x27) 0x66 DC, omit Z axis

Interrupt enable (0x2E) 0x18 Enable Act & Inact interrupts

Power Control (0x2D) 0x38 Link, autosleep, measure =1 to start reading

Other registers are their defalt values . The program takes a reading every second.

Any help will be most gratefully received DavidS

27 Mar 2018

Hi David

Perhaps its too late, but maybe for others to come with the same questions:

I see three potential bugs

1. "Act Inact Control (0x27) 0x66 DC" - You probably need AC. Because as far as (In)Activity concerns, changes are more relevant than the absolute value.

2. The combination of: Inactivity Time 30 seconds + "The program takes a reading every second". seems to be wrong. For me, when the polling time was shorter than the Inactivity Period, it resulted in no raising of the Inactivity flag

3. "Interrrupt Map (0x2F) 0x08 Act int to Int1, Inact Int to Int2" Note that Data ready may saturate the INT1 channel, while Watermark and Overrun may saturate INT2