Modern drones utilize many different sensors to archive flight. Some of them are required to fly, some are only optional and they can only improve flight performance. This entry will be a summary of those sensors, with short description and information how UAV utilizes data from them.
Gyroscope, or shorter gyro, is the only sensor that drone really needs for stable flight. It feeds flight controller with extremely important information: how fast aircraft is rotating around its own axises: roll, pitch and yaw. Inner loop of PID controller utilizes his information to stabilize the craft.
When pilot is not applying any deflection to roll, pitch and yaw control sticks (they are in neutral positions), drone should not rotate. It should keep current attitude, do not wobble, do not have rotation drift. If it starts to rotate, this information is taken from gyros and counteraction is applied to stop unintended rotation and event to rotate back to desired attitude.
When pilot applies stick deflection, flight controller translates it to desire rotation rate and applies correction to archive it.
Gyros are used in all flight modes, all drones have to have them. Gyro failure almost always results in a crash. They are connected over I2C or SPI buses and can provide new data with a frequency of 1kHz, 8kHz in some cases.
Most popular are MPU6000 and MPU6050
Accelerometers provide information about drone acceleration/acceleration forces in X Y and Z axises. When drone stays perfectly still, it will report only one acceleration: 1g of Earths gravity pulling it down to the ground. When drone is banked left 90 degrees, Z axis would report 0g, but Y would report 1g. Thank to this, accelerometer data is used to determine where is up, where is down and what is current attitude. Data, that gyroscope is unable to provide.
This is why, accelerometer is used in stabilized modes like Angle, Horizon, Attitude, etc. In those modes, pilots input is not translated to desired rotation rate, but desired inclination. Important note: stabilized modes, while they require accelerometer, they can not work without gyro! Why? Pilot input is translated into desired inclination, but then inclination is translated to rotation required to archive that inclination.
Other use of accelerometer data is short term position estimation. When properly calibrated, accelerometer readouts can be used to determine aircraft movement (speed, distance) for a short period of time (few seconds most). This approach to utilize acc data is used, for example, by INAV.
Problem with accelerometers is that they are not very accurate. They can not differentiate between Earth's gravity field and aircraft acceleration. The second one can affect acc's ability to determine inclination. And they are easily affected by vibrations.
Accelerometers are very often integrated in one package with gyroscopes, like MPU6050 and MPU6000.
Barometer measures air pressure. Since pressure drops with altitude, they can be used to measure altitude as well. Unfortunately, although in theory they are pretty precise, there are some problems with them:
- To measure absolute altitude (ASL), local sea level pressure has to be known. Without this information, only altitude relative to the point of take off can be measured
- They are prone to drift, since air pressure is not constant
- Wind or any rapid air movement can cause local pressure changes and alter the readout
Because of this, without periodic calibration they can give accurate measurements only for limited period of time. In specific conditions even few minutes of flight in changing weather conditions can cause a few meter altitude drift.
Baros are used only for Altitude Hold, autonomic (missions, return to home) and similar flight modes. The most popular barometer models as BMP180/085, BMP280 and MS5611. All of them are connected to I2C bus.
Most popular usage of rangefinders in aircraft applications is to measure above the ground altitude (AGL). And the most popular types of rangefinders are sonars. Not the best, but the cheapest. Sonars have limited range (few meters) and are affected by the surface type. Laser rangefinders have bigger range, better accuracy but they are more expensive.
Rangefinder task is simple: to tell flight controller how far from the ground aircraft is. This has some advantages over barometer:
- is more accurate (usually)
- is not affected by drift
- can measure distance to ground, so terrain following modes can be used
- ground has to be "in range" of a rangefinder
- rangefinder has to be pointed towards ground all the time
This is why, rangefinders usage is more limited in altitude control than barometers.
GPS and other satellite positioning systems
This one is simple: it provides aircrafts geographical position, as well as speed and absolute altitude (ASL). It is required for almost any autonomous flight mode like mission, return to home, as well as position hold. There is enough in the internet on the topic, so to keep thing short:
- It is not 100% reliable, there are glitches, can be affected by solar activity
- Rather for outdoor use only, roofs are quite efficient at blocking GPS signal
- Vertical positioning is less accurate than horizontal
- Flight controller compares desired position with actual position and determines which way aircraft should be moved to reach target
- All GPS assisted flight modes requires additional information: heading. Flight controller has to know where north is to a able to move aircraft where it has to be moved. In some applications heading can be acquired from GPS, but that requires aircraft to be moving all the time. This method is most suitable for aircrafts. In other cases, additional sensor magnetometer has to be used
Magnetometer (compass) is a workhorse of all GPS assisted flight modes. Very often forgotten and not cared enough. Who experienced so called "toilet bowling" effect with Position Hold? Or UAV flying sideways? Or being unable to keep heading on RTH? Usually the one to blame is magnetometer. Either faulty, not calibrated correctly, or too close to power lines or metal. So what FC knows it should move easy, if it has no idea where east is?
Magnetometers, like name implies, measures magnetic field. In our case it should be Earth's magnetic field. Thanks to 3 axises, they can detect not only strength of it, but also a direction. And it is only one step from being able to compute where magnetic north is. But if any other source of magnetic field (power cables, motors) is in magnetometer's proximity, it will cause false readouts: magnetometer will be unable to distinguish various mag fields and use only the one we have interest in. This is why magnetometers should be installed as far from motors, cables, metal parts as possible.
The most popular magnetometer is HMC5883L connected to I2C bus.
Optical Flow Sensor
This is rather exotic sensor, not used very often. It is the same type of sensor used for example on optical mouses. By observing surface, it can detect displacement and speed with high accuracy. Surface it tracks has to be visible and lit to a level required by sensor. Plus, it does not reacts well to any tilt. Since multirotors shifts to move, it creates problems.