bmp390 measurement error - Page 1
Forum section: electronics / general

author: eisler
author_rank: Newbie
timestamp: August 30, 2025, 03:03:24 am
content: [ Specified attachment is not available ]Hello,I am working on a rocket altimeter project based on Attiny1616 and BMP390. I have a commercial altimeter for comparison.My biggest mistake was not including any debug output on the PCB, so currently I can only validate using altitude data.Problem: The difference between the commercial altimeter and my measurements starts around 10 m, but then continues with irregular and absurd differences like 30, 60, 15.In my code, BMP390 oversampling and IIR filter settings are:Code:bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_4X);bmp.setPressureOversampling(BMP3_OVERSAMPLING_32X);bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_15);bmp.setOutputDataRate(BMP3_ODR_50_HZ);I also filter the readings using a Kalman filter. For baseline calibration, I take N readings on the ramp and average them:Code:const int SKIP_COUNT = 30;const int N = 15;double pSum = 0;for (int i = 0; i < SKIP_COUNT; i++) {if (!bmp.performReading()) {i--;delay(40);continue;}bmp.readPressure();delay(50);bmp.readAltitude(bmp.readPressure());delay(50);bmp.readTemperature();delay(200);}for (int i = 0; i < N; i++) {if (!bmp.performReading()) {i--;delay(40);continue;}pSum += bmp.readPressure() / 100.0f;delay(400);}baselinePressure = pSum / N;baselineAlt = 0.0;tempC = bmp.readTemperature();baselineLocked = true;kalman.reset(baselineAlt, 1.0);blinker(2, 120, 128);}I believe the issue is likely caused by BMP settings and the calibration process, which may lead to inaccurate altitude readings during flight.I’ve attached my schematic and would appreciate any suggestions or ideas.

author: eutectique
author_rank: Frequent Contributor
timestamp: August 30, 2025, 07:32:08 pm
content: I would build a test chamber, place two sensors inside, and do side-by-side measurements while slowly evacuating the chamber with a suitable pump. A plastic storage box and an inflatable matress pump would be my easily-available options.

author: eisler
author_rank: Newbie
timestamp: August 30, 2025, 10:26:22 pm
content: I'm already doing this

author: ahsrabrifat
author_rank: Regular Contributor
timestamp: September 15, 2025, 02:15:07 pm
content: When working with the BMP390 in dynamic applications like a rocket altimeter, the sensor configuration plays a crucial role in ensuring accuracy and responsiveness. In your current setup, the oversampling and IIR filter settings are likely introducing too much lag, which explains why your readings diverge significantly from the commercial altimeter once you get past the first 10 meters.A good balance between noise reduction and responsiveness is to lower the pressure oversampling to 8x or 16x. Very high oversampling (like 32x) produces smoother data but slows the sensor response dramatically, which isn’t ideal for rapid altitude changes.Next, you should reduce the IIR filter coefficient to 3 or 7. Higher IIR values (like 15) are excellent for slow environmental monitoring but add significant lag in dynamic scenarios. Using a smaller coefficient gives you better tracking of altitude while still filtering out high-frequency noise.It’s also recommended to keep the output data rate (ODR) at 50 Hz or higher. If your microcontroller can handle it, running the BMP390 at 100 Hz ensures you capture the fast pressure changes that occur during launch and ascent without aliasing effects.Another critical point is thermal settling. The BMP390, like other MEMS pressure sensors, drifts with temperature. After power-up, give the sensor a 30–60 second warm-up period before locking in your baseline calibration. Without this step, you’ll introduce offset errors that grow with altitude.For more background on barometric pressure sensors, calibration, and interfacing with MCUs, you can check out this helpful guide on how to interface the BMP180 air pressure sensor with Raspberry Pi 4https://www.theengineeringprojects.com/2023/06/how-to-interface-bmp180-air-pressure-sensor-with-pi-4.htmlEven though it uses the BMP180, the concepts of oversampling, filtering, and calibration apply equally to the BMP390.