Reference address: http://home.eeworld.com.cn/my/space.php? Uid = 306328 & Do = Blog & id = 42866
The 3-Axis G-sensor and mma7660 have been adjusted in the past two days. You can use them. tilting or changing the direction of the Board, mma7660 will interrupt and give the attitude of the current Board (horizontal/vertical, up and down, left and right ).
1. Gravity accelerometer mma7660
1.1Purpose:
Mma7660 is only a 3-Axis G-sensor, which is mainly used to measure the tilt angle, inertia force, Impact Force and vibration.
1.2Working principle:
Mma7660 is a capacitive G-sensor. most capacitive G-sensor manufacturers in Europe and America are using a comb structure on the wafer surface. When an action is triggered, the difference in capacitance is detected to determine the deformation and the acceleration value is reversed.
Unlike the pressure-resistance model, it is difficult for the Capacitive Type to detect changes in three axes (x, y, z) at the same time in the same structure, which are usually separated by X, Y, and Z, (That's why when the board is horizontally placed, no matter how it changes the position of X and Y, there will be no interruptions, because at this time it can only detect changes in the Z axis, X, Y changes cannot be detected. Only when we tilt the board to an angle can we detect X and Y changes ). the pressure-resistance type can sense the changes of the three axes in the same structure.
1.3 Working Mode:
mma7660 has three working modes. (by setting the mode register)
1 ). standby (standby) mode
at this time, only I2C works and receives commands from the host. this mode is used to set registers. that is to say, to change the value of any register of mma7660, you must first enter the standby mode. after the settings are complete, enter the active or auto-sleep mode.
2). Active and auto-sleep (active and auto-sleep) Mode
Mma7660 has two working states: High-Frequency Sampling and low-frequency sampling. in order to save power consumption, but maintain sufficient sensitivity during activity.
Therefore, the mma7660 active mode is actually divided into two modes, one is pure active mode, that is, after entering the active mode, the sampling frequency remains high, unchanged. another mode is the active & Auto-sleep mode, that is, after the system is activated, the system first enters the high-frequency sampling mode. after a certain period of time, if no activity is detected, it enters the low-frequency sampling mode, so it is called auto-Sleep. Sleep is not really sleep, but it just means reducing the sampling frequency.
The low-frequency sampling mode is also called the auto-wake touch mode, that is, the automatic wake-up mode. It is not the sleep mode, but only reduces the sampling frequency.
3). Auto-wake (automatic wake-up) Mode
After auto-sleep, the system enters the low-frequency sampling mode. This mode is called the auto-wake touch mode, that is, the automatic wake-up mode. It is not the sleep mode, but only reduces the sampling frequency.
1.4 initialization:
Init
|
| Mode = (0) Enter standby mode and set registers
|
| SRST = 0x03,
| Sr = (2, 2, 1 ),
| In intsu, asint = 1, plint = 1, fbint = 1
| Mode = (0, 1, 0, 1, 1, 0, 1)
|
Active & Auto-sleep (64 samples/sec)
^ |
| State changes | spcnt = 0xa0 timeout
| Interrupt |
| V
Auto-wake (= half sleep) (8 samples/sec)
2. Gyroscope
After using G-sensor, I was curious about its relationship with gyroscope.
In terms of motion sensing, the accelerometer does not have enough precision for the variation, but the gyroscope just makes up for this.
The principle of gyroscope is that, for a rotating object, the orientation indicated by the rotating axis will not change without being influenced by external forces. people use this principle to maintain the direction. when working, the gyroscope needs to give it a force to quickly rotate it, then read the direction indicated by the axis in multiple ways, and automatically transmit the data signal to the system.
After an object is rotated at high speed, its axis has the stability of pointing.
Gyroscope is a comprehensive angle offset detection instrument in three-dimensional space.
2.1 functions of model helicopter Gyroscope
The basic principle of helicopter flight is to use the Variable Angle of the main rotor to generate reverse thrust and increase, but it will have a torsion effect on the body, so we need to add a tail rotor to offset the torque and flatten the horizontal body. but how can we make the tail rotor balance the body from a proper angle? This uses a gyroscope. It can automatically provide a compensation signal to the server based on the size of the body's swing to change the angle of the tail rotor and generate a thrust balancing body. in the past, model helicopters had no gyroscope, And the accelerator and main rotor angle were difficult to work with. after starting the helicopter, they flew up as soon as possible (because it was easier to control during flight ), if you want to hover over, you need to control the lever quickly and sensitively, so it is easy to crash. Now there are a variety of helicopter models using gyroscope, which have mechanical, electronic, and electronic automatic locking patterns.
2.2 usage of gyroscope on smart phones
Anyone who cares about iPhone 4 knows that its strong selling point is the built-in gyroscope, which has both a gyroscope and a gravity accelerator. The main uses of the gyroscope include:
1 ). navigation. since its invention, gyroscope has been used for navigation. If GPS is used together, the mobile phone's navigation capability will reach an unprecedented level (electronic guidance, but it cannot be corrected without GPS for a long time, otherwise there will be deviations with time ). in fact, many professional handheld GPS devices are equipped with gyroscope. If the corresponding software is installed on the mobile phone, the navigation capability is no less than that of many ships and navigators on the plane.
2) camera anti-shake.
3). Sensors for various games. The gyroscope completely detects the movement of the player's hands to achieve a game operation effect.
4). It can be used as an input device. The gyroscope is equivalent to a three-dimensional mouse.
For mobile phones installed with gyroscope, cameras, and various sensors, it has been converted from communication tools to entertainment centers, and then upgraded to highly efficient production tools.