Unstable altitude measurements at rest

Hello everyone,
I have a problem related to a 3DR Pixhawk mini (Arducopter v4.0.7). When I put it in Althold mode, the drone is unable to keep its altitude correctly and is always going up or down. Also, when I try an automated take-off, it doesn’t stop climbing… I decided to put it on the ground to perform some tests and I saw that the altitude indicated on mission planner varies constantly (from -1 to 1m sometimes). I think that the barometer could have a problem… I attached to this message a google drive link to the log file generated while the drone was on the ground, with no battery, only connected via USB to Mission Planner. Please could you help me?
Screenshot of the altitude calculated by the internal barometer:

Screenshot of thhe altitude determined by the AHRS system:

Bearing in mind this is with the drone standing still on the ground with motors not being armed.

Google drive link to the log file: https://drive.google.com/file/d/1APDTqNcWuklO-g9OU3_Vp7OmaD9stRoM/view?usp=sharing

I know thiss issue also with other FCs. It is temperature related.
When the FC is gettibg warmer the pressure changes.



While the temperature change will indeed mislead the barometer, shouldn’t the EKF be able to rely on the other sensors (such as the accelerometer) in order to appropriately compensate for this issue?
The question seems to be: is such an imprecise vertical positioning while in an ideal situation (stable on the ground, with no interference/vibration from motors) be considered normal, or is this possibly indicating a particularly weak set of sensors, a hardware failure, or some kind of incorrect software configuration? Indeed, if the uncertainty is so large when nothing challenges altitude measurement (except, admittedly, the barometer being affected by the temperature), just how large is it going to grow once in flight?
I’ve only made a cursory search, but I can’t find precise indications on how accurate the positioning of this kind of device should be: should we consider a 10m safety radius around the drone? 5m? 2m? 1m? 50cm? Even less? I understand that the question can easily be deflected by saying that it depends on the setup, but in this case I think it should not, given that only the FCU and its basic sensors are active.

Just for argument sake, try it again with a battery plugged in, not just USB. Some of my boards will drift and give significant indications of movement and altitude change when just plugged in with USB but they’re totally stable when running on a battery.

Thank you for your reply, we tried with the battery plugged in but unfortunately it didn’t change anything…

Mostly this problem is due to high vibrations. Does the drone wobble in the air? If it does, reduce the PID rates, especially P

Yes I agree about the vibrations, but the test corresponding to the graph and the logs was performed when the drone was on a table. It was not moving and the motors were not spinning, so there was no vibrations…

During an earthquake? :smirk:

If you use the internal barometer, try to put paper on top of the board and perform another test. So if it’s air pressure from the props, it would show this way

Thank you for your suggestion. We performed another test with a piece of foam on the top of the board, but unfortunately the results were similar.

over time drift happens, seems like this test is over 3 minutes? Ardupilot mixes the barometer/gps and accelerometers as well for altitude holding. You can mess with that parameter here: https://ardupilot.org/copter/docs/parameters.html#ek2-alt-m-nse-altitude-measurement-noise-m

What’s your airframe? Is this all indoors (no gps)?

If this is airframe related, using an external barometer might be an option.