How to use the ADXL362 to eliminate a power switch and control system power by ADIApproved
Similar to the ADXL345 and adxl346, the ADXL362 has “activity” and “inactivity” functions which can be used to control system power and detect user activity. A simple circuit and C code for a pic was shown for the ADXL345 in: https://ez.analog.com/thread/2420
The ADXL362 improves on this circuit and example in several ways:
-
1) The ADXL362 uses about 2ua of current, less than 1/10 of the current used by the ADXL345.
-
2) The ADXL362 allows for a 12 bit value to be used for the activity and inactivity thresholds, coupled with the 2 Gee range on the xl362, this allows for a much more sensitive motion detecting switch.
-
3) The ADXL362 can cut down on false motion triggers that are seen by the ADXL345. It does this in two ways:
- The Activity, tilt or “above threshold” function works after the low pass filter which can be set as low as 6.25hz bandwidth.
- The Activity, tilt or “above threshold” function can be set for a number of samples above threshold not just a default of one sample above threshold as in the adxl345.
-
4) The ADXL362 introduces a new output which is the direct “awake” status bit which can be used to directly control the output load.
-
5) The ADXL362 introduces a new “loop” mode which does not require any processor interaction to clear interrupts.
The demo circuit as shown in the attached PDF is quite similar to the circuit shown for the ADXL362 in the referenced article. Note however that the LED controlling FET is connected to the int2 pin of the ADXL362 and not to a GPIO of the processor. This is because of point (4) above, the ADXL362 has a direct output map able to either interrupt pin and active either high or low that control the LED. In this example on power up the processor only configures the adxl362 and then permanently sleeps.
As an indication of the low power of the ADXL362, when the LED is on, the circuit is using about 10,000 times more power than when only the ADXL 362 is active.
The attached file includes all files to reproduce this demo as built with MPLABIDE8.66. The fundamental part of the “main” C code is below for easy reference.
void main(){
OPTION_REG = 0x40 /*INTEDG*/;
/* power up timer */
buffer[7] = 255;
while(buffer[7]--);
/* soft reset for safety */
buffer[0] = XL362_SOFT_RESET_KEY;
xl362Write(1,XL362_SOFT_RESET,buffer);
/* wait for soft reset to pass */
buffer[7] = 255;
while(buffer[7]--);
/* set up a buffer with all the initialization for activity and inactivity */
buffer[0] = 105; /* XL362_THRESH_ACTL about 15 degrees*/
buffer[1] = 0 ; /* THRESH_ACTH */
buffer[2] = 3 ; /* TIME_ACT */
buffer[3] = 105; /* THRESH_INACTL*/
buffer[4] = 0 ; /* THRESH_INACTH */
buffer[5] = 37 ; /* TIME_INACTL 3 seconds at 12.5 hz*/
buffer[6] = 0 ; /* TIME_INACTH */
buffer[7] = /* ACT_INACT_CTL */
XL362_ACT_ENABLE | XL362_ACT_AC | XL362_INACT_ENABLE
| XL362_INACT_AC | XL362_ACT_INACT_LINK | XL362_ACT_INACT_LOOP;
xl362Write(8,XL362_THRESH_ACTL,buffer);
/* set up a buffer with all the initization for intmaps fitler and power*/
buffer[0] = 0 ; /* INTMAP1 */
buffer[1] = XL362_INT_AWAKE ; /* INTMAP2 */
buffer[2] = /* FILTER_CTL */
XL362_RATE_12_5 | XL362_RANGE_2G;
buffer[3] = /* POWER_CTL */
XL362_MEASURE_3D | XL362_LOW_POWER;
xl362Write(4,XL362_INTMAP1,buffer);
/* No interrupts INTCON = 0x90; */
while(1){ /* we only resume here after a wakeup interupt */
asm("sleep"); /* go into low power mode */
} /* while */
} /* main */
Message was edited by: Nitzan Gadish. Corrected reference to a (nonexistent) ADXL352, to say ADXL345.
RE: How to use the ADXL362 to eliminate a power switch and control system power by ADIApproved:
Hi Neil,
There are several advantages to an ADXL 362 over and ADXL 345 when it comes to power and a few things that the ADXL345 is better for. This article was primarily about the activity and inactivity functions. Some of the other differences between the ADXL362 and ADXL345 are:
XL362 cons:
-
1) Lower bandwidth and range limited to 200hz-6.25hz bw.
-
2) No tap/double tap
-
3) No freefall concurrent with inactivity (only one or the other)
-
4) SPI only not I2C.
XL362 Pros:
-
1) Sync input
-
2) Lower power
-
3) Bigger fifo
-
4) Better filtering (no aliasing at lower ODR/BW)
-
5) More resolution on activity/inactivity (12 bits @ 2gee)
-
6) Better timing options on inactivity 16bit count of samples at any odr.
-
7) Better suppression of false activity
- Post filtered sampled used
- Can use up to an 8 bit count of samples @ODR for the activity detection
- Xl345 was limited to 1 unfiltered sample.
RE: How to use the ADXL362 to eliminate a power switch and control system power by ADIApproved:
Attached is an expansion of this example with two changes:
1) It uses an automotive relay to switch a load.
2) It uses a pic 10lf322 which is much smaller for the processor.
