01-27-2021 01:21 AM
Hi,
We are using the BMP280 in a production design.
We messured few off them and we see in all an Absolute accuracy pressure errors of about 4hPa.
The registers are set as follow
ctrl_meas 0B10110111 //Temp OS 16X, Press OS 16x, Power Normal
config 0B01010000 ////Inactive 125ms, IIR Filter coefx16, SPI OFF
The Temp I am getting is 32C.
I was using the compensation method given in the API example.
What can be the issues that cases those accuracy problems.
In the data sheet it is also mentioned that for better accuracy please contact the manufacturer, so I do.
Thanks
Sharon
01-27-2021 04:42 AM
Hi Sir:
Did you mean that you have verified all BMP280 and found the absolute accuracy pressure errors of about 4hPa?
Could you tell us how many bmp280 sensors you have checked? Where did you get the reference value of ambient pressure?
If you confirm your reference value correct, please offer your source code, first we will check them.
01-27-2021 05:20 AM
Hi,
Thanks for the replay.
Yes, I do see absolute accuracy pressure errors of about 4hPa.
I checked the issue on 5 different sensors. I used as reference two iPhones as well as a website that reports real time local presure.
I can't send the full code it is few 100K lines of code. The relevant code is below.
#define CntrlMeasDefault 0B10110111 //Temp OS 16X, Press OS 16x, Power Normal
#define ConfigDefault 0B01010000 //Inactive 125ms, IIR Filter coefx16, SPI OFF
s32 IS_BMP_Config()
{
s32 com_rslt = ERROR;
u8 CntrlMes=CntrlMeasDefault;
u8 Config= ConfigDefault;
I2C_routine(); // Initiate a pointer to the I2C routine
com_rslt = bme280_init(&bme280); // Read DeviceID and the compensation parameters.
com_rslt=bme280_write_register(BME280_CTRL_MEAS_REG,CntrlMes,(u8)1);
com_rslt+=bme280_write_register(BME280_CONFIG_REG,Config,(u8)1);
HAL_Delay(100);
Read_Config_Reg();
return com_rslt;
}
s32 Get_BMP280_Bridge_Data(s32 *v_data_uncomp_temp_s32 ,s32 *v_data_uncomp_pres_s32)
{
s32 com_rslt = BME280_INIT_VALUE;
com_rslt = bme280_read_uncomp_temperature(v_data_uncomp_temp_s32);
com_rslt += bme280_read_uncomp_pressure(v_data_uncomp_pres_s32);
return com_rslt;
}
double IS_Compensate_Pressure(s32 v_uncomp_pressure_s32)
{
double var1, var2;
int8_t rslt=BMP280_OK;
double pressure=0;
//rslt = null_ptr_check(dev);
if (rslt == BMP280_OK)
{
var1 = ((double) p_bme280->cal_param.t_fine / 2.0) - 64000.0;
var2 = var1 * var1 * ((double) p_bme280->cal_param.dig_P6) / 32768.0;
var2 = var2 + var1 * ((double) p_bme280->cal_param.dig_P5) * 2.0;
var2 = (var2 / 4.0) + (((double) p_bme280->cal_param.dig_P4) * 65536.0);
var1 = (((double)p_bme280->cal_param.dig_P3) * var1 * var1 / 524288.0 + ((double)p_bme280->cal_param.dig_P2) * var1) /
524288.0;
var1 = (1.0 + var1 / 32768.0) * ((double) p_bme280->cal_param.dig_P1);
pressure = 1048576.0 - (double)v_uncomp_pressure_s32;
if (var1 < 0 || var1 > 0)
{
pressure = (pressure - (var2 / 4096.0)) * 6250.0 / var1;
var1 = ((double)p_bme280->cal_param.dig_P9) * (pressure) * (pressure) / 2147483648.0;
var2 = (pressure) * ((double)p_bme280->cal_param.dig_P8) / 32768.0;
pressure = pressure + (var1 + var2 + ((double)p_bme280->cal_param.dig_P7)) / 16.0;
}
else
{
pressure = 0;
rslt = BMP280_E_DOUBLE_COMP_PRESS;
}
}
return pressure;
}
/*
* returns altitude in meters based on pressure and standard seaLevelpressure, both in hPa
* standard seaLevelhPa = 1013.25
*/
float Get_Altitude(float Pressure)
{
return (float)44330 * (1.0 - pow(Pressure / 1013.25, 0.19026)); // From feet converted to [M]
}
01-28-2021 03:33 AM
Hi Sir:
I checked your source code and configuration, I didn't find any abnormal points.
Could you offer your trim values of BMP280 sensor/ the raw data of termperature and pressure from sensor / the compensated pressure and temperature ? I need to do further confirmation.
Thank you.
01-28-2021 04:41 AM
Hi,
See the paramter below.
Thanks
Sharon
Name : dig_T1
Details:27680
Default:27680
Decimal:27680
Hex:0x6c20
Binary:110110000100000
Octal:066040
Name : dig_T2
Details:26163
Default:26163
Decimal:26163
Hex:0x6633
Binary:110011000110011
Octal:063063
Name : dig_T3
Details:50
Default:50
Decimal:50
Hex:0x32
Binary:110010
Octal:062
Name : dig_P1
Details:38057
Default:38057
Decimal:-27479
Hex:0x94a9
Binary:1001010010101001
Octal:0112251
Name : dig_P3
Details:3024
Default:3024
Decimal:3024
Hex:0xbd0
Binary:101111010000
Octal:05720
Name : dig_P2
Details:-10462
Default:-10462
Decimal:-10462
Hex:0xd722
Binary:1101011100100010
Octal:0153442
Name : dig_P4
Details:6385
Default:6385
Decimal:6385
Hex:0x18f1
Binary:1100011110001
Octal:014361
Name : dig_P6
Details:-7
Default:-7
Decimal:-7
Hex:0xfff9
Binary:1111111111111001
Octal:0177771
Name : dig_P5
Details:-27
Default:-27
Decimal:-27
Hex:0xffe5
Binary:1111111111100101
Octal:0177745
Name : dig_P7
Details:15500
Default:15500
Decimal:15500
Hex:0x3c8c
Binary:11110010001100
Octal:036214
Name : dig_P8
Details:-14600
Default:-14600
Decimal:-14600
Hex:0xc6f8
Binary:1100011011111000
Octal:0143370
Name : dig_P9
Details:6000
Default:6000
Decimal:6000
Hex:0x1770
Binary:1011101110000
Octal:013560
Name : t_fine
Details:0
Default:0
Decimal:0
Hex:0x0
Binary:0
Octal:0