I have an Adafruit BMP280 Sensor Module (Adafruit SKU ADA2651) connected to a Microchip controller using I2C (at 100KHz). Electronically, the module works properly, but the calculated pressure value is low. For example, at sea level, the module returns a result of 0.6 atmospheres.
The Bosch BMP280 datasheet that I have is version 1.14, May 2015. This datasheet (page 23) contains a worked example of the calculations for temperature and pressure. I have written my own PIC code which reproduces the floating point calculations in Appendix 8.1 in the datasheet. Using the data from the datasheet example, my PIC code produces results that agree with the Bosch example to two decimal places. I assume that the Bosch example comes from an STP environment, ie. temperature = 25 Celsius, pressure = 101,325 Pascals.
Below are the Bosch worked example (“Datasheet” heading) and the results from my module (“PIC”) compared using the terminology in the Bosch datasheet. My test was performed at sea level and the temperature was 24.4 Celsius (measured with a thermometer accurate to 0.5 Celsius).
The calculated temperature appears to be accurate, but the calculated pressure is very wrong.
There is generally good agreement between the compensation parameters (dig_T1 through dig_P9). The exceptions are the values of dig_P4 and dig_P5. The values of adc_P also differ to some extent. Going through the maths provided in the datasheet, it seems that these are the parameters that cause the pressure result to be low. BTW the pressure reading does vary if I change the ambient pressure, but the reading is always low.
Can anyone suggest a way forward for me? Is it possible that some of the compensation parameters are wrong? Would a faulty pressure sensor be a likely cause? Any thoughts gratefully accepted.
Solved! Go to Solution.
What's BMP280 driver code you used?
There was BMP280 driver code and example code in github, could you run it and see the result again?
Thank you for your prompt response. Very much appreciated.
The driver code for my project was written by me in standard C. In brief, Microchip standard C code, Microchip XC8 Compiler (latest version), PIC16F1825 controller running at Fosc = 8MHz, BMP280 as a component of the Adafruit BMP280 module (SKU: ADA2651). The readings of the ADC values (adc_P and adc_T) and the compensation parameters (dig_T1 through dig_P9) are done by single burst reads in both cases.
I will try the github driver software as you suggest and let you know how I get on. This may take a while as the XC8 Compiler is quite strict about its syntax and I would not classify myself as the world's leading C programmer.
Thanks again. I will get back to you as soon as I can.
Thank you again for your help so far.
Firstly, the description of my development tools is wrong. I am using a Microchip PIC24FJ64GA002 controller and the XC16 compiler on MPLABX, v5.50. I wanted the performance of the PIC’s hardware multiplier. I apologise for the confusion.
Next, I have rewritten my code to use the Github API. At this stage, I have only executed the “bmp2_init” function which reads the sensor ID and calibration parameters. The sensor ID returned is correct (0x58). The calibration results returned by the API are shown in the attached PDF. These results are identical to those from my original driver code.
The I2C baud rate used to get these results is 100KHz. I have tried other baud rates with identical results.
Do these results indicate any issue with the BMP280 sensor?
Should I continue with the API and produce results for compensated temperature and pressure using the calibration data returned by the sensor?