The Analysis of various drone sensors
Drone sensorsmainly include angular velocity sensor (gyroscope), acceleration sensor (accelerometer), geomagnetic sensor (digital compass), air pressure sensor (barometer), etc.To better control drones, we need to know the role of these drone sensors. The following is an analysis of drone sensors, hoping to help everyone.
1. Angular velocity sensor (gyroscope)
The angular velocity sensor adopts the working principle of the Coriolis force: the inertia of the motion of the object, the particle moving in a straight line in the rotating system, due to the effect of inertia, there is a tendency to continue to move along the original direction of motion, but because the system itself is Rotating, after a period of motion, the position of the particle in the system will change, and the direction of its original motion trend, if observed from the perspective of the rotating system, will deviate from a certain angle. When a particle moves in a straight line relative to inertia, its trajectory is a curve relative to a rotating system. Based on the rotating system, we believe that there is a force that drives the trajectory of the particle to form a curve, and this force is the Coriolis force.
Angular velocity sensors are usually used to detect the movement of objects. For example: a person is moving in a straight line in a fixed direction. From the perspective of space, this person is actually rotating at a certain angle. By detecting this angular velocity, we can know if the object is moving. By detecting the angular velocity of the drone in different directions, we can know the direction of movement of the aircraft. Commonly used motion direction detection includes X direction, Y direction, and Z direction, which is commonly referred to as a three-axis angular velocity sensor, also known as a three-axis gyroscope.
2. The acceleration sensor (accelerometer)
The acceleration sensor used by the drone is also called a gravity sensor, which is used to measure the tilt angle of the device relative to the horizontal plane. So what is its measurement principle? Any object on Earth is subject to gravity. The calculation formula of gravity: G=mg. Where g is the acceleration of gravity 9.8N/kg. The gravitational force on an object placed on an inclined plane can be decomposed into two directions: the direction parallel to the object and the direction perpendicular to the object. Then, for an object with an oblique angle of α, the gravitational acceleration g can be decomposed into sinα in the X direction and cosα in the Y direction, so that the gravitational effect in the X direction Fx=mg.sinα and the gravitational effect in the Y direction Fy=mg.cosα can be obtained. The gravity sensor converts these two forces into a voltage signal, and by reading the voltage signal, we can calculate the inclination angle of the object.
However, the inclination angle measured by the moving object is inaccurate. The reason is that the moving object, due to the superposition of the acceleration of different angles, the force in all directions of the object cannot accurately represent the gravity caused by the inclination. Therefore, in use Be aware of this.
Why not just call it a gravity sensor instead of an acceleration sensor? In fact, accelerometers can sense all kinds of accelerations, not just the earth's gravitational acceleration. We call it a gravity sensor in the quadcopter because we only need to detect the acceleration of gravity to obtain the tilt angle of the quadcopter relative to the ground. In simple terms, the manufacturing principle of accelerometers is to convert pressure into electrical signals. Most accelerometers work on the principle of piezoelectric effect. The so-called piezoelectric effect, even if some dielectrics are deformed by external forces in a certain direction, polarization will occur inside them, and positive and negative opposite charges will appear on its two opposite surfaces. By measuring these charges and converting them into voltage signal output, the fabrication of the acceleration sensor is completed.
Commonly used modules that combine angular velocity and acceleration sensors include MPU6050, MPU6000, etc. The MPU6050 is a very popular spatial motion sensor chip that can acquire the current three acceleration components and three rotational angular velocities of the device. Because of its small size, powerful function and high precision.
3. Geomagnetic sensor (digital compass)
Geomagnetic sensors, the digital compass, are used to determine direction. It uses the geomagnetic field to determine the North Pole, and its basic principle is similar to that of a compass. The three-dimensional geomagnetic sensor can provide the heading angle, pitch angle and roll angle of the moving object by giving the geomagnetic force projection on the X-axis, Y-axis and Z-axis, so that the attitude of the object can be determined, in fact, the coordinates of the object are determined. The orientation relationship between the system and the geographic coordinate system. However, in practical applications, it is necessary to pay attention to the interference caused by the magnetic field generated by surrounding objects to the sensor.
4. The air pressure sensor (barometer)
The air pressure sensor uses the pressure of the air to measure the height of the location of the object. Its function is to measure the height of the plane where the object is located. Air pressure is created by the gravity of the air at the surface. At high altitudes, the air thickness on the surface is small and the pressure is low; at low altitudes, the air thickness on the surface is large and the pressure is high. By measuring the atmospheric pressure at the location and comparing it with the standard, the height of the object's position can be obtained, which is the basic measurement principle of the barometric altimeter. In practical applications, the measurement results need to be corrected in combination with temperature, etc.
5.various sensor analysis
For the angular velocity sensor, acceleration sensor, geomagnetic sensor and air pressure sensor, in addition to the air pressure sensor, the remaining three sensors can provide measurement data of X, Y, and Z axes. In order to better understand the function of each sensor,
Summarized as follows:
(1) Angular velocity sensor: Use the invariance of the direction pointed by the rotation axis of the rotating object when it is not affected by external force to measure the impact of external force on the object. Unlike the gravitational force of the earth and the magnetic force of the earth's north and south poles, which have a fixed direction, the direction of the rotation axis of the rotating object is uncertain, so the angular velocity sensor can only be used to measure the position change, and cannot measure the object like the acceleration sensor and the geomagnetic sensor. absolute angle and posture. We must note that the angular velocity output by the angular velocity sensor is an instantaneous quantity, its measurement reference is itself, and there is no absolute reference outside the system
(2) Acceleration sensor: The gravitational acceleration of the earth is used to project the gravitational acceleration on the X, Y, and Z axes to measure the posture of the object.
(3) Geomagnetic sensor: It uses the suction force generated by the magnetic field of the earth's north and south poles, and projects it on the X, Y, and Z axes to measure the orientation and attitude of the object.
It can be seen that, in addition to the air pressure sensor, the acceleration sensor, the geomagnetic sensor and the angular velocity sensor can all be used to detect the posture of the object, so as to control the balance of the quadcopter. So what are their disadvantages?
Geomagnetic sensor: Magnetic field is very prone to interference. The so-called electromagnetic effect, that is, an electric field produces a magnetic field, and a magnetic field produces an electric field. We simply use the geomagnetic sensor to control the balance of the quadcopter, then the magnetic induction generated by an electrical appliance may be mistaken for a change in the posture of the aircraft, which will cause the microprocessor to change the balance speed of the motor, resulting in the loss of the quadcopter. balance. The motor is the most likely to generate a magnetic field in an aircraft, that is to say, the motor can measure the earth's magnetic field when it is not energized. Once it is energized, the magnetic field sensor is stupid. If you are not doing a static model, it is recommended not to consider the magnetic field and save yourself some money.
Accelerometers, we know that objects in motion generate various accelerations including gravitational acceleration. When the quadcopter takes off, due to the weight and speed error of the motor speed itself, we cannot perceive the force of the aircraft itself, so we cannot recognize the attitude of the object through acceleration. To obtain accurate object angle and attitude, the acceleration sensor It needs to be measured at a static or constant speed, but the moment the aircraft takes off, it is in motion, so you cannot use it to balance the quadcopter.
Angular velocity sensor: The angular velocity sensor is an ideal balance control sensor that senses the movement of an object. The microprocessor of the quadcopter analyzes by reading these data, and performs feedback control according to the movement changes, that is, the object can be kept in balance. At the moment of take-off of the quadcopter, the aircraft starts to move under the action of the four motors. Due to the difference in the driving force of different motors, the aircraft posture will change. The aircraft reaches equilibrium.
So can a quadcopter with only an angular velocity sensor fly? It is theoretically possible, however, the angular velocity sensor cannot absolutely locate its own position and posture, it just senses the change of the object's posture, and then blocks the change through the microcontroller to achieve balance. To put it simply, at the moment of take-off of the quadcopter, if its position is inclined, then after it is balanced, its position is also inclined, because it cannot know its initial state. Therefore, the quadcopter with only the angular velocity sensor cannot fly horizontally, cannot sense the flight posture, and cannot correct the flight posture. In addition, it should be noted that the instantaneous output of the angular velocity sensor is not suitable for direct balance control.
6. Balance and Attitude Control of Quadcopter
Next, analyze how to balance and control the posture of the quadcopter.
The angular velocity output by the angular velocity sensor is the instantaneous angular acceleration, and the general balance control system cannot directly use it. We need to get the change of angle for balance control, which requires the use of angular velocity and time for integral operation to obtain the change of angle. The amount of change in this angle can then be used for balance control. Therefore, in the actual four-axis flight system, the PI operation should be performed on the angular velocity sensor first. PI is proportional integral control and lag correction. It is a PID improvement algorithm developed by PID (proportional/integral/derivative). P refers to proportional control, its controller
The output is proportional to the input error signal. I refers to integral control, and the output of the controller is proportional to the integral of the input error signal. PID is a closed-loop control algorithm, and must have a closed-loop system in hardware, that is, a control system and a feedback system. PID (proportional/integral/derivative) does not have to have three algorithms at the same time, it can be PD, PI, or even P algorithm control. Simple P algorithm control is the simplest. Taking a quadcopter as an example, it is to read back the angular acceleration data. If it is positive, the motor will accelerate, if it is negative, the motor will decelerate, or do the opposite control. For pure P (proportional) control, which reflects the current state of the system, the error can be reduced by speeding up the adjustment, but the stability of the system is reduced, and even the system is unstable. I (integral) and D (differential) cannot work alone, and must be used in conjunction with P (proportional) control. I (integral) reflects the cumulative deviation of the system, enabling the system to eliminate steady-state errors. D (differential) reflects the rate of change of the system deviation signal, and has predictability, so as to carry out advanced control. The quadcopter generally only uses the PI. attitude, but we know that the integral operation has errors. As time goes by, the error becomes larger and larger, and finally the calculated angle of change is far from the actual angle. , resulting in the deviation of the posture from what we expected. The acceleration sensor uses gravity as the reference force direction. In the absence of external force, it measures the absolute posture of the object. But it can't distinguish between gravitational acceleration and external force acceleration. Because the quadcopter in motion is affected by gravity and external force at the same time, the attitude output of the acceleration sensor cannot reflect the most real attitude of the aircraft. Therefore, on the basis of no other reference, it is necessary to fully understand the characteristics of these two sensors, make use of the strengths and avoid weaknesses, use the value of angular acceleration in a short time, and use the value of acceleration in a long time for correction, so as to obtain a value close to the true value. posture. The most correct way to solve the attitude by fusion of acceleration and angular velocity is to use dynamic Kalman filter for output, which can automatically correct the state parameters according to the observed value, but the Kalman filter algorithm is complex and difficult to understand, and it is not easy to do without a certain foundation.