Principle and application of accelerometer-mobile phone rollover, weightlessness detection, motion detection, position recognition

Source: Internet
Author: User

This paper introduces the characteristic principle and application scenario of the-LIS3DH accelerometer sensor for wearable devices. ST's LIS3DH is widely used in smart wearable products such as smart hand loops and smart step shoes.

LIS3DH has two ways of working, one of which is that it has built-in algorithms to handle common scenarios such as standstill detection, motion detection, screen flipping, weightlessness, position recognition, click and double-click, and so on, so users can start detection with a simple configuration of the corresponding registers, and once a target event is detected, The peripheral pin INT1 of the LIS3DH generates an interrupt. The other is to support the user through the SPI/I2C to read the underlying acceleration data, and by itself through the software algorithm to do further complex processing, such as pedometer and so on.

This article takes LIS3DH as an example, but the working principle and application scenario are also applicable to other accelerometer sensors. More embedded and IoT original technology sharing please pay attention to the public number: embedded Penguin ring.

First, the acceleration sensor working principle

The acceleration sensor naturally detects the acceleration of its own device. Its own physical implementation of the way we will not expand, you can imagine a vacuum region inside the chip, the sensor is in the region, which is caused by the inertia force of the voltage change, and through the internal ADC to give a quantization value.

The LIS3DH is a triaxial accelerometer, so it detects acceleration data for x, Y, z, such as:

In a stationary state, the sensor is bound to be in one direction of gravity, so the data with one axis is 1g (i.e. 9.8 m/s two times). In practical applications, we do not use 9.8-related calculations, but instead use 1g as the standard acceleration unit, or using 1/1000g, or MG. Since ADC conversion, there must be a concept of range and precision. In terms of Quanta, LIS3DH supports (+-) 2g/4g/8g/16g four kinds. Generally, as a step application, the 2g is sufficient to remove the gravitational acceleration of 1g and to detect the acceleration of 1g. As for precision, it is related to the number of register bits it uses. The LIS3DH uses a high-low two 8-bit (16-bit) register to access the current reading of an axis. Since there is an acceleration in the positive and negative two directions, the 16-digit number is a signed integer and the actual value is 15 bits. The accuracy is 2g/2^15= 2000mg/32768 =0.061mg with (+-) 2g range.

When the stationary state is shown, the z-axis positive direction detects the 1g,x, the y-axis is 0. If the position is reversed (such as a mobile phone screen flipping), there will always be an axis to detect the 1g, the other axis is 0, in the actual measured value, may not be 0, but there are small values.

The x, y, Z axes change during the movement. The step motion also has its inherent numerical law, because the moving process also has the foot and the foot rule process, such as. "Pedal off the ground is the beginning of a step, at this time due to the reaction of the ground, the vertical acceleration begins to increase, when the foot reached the highest position, the vertical acceleration of the maximum speed, and then the foot downward movement, the vertical accelerations begin to decrease, until the foot ground, the vertical acceleration to minimize the value. Then the next step. The forward acceleration is generated by friction between the feet and the ground, which increases when the feet touch ground and decreases when one foot is off the ground. [Reference is made to the design of pedometer based on accelerometer LIS3DH, published by Han Wenzheng and others].

Second, understand the acceleration sensor a coordinate system error

STMicroelectronics publishes two documents, official specifications and application design guidelines for LIS3DH. This is a separate point because I was in the use of LIS3DH in the past may have been too long without the use of stereo geometry thinking, resulting in the x, Y, z coordinate system to confuse the concept, the position recognition delay can not understand, now point out this misunderstanding.

X, Y, Z, in addition to representing the three-dimensional coordinate system we know, there is also an important cognition, that is, the x, y, Z axis corresponding registers according to the chip diagram (determined by the dot of the chip) to measure the acceleration value, regardless of the location of the chip, X, Y, The three registers corresponding to the z-axis always work in this way: Z-axis Register to measure the vertical data of the chip, the data of the y-axis measuring chip, the data before and after the x-axis measurement (the definition may not be enough for the image, we can understand it well). For example, in the case of a stationary state, the x-axis registers measure the acceleration in the direction of the chip, and if the chip is stationary on the right, the x-axis registers the z-axis acceleration of the coordinate system.

Three, LIS3DH built-in hardware algorithm working principle

Since the steps are required to read the underlying x, y, Z axis data before processing, we do not discuss this algorithm here. This article focuses on how to use LIS3DH built-in hardware algorithms to detect common scenarios.

LIS3DH's built-in hardware algorithm is determined by 2 parameters and a pattern selection. The 2 parameters are the threshold and duration, respectively. For example, when at rest we are going to detect the motion of the Chip (wakeup), we can set a motion corresponding threshold, and require the chip to detect the data at more than this threshold to continue for a certain period of time to think that the chip is moving. The built-in algorithms are basically detected based on thresholds and durations.

LIS3DH There are two sets of hardware algorithm circuits that can work at the same time, one is specifically for clicking, double-clicking the scene, such as mouse application, the other is for all other scenes, such as stationary motion detection, motion direction recognition, position recognition and so on. Here we mainly describe the latter, which has four modes of operation:

The first: or or circuit, that is, X, y, z any axis data exceeding the threshold to complete detection.

The second: the And and the circuit, that is, X, Y, z all the axes of data are above the threshold to complete detection. Of course, it also allows to detect only any two axes or an axis, the detection of the threshold of the axis detection can be considered to be always true.

The threshold comparison of the above two circuits is shown below, the threshold comparison is the absolute value comparison, there is no direction of the point. Regardless of the positive or negative direction, as long as the absolute value exceeds the threshold, then XH (YH, zh) is 1, at this time the corresponding XL (YL, Zl) is 0; otherwise XL (YL, ZL) 1, the corresponding XH (YH, zh) 0. XH (YH, ZH), XL (YL, ZL) can be considered as the pending indication bit of whether the detection condition is satisfied.

The third and fourth is a six-direction detection of an object, movement detects the direction of movement of the chip, that is, from one direction to another, while the position detection chip stabilizes to a certain direction (such as stability for flat-top, flat-down, erect before and after) and so on.

The threshold comparison circuit is as follows, and this threshold comparison uses positive negative numbers for real data comparisons. The positive direction exceeds the threshold value, then the XH (YH, ZH) is 1, otherwise 0, the negative direction exceeds the threshold, XL (YL, ZL) is 1, otherwise 0. XH (YH, ZH), XL (YL, ZL) represent six directions. Due to the stationary state, only one Direction has the gravitational acceleration, so the position of the chip can be known accordingly.

IV. Application of Accelerometer sensors

If you can understand how the third part works, you can also understand the following applications well.

1. Motion detection at standstill

Using the or circuit operation, set a small motion threshold to detect whether the x, Y axis data exceeds this threshold (the z-axis is 1g, I don't care about this axis). It is assumed that the device is in the wakeup state as long as the x, Y axis data exceeds the threshold for a certain amount of time.

2. Weightlessness Testing

The acceleration of the z-axis and the acceleration of gravity during weightlessness are 0 in a short time, and the x, Y axis does not change, so in a short period of time all three are 0. Here, using the and circuit operation, set a small motion threshold, when the data in three directions is less than the threshold value of a certain time is considered weightlessness.

3. Position Posture Recognition

Applications such as mobile phone flipping are taking advantage of this feature. Here in the third part of how the principle of work has been explained very clearly.

With the above understanding, in the future when using LIS3DH to fill the register directly to complete the function of the value.

Principle and application of accelerometer-mobile phone rollover, weightlessness detection, motion detection, position recognition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.