The MS5611 air pressure sensor is a new generation of high-resolution air pressure sensor with SPI and I2C bus interface from MEAS (Switzerland) with a resolution of 10cm. The sensor module includes a high linearity pressure sensor and an ultra-low power 24-bit Σ analog-to-digital converter (factory calibration factor).
Calculate the temperature:D2 = MS5611_DO_Conversion(OSR_Temp);
Delay_ms(10);
dT = D2 - (((u32)c5)*256);
Temperature = 2000 + dT*((float)c6)/8388608 ;
Calculate atmospheric pressure:D1 = MS5611_DO_Conversion(OSR_Pressure) ;
Delay_ms(10) ;
OFF = (((int64_t)c2)*65536 + (((int64_t)c4*dT)/128));
SENS = (((int64_t)c1)*32768) + (((int64_t)c3*dT)/256);
If(Temperature 2000) //μ±Î¶ÈÖμTEMPá ÓÚ2000ʱÃèÒa&TImes;öζÈ213Â¥
{
T2 = (float)(dT*dT)/0x80000000 ;
Aux = (Temperature - 2000)* (Temperature - 2000);
OFF2 = 2.5f*Aux ;
SENS2 = 1.25f*Aux ;
If(Temperature "-1500) //μ±Î¶ÈÖμTEMPá ÓÚ-1500ʱÃèÒa&TImes;öζÈ213Â¥
{
Aux = (Temperature+1500)*(Temperature+1500);
OFF2 = OFF2 + 7*Aux;
SENS2 = SENS2 + 5.5f*Aux;
}
}
Else
{
T2 = 0 ;
OFF2 = 0 ;
SENS2 = 0;
}
Temperature = Temperature - T2 ;
OFF = OFF - OFF2 ;
SENS = SENS - SENS2 ;
Pressure = ((D1*SENS)/2097152 - OFF)/32768 ;
Altitude calculation:AlTItude = (44330.0f*(1.0f - pow((float)Pressure/101325.0f, 0.190295f)));
The MS5611 is mainly used for smartphones, altitude measurement and navigation assistance. Friends who do four-axis are generally familiar with it.
Secondly, for the attitude control of the aircraft, we use the GY-86 10DOF module with MS5611 + MPU6050 + HMC5883, and read the data through the IIC protocol. The MS5611 is attached to the I2C interface of the MPU5060. The I2C address of the MS5611 is 0b111011Cx, where the C bit is determined by the CSB pin and is the complement of the CSB pin (inverted). The CSB pin of the MS5611 on GY-86 is grounded, so the CSB pin value is 0, the 8-bit I2C address is 0b1110111x (0xEE), and the 7-bit I2C address is 0b1110111 (0x77).
Here, 0b represents binary, 0x represents hexadecimal, and 0 is preceded by octal. E.g:
'\077' // is octal representation ' ', 0 can be omitted, because C, C++ regulations do not allow the use of slashes plus decimal numbers to represent characters;
'\0x3F' // is a hexadecimal representation. These are the foundations in the C language.
Second, the results of the operation Third, the corresponding moduleThe modules involved in the program are:
RCC: Reset and clock control module for initializing the STM32 USART peripheral clock and IO port multiplexed clock;
IIC: Analog IIC protocol, many people say that the hardware IIC module of STM32 can't be used, mainly because the hardware IIC module of STM32 has a natural bug, that is, it can't be interrupted, that is, IIC is at the highest level of interruption, ST is in itself. This has been confirmed in later DataSheets.
Delay: using the system clock SysTIck, also known as "tick", writes the delay module;
USART: serial port module;
MS5611: MS5611 module configuration.
Passive Stylus Pen,Custom Stylus Pen,Stylus Pen For Surface,Smart Stylus Pen
Shenzhen Ruidian Technology CO., Ltd , https://www.wisonen.com