The PIC program is written in assembler. It is pretty straightforward and can be explained in three flow charts.
The accelerometer is configured via the SPI interface to set an interrupt pin, INT1, when a free-fall event is detected. This sequence is right out of the application note for the LIS3DH, with a few parameters modified for this purpose. The peripheral clock is disabled to save power since it is only needed for the SPI interface.
The interrupts are enabled and the PIC goes to sleep, consuming only a fraction of 1µA. There are two ways to wake it from sleep: a WDT overflow every 264 seconds, or a interrupt on INT.
I will post the entire MPLABX project to the files section when it is solidified.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.