The “baro sensor 0 missing” error is probably due to a faulty/broken internal barometer. We have 3 Pixhawk 4 Mini’s at our lab, all bought through official channels, and all 3 started giving this error eventually.
You will have to add an external barometer to your UAV, which is cheaper than buying a new pixhawk. You will then need to start the baro driver by sending a command via the MAVlink console in QGroundControl, or by editing the firmware to do this automatically.
Try to buy a barometer with a default driver already written for PX4. Go to src/drivers/barometer for a list of these barometers. Note that some are more accurate than others. We used a BMP388 and it works fine.
Also note that it needs to support I2C, since you will plug it into the UART & I2C B
port of the Pixhawk 4 mini. Check the pinouts document to see how to wire the baro.
If you do not want to edit the firmware, go to the MAVlink console in QGroundControl and type the command:
bmp388 -X start
Obviously use the name of your baro instead of bmp388
. You will need to do this before every flight if you don’t edit the firmware.
Or, to edit the firmware to do this automatically, go to the file:
ROMFS/px4fmu_common/init.d/rc.sensors
Now add a line of code to start the barometer driver near the bottom of the file, just before the sensors
app is started. e.g:
# Start external barometer on I2C bus
bmp388 -X start
###############################################################################
# End Optional drivers #
###############################################################################
sensors start
We assume the barometers fail due to a bad design of the board. Our research group decided not to buy Pixhawk 4 Mini’s anymore but rather to use other boards.
The internal magnetometers on all 3 of our boards also broke recently, which also seems to be a common Pixhawk 4 Mini problem. Solve it by disabling the internal magnetometer by setting the parameter: CAL_MAG0_EN = 0. Then you fly with only the external mag, but it should be fine. This has well worked for us thus far.
Let me know if it works. It would also be interesting to hear how many others have this problem with the Pixhawk 4 mini. Maybe they do something to fix the problem officially…?