I have been trying to get the leak detector and bar30 sensor working on my sub with a pixhawk4. I found this thread Baro30 Pressure sensor and Pixhawk4 which suggested that the Bar30 would not work with 4.0.X firmware but the issue was fixed on the dev build. After updating to the developer build, the Bar30 works, but the leak detector no longer works. Has anyone encountered this issue? Is there a fix or a config issue with the master that could change the way the leak detector connects? The leak detector will work with 4.0.X, but the Bar30 will not.
That thread discusses incorrect sensor readings which were fixed by reducing the reading frequency. I believe you intended to link to this thread which mentions that the selected I2C bus is hardcoded on ArduSub 4.0.X.
I take it that by âno longer worksâ here you mean âisnât detectedâ? The leak detector is detected on a Pixhawk GPIO pin, so is unrelated to I2C. Before assuming this is a bug, my best guess is that this is a port assignment issue. On my standard setup (Pixhawk 1) the leak detector is plugged into AUX port 6, and thatâs also whatâs set by default in ArduSub (at least for Pixhawk 1).
Itâs possible that the development build changes the default for Pixhawk 4 to be the last port or something (e.g. AUX port 8), so Iâd recommend you check which port your leak detector is plugged into and make sure that itâs set correctly in ArduSub for the port in use. You can check and change it using QGC:
Yes, I linked to the wrong thread regarding the Bar 30. Sorry. It only currently works on the dev build.
I have the leak detector on Aux6 and the brd_pwm_count set to 4. This is pin 14 on the pixhawk4. It would not detect for me when connected to any of the ADC pins so using the Aux was the only option. Works fine in 4.0.X.
When I upgrade the the firmware to the dev build (in order to get the Bar30 working) the leak detector will no longer detect - with the exact same configuration. On the dev build Iâve confirmed that Aux6 is selected (value = 55) and the brd_pwm_count is set to 4.
Does the leak detector work with the Pixhawk 1 on the dev firmware? Does 4.2 change the way leak detector works or the aux pins are read? Itâs getting power and sending the correct signal.
Iâm not familiar with the Pixhawk 4, but I just tested the leak detection in 4.2 and it works fine on a Pixhawk 1. I believe @jwalser has done some tests with it, maybe he can help.
Quick follow-up. I forked the project, made that change to master and uploaded the custom firmware build to my Pixhawk 4. Works perfectly! Thank for pointing me in the right direction.
Are you guys involved in maintaining the Ardusub master? Just wondering if I should propose the change or if thatâs something you will do.
Our software team is in charge of ArduSub, which is a part of the ArduPilot project repository. AP_LeakDetector is a library in ArduPilot, so can be used by any of the vehicle types, but at this point I believe itâs only used by ArduSub (itâs possible ArduRover may use it for boat functionality, but not sure).
If youâve got working code that adds or improves a feature without negatively impacting other components then youâre very welcome to submit a Pull Request. In this case youâre just enabling an existing sensor to integrate with another type of autopilot board, so hard to imagine there are any likely downsides from that
If youâre not keen to do that then let us know and one of us will submit one instead.