Most of the latest 3-axis digital-MEMS accelerometers on the market can generate interrupts for a number of applications. Some of the applications—such as screen rotation, wakeup, freefall, single click and double click recognition—have been very popular and implemented in various devices.
A digital MEMS accelerometer usually has one or two interrupt-output pins available that can be interfaced with the I/O pins of an external host processor. The accelerometer can be configured to monitor acceleration or motion in the background while the host processor could perform other tasks or simply stay in low power sleep mode. When an interrupt is detected by the accelerometer, the host processor can then wake up to check whether the interrupt needs to be served or not.
This article describes some of the popular interrupt-based applications including data ready, freefall, wakeup, single and double click interrupts.
A digital MEMS accelerometer can be configured to generate a signal to indicate when a new set of measurement data is available to be read. This signal is usually represented by the data-ready bit in the status register of the accelerometer which is accessible to the user. The signal can be routed to an interrupt pin by enabling the data-ready-interrupt bit in one of the control registers, and its polarity can be set to active-low or active-high through the edge-level bit in another control register. By default, when the accelerometer is powered up, the interrupt pin is active-high.
The data-ready interrupt signal goes high when a new set of acceleration data has been generated in the data registers of the accelerometer. The interrupt goes low when the high bytes of the data registers of all enabled axes have been read. If the high bytes haven’t been read during 1/ODR (Output Data Rate) time period, then the data ready interrupt will stay high and the overrun bit in the status register becomes “1”, which means that data overrun has occurred and the previous data samples have been overwritten.
The data ready interrupt feature can be used to synchronize the continuous data acquisition to prevent data loss. By default, the interrupt pin is a push-pull topology which can be tied directly to an I/O port of the host processor that has interrupt function. When new data is not ready, the host processor can perform other tasks or simply stay in low-power sleep mode.
Once the data ready interrupt occurs, the host processor can wake up at the rising edge of the I/O port to enter the interrupt service subroutine and then read and process the acceleration data. This can help reduce the overall system power consumption as the host processor is not required to keep polling the data-ready bit in the status register.
During the evaluation of the accelerometer, the data ready interrupt feature can be used to check the frequency of the interrupt signal wave form at different ODRs by using an oscilloscope.
The freefall interrupt feature of the accelerometer has been widely used in hard disk protection. When, for example, a laptop computer is falling, the accelerometer embedded in the laptop can generate an interrupt so that the hard disk can park the magnetic head of the disk in a safe place, to prevent the mechanical damage of the disk.
In medical applications, the accelerometer freefall interrupt can be integrated with the altitude detection by a MEMS pressure sensor to detect if a patient has fallen onto the floor. If the fall event is confirmed, then the host processor inside the medical device will send an alarm to the hospital personnel through a wireless link. The latest accelerometers and pressure sensors with small size and ultra-low-power consumption have enabled such an application (known as man-down application), as these medical devices are battery operated and therefore power sensitive.
By definition, the freefall stands for the state where there is no external force to be applied to the accelerometer, except for Earth gravity. Theoretically, therefore, a 3-axis accelerometer simultaneously outputs zero-g measurements about all it sensing axes during freefall. This is the specific characteristic of the freefal,l meaning that other motions will not be able to fake the freefall event.
When an object is thrown upwards, the object will be in the condition of freefall from the moment the action has occurred. If an accelerometer is installed at a point away from the rotation center of the object, the centrifugal force will cause the accelerometer to output non-zero-g during the free fall. Therefore, it is recommended to install the accelerometer at the rotation center of the device for free-fall application.
Each accelerometer is usually factory calibrated and tested. This means that users don’t need to perform any further calibration after it is mounted on the board for freefall detection. However, the zero-g offset of the accelerometer may be within ±40mg to ±100mg because the accelerometer might have not been mounted horizontally after PCB assembly. Due to this offset, the threshold and duration-time parameters may need to be configured in order for the accelerometer to avoid false freefall detection and missing the real freefall event.
The following example shows how to configure an accelerometer for freefall detection. For this example, the evaluation board of a 3-axis digital accelerometer from ST was used. Figure 1 shows the captured raw data and the interrupt signal from an accelerometer evaluation board and its Windows demo software (Reference 1). Figure 2 shows the zoomed-in freefall signal for further analysis.
The accelerometer was configured to operate at 50Hz ODR (Output Data Rate), ±2g Full Scale (FS) range. The interrupt registers were configured as “AND” logic for X-low, Y-low and Z-low detection simultaneously, ±343mg threshold and 40ms duration time.
Figure 1: Freefall interrupt from Windows demo software
At the beginning, the accelerometer-evaluation board was held at a random orientation. It was then dropped onto the floor. Figure 1 shows that the freefall interrupt was successfully detected. The accelerometer freefall interrupt configurations are also shown in Figure 1. The positive and negative peaks indicate the time when the board hit the floor.
Figure 2: Freefall interrupt, zoomed in
Figure 2 shows that when the accelerometer raw data on the X, Y and Z axis entered the threshold zone for at least 40ms duration time (or 2 samples), the freefall interrupt was generated and the freefall event lasted total 14 samples, or 280ms.
In Figure 2, after the interrupt signal became low, the raw data on the X, Y and Z axes fell into the threshold zone again. However, it did not last for the duration time of 40ms and the freefall interrupt was not generated. The threshold and duration time need to be determined by the user based on their requirements for freefall detection application.
For battery-operated devices, minimizing power consumption for each component is crucial. When the magnitude of the raw data of the X, Y and Z axes of the accelerometer is equal to approximately 1g for a certain amount of time (Reference 2), it means that the device is stationary or inactive. This can be used, for example, to switch off the LCD screen of a smart phone to save power. In contrast, when the motion is applied to the smart phone, the accelerometer can generate a wakeup interrupt to switch on the LCD screen.
Compared to freefall interrupt, the wakeup interrupt is based on “OR” logic, which means that at least one of the acceleration data points on X, Y or Z axis is beyond the preset threshold. The built-in high-pass filter in the accelerometer can be used to filter out the constant component of the acceleration.
An example of the wake-up interrupt is to set the acceleration threshold to 250mg. This corresponds to about ±14.5° (sin-1 0.25) of tilt angle. If the device is tilted more than this angle or the acceleration applied to the device is larger than the threshold for at least the duration time period, the interrupt will then be generated for 1/ODR time period. The interrupt latch bit in a dedicated control register can be enabled to make the interrupt signal stay high all the time. Once the interrupt status register has been read, the interrupt signal will go low.
Single-click and double-click interrupt
Some of the digital MEMS accelerometers can generate single-click and double-click interrupts and indicate the direction of the click motion. This feature has become increasingly attractive in portable devices such as smart phones, tablet PCs, watches, E-book readers, and simialr. Once the interrupt has been generated by the accelerometer, the host processor can trigger different functions in those devices.
The click-motion detection depends on the device shape and material and the accelerometer location in the device. Also, waving or shaking of the device can fake the click motion. Therefore, the accelerometer settings for the click-interrupt generation need to be fine-tuned to reliably detect the actual click motions and reject the fake ones.
This section focuses on single-click interrupt implementation from a digital accelerometer. Double click is simply defined as two successive, single-click events within a certain time period defined by the host-processor timer. If the second single-click interrupt happens within this time period, then the host processor knows it is a double-click event. Otherwise, it is still considered a single click.
In order to get a reliable single-click interrupt, the user needs to configure the click threshold and the time limit. When the acceleration is beyond the threshold, the accelerometer starts counting the number of samples or time elapsed. Only when the acceleration falls below the threshold within the preset time limit, then will the interrupt be generated. The single-click interrupt can be latched by enabling a certain bit in a dedicated click-interrupt register. Once the click-status register has been read, the interrupt signal will be cleared and the direction of the click motion will be obtained.
Figure 3 shows the zoomed-in waveform which was captured by a Windows demo software and the accelerometer evaluation board. The accelerometer was set to ±4g full scale (FS) and 1250Hz ODR. The click threshold and time limit were set to 2.25g and 1.6ms (or 2 samples at that ODR), respectively. At ±4g FS, the sensitivity of the accelerometer raw data is 2mg/LSB (least significant bit).
The higher the ODR, the more reliable the rejection to fake motions will be. However, the power consumption will be higher. This is a trade-off between the single- and double-click feature implementations.
Figure 3: Single-click interrupt, zoomed in
Figure 3 shows that when the sample #14 is beyond the threshold, the accelerometer starts counting. Sample #15 is still beyond the threshold, while the acceleration falls below the threshold before sample #16 which is the time limit. So, the interrupt is generated at sample #16. It can also be seen that the acceleration on the X axis crosses the negative threshold and the value in the click-status register shows that the single click motion thus corresponds to the X-axis direction.
Accelerometers can be configured to monitor the acceleration on its three axes in the background, while the host processor can perform other tasks or simply stay in low-power sleep mode. The acceleration data can be used to implement accelerometer interrupt features such as data-ready, freefall, wakeup, single click and double click.
The MEMS accelerometer measures the linear acceleration. However, it cannot distinguish between different types of motion. To implement reliable and robust interrupt-based applications including screen rotation, position orientation and single/double click detection the host processor needs to read and process the accelerometer raw data based on the requirements of each application.
The future MEMS accelerometers will have more built-in advanced features and computing capabilities to reliably generate these interrupts and offload the data processing from the external host processor into the accelerometer.
STMicroelectronics, Inc., STEVAL-MKI022V1: MEMS 3-axis ±2g /±4g /±8g smart digital output evaluation board, based on nano accelerometer LIS331DLH, http://www.st.com/internet/evalboard/product/219419.jsp
STMicroelectronics, Inc., AN3182: Tilt measurement using a low-g 3-axis accelerometer, http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/CD00268887.pdf
About the authors:
Jay Esfandyari is MEMS Product Marketing Engineer at STMicroelectronics. He has authored many papers and articles on MEMS technologies, products and applications. He holds a master's degree and a Ph.D. in Electrical Engineering from the University of Technology of Vienna, Austria. Email: email@example.com
Paolo Bendiscioli is an Application Manager for Motion MEMS Division, and has more than 10 years experience in the applications of MEMS accelerometers, gyroscopes and magnetometers. He is responsible for the application development and customer technical support team. Paolo received a degree in Electronics Engineering from the University of Pavia in 1997.
Gang Xu, Senior Application Engineer at STMicroelectronics, has more than 10 years experience in the applications of MEMS accelerometers, gyroscopes and magnetometers. He received a doctorate in Electrical Engineering from Shanghai Jiao Tong University in 1996.
Article Courtesy: Planet Analog