Printer Friendly

One accelerometer interrupt pin for both wakeup and non-motion detection.

MEMS accelerometers can output different kinds of interrupt signals like data ready, freefall, portrait/landscape, single-click/double-click, and impact detection, etc. Some accelerometers have built-in wakeup and motionless detection features to automatically switch between lower-output data rate (ODR) at low power mode and higher ODR at normal mode according to the motions. But this feature only saves the power consumption of the accelerometer itself. Some microprocessors have two or more GPIO pins and users can implement two accelerometer interrupt output pins for wakeup and non-motion detection at the same time. However, in some other cases, microprocessors have only one GPIO pin available for the interrupt but users would like to have both functions from one interrupt pin.

This article will discuss the method of using a high-pass filter (HPF) and freefall and logic scheme to detect wakeup motion and motionless conditions at one interrupt output pin. The microprocessor doesn't need to get involved. When the microprocessor sees the accelerometer interrupt signal rising edge, it means that the non-motion condition of the device has been confirmed. When it sees the falling edge of the accelerometer interrupt signal, then it means the device is in motion.

Hardware connection

Figure 1 shows the typical hardware connection between a host processor or a microcontroller and the accelerometer. The host processor only needs to configure the accelerometer one time when powered up through I2C or SPI interface in the initialization routine. Then, the accelerometer will monitor the motion in the background continuously at very low power consumption.


The INT1 output pin of the accelerometer is in push-pull and active high configuration by default. Users can change the configuration to open-drain or active-low for their applications. The voltage level of the INT1 pin is 0.9 * Vdd_IO minimum when high and 0.1 * Vdd_IO maximum when low. The accelerometer Vdd_IO is flexible to match the host processor digital 10 voltage level Vcc_IO. If the host processor has only one power supply, then the accelerometer Vdd and Vdd_IO can be tied together to this power supply directly.

When the handheld device has entered the rest condition from motion longer than a certain amount of time, the accelerometer will send an interrupt signal from low to high rising edge on INT1 pin. The host processor can then shut down other components and go to sleep mode to save power.

Whenever there is a motion, the accelerometer will send an interrupt signal from high to low falling edge. Then, the host processor can wake up and turn on other components for normal operation.

If the handheld device remains in motion at normal operation mode, then accelerometer interrupt signal on INT1 pin keeps low. When the device is always at rest at any tilted position, then the accelerometer interrupt signal remains high all the time. Therefore, the host processor can periodically read the level of the accelerometer INT1 pin to double check if the handheld device is at rest or in motion.

Sample code

Example based on LIS3DH digital accelerometer from STMicroelectronics.
//Initialize accelerometer in the host processor.
It only needs to be executed one time after power
up in initialization routine.

void init_ACC (void)


  // configurations for control registers Write 27h
  into CTRL_REG1;
  // Turn on the sensor with ODR
  = 10Hz normal mode.

  Write 0lh into CTRL_REG2;
  // High-pass filter (HPF) enabled with 0.2 HZ cut-off
  frequency for INT1 (AOI1) interrupt generation only.

  Write 40h into CTRL_REG3;
  // ACC AOI1 interrupt signal is routed to INT1 pin.

  Write 88h into CTRL_REG4;
  // Full Scale = +/-2g with BDU and HR bits enabled.

  Write 00h into CTRL_REG5;
  // Default value. Interrupt signal on INT1 pin is not
  latched. Users don't need to read the INT1_SRC register
  to clear the interrupt signal.

  // configurations for wakeup and motionless detection

  Write 08h into INT1_THS;
  // Threshold (THS) = 8LSBs * 15.625mg/LSB = 125mg.

  Write 95h into INT1_DURATION:
  // Duration = 50LSBs * (1/10Hz) = 5s.

  Write 95h into INT1_CFG;
  // Enable XLIE, YLIE and ZLIE interrupt generation,
  AND logic. It means the interrupt will be generated
  when X and Y Z axis acceleration is all within the
  [+ or -]THS threshold.

INT1_CFG configuration is the same as freefall event detection. The differences are (1) Freefall interrupt doesn't need to enable the HPF; (2) Freefall duration is in milliseconds range. 5 seconds duration means the freefall distance is about 122.5 meters, which rarely happens to a handheld device.

* When the handheld device is at rest at any tilted position for longer than 5 seconds, accelerometer INT1 pin will go high from low and stay high as long as the device is still at rest, because after HPF, X/Y/Z axes acceleration are all within [+ or -]125mg THS simultaneously.

* The freefall of the handheld device will not make the INT1 pin go high from low because the event of X/Y/Z axes acceleration within [+ or -] 125mg THS simultaneously doesn't last longer than 5 seconds.

* Whenever any axis X or Y or Z acceleration goes beyond [+ or -] 125mg THS due to the motion, the INT1 pin will go low from high and stay low as long as the device is still in motion.

* If the device is at rest for the time shorter than 5 seconds duration and the motion happens again, then the INT1 pin will still stay low and the 5 seconds duration will start counting down from 50LSBs to OLSB at 10Hz ODR once the device is at rest again.


By using built-in HPF and freefall event detection scheme, the accelerometer delivers robust interrupt signal for wakeup and motionless to the microprocessor from its one interrupt pin. The accelerometer works in the background and doesn't need the microprocessor involved. Users are free to configure the accelerometer threshold and duration to meet their needs. In terms of power saving, this is more effective than a handheld device touch screen and button press and microprocessor timer to switch off the screen.

By Jay Esfandyari, Gang Xu, Fabio Pasolini, STMicroelectronics
COPYRIGHT 2013 Advantage Business Media
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2013 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Title Annotation:Design Talk
Author:Esfandyari, Jay; Xu, Gang; Pasolini, Fabio
Publication:ECN-Electronic Component News
Date:Jun 1, 2013
Previous Article:Waterproof electronic enclosure family adds four new sizes.
Next Article:Brainstorm.

Terms of use | Privacy policy | Copyright © 2019 Farlex, Inc. | Feedback | For webmasters