Automatic Bilge Pump

Currently there is no support for bilge pumps on ardurover firmware, Ardusub has a leak alarm but its not in rover firmware. I have been trying to find a way of controlling the bilge pump with ardurover, in a way that will work both automatically and manually so this is my current solution.

cheap ebay rain sensor, its really the control board we need, the sensor part isnt great and corrodes away if left in the water too long but lasts much longer if you coat it all with solder., I just use a pair of stainless steel rods with it.

15A mosfet for driving the pump

12v pump that can suck water up and out the bilge, so no need to worry about the pump airlocking.

and finally, a filter to stop any debris getting sucked into the pump.

so first thing i done was Enable the button using the BTN_ENABLE set to 1 and reload parameters to get the rest of the button settings to appear.

Then i set BTN_PIN1 = 55 or AUX6 on a pixhawk, setting the pin the water sensor will connect to.

we then have to set BTN_OPTIONS1 =1 that will invert the input so a high signal from the sensor board will activate it rather than a low signal.

we then have to set the BTN_FUNC1 = 28 for Relay1

now we have a button setup controlled by the water sensor that activates relay 1.

The next step is to setup the relay, this is just setting RELAY_PIN:=53 (AUX4) , I tried AUX5 pin54 but it wouldn’t work possibly due to me also having dshot enabled.

So now with the sensor and mosfet connected and set up so if the conductivity goes above a set level the button will activate, triggering relay, running the pump, that should drain the water and the pump should turn off once its cleared.

Why run it through the relay and buttons instead of just connecting the sensor to the mosfet? simple, this way gives far more control of the system and gives me alerts that i can use to trigger other actions such as RTL if the leak doesn’t clear and I can manually trigger it from shore.

the next part of the plan is to now try and integrate this into a lua script to give alerts I tried using the Button test script but I havent got it working yet coding is not my strong suit.

first thing i done was set `BRD_PWM_COUNT to 2, freeing up 4 gpio pins, technically i only need 2 but I had an issue when trying to use AUX5 as relay and AUX6 as a button so i had to use AUX4 as the button and it worked. I also set the channels to -1 but im not sure if BRD_PWM_COUNT still needed with that. I will probably just move the sensor and mosfet to some rc pins so they dont interfere with dshot.


Got the script working and edited it a little so it shows a warning.

its working I had it in the wrong folder and I had to reverse them due to the inverted button.button_test.lua (794 Bytes)


By connecting the analogue output of the sensor to one of the pixhawks ADC pins it should be possible to measure how effective the pump is by measuring the water level.

From what testing I have done a script might be the best way of dealing with this, all it needs to be added is a failsafe to RTL after the pump has been running for more than 10 seconds.

Triggering the lost model alarm for an audible alert from the boat is probably a good idea too.

I changed the relay to servo rc8 and the sensor to AUX 1, that clears up the conflict it was having with the Dshot pins that are now on AUX 5 and 6 now that I realize that BRD_PWM_COUNT is gone in 4.2dev .

A simple way of getting it to RTL would be to simply connect the sensor to 2 buttons, one set for the relay and another one for RTL that way it will return if it cant clear the leak but the more i think about it, it could end up in a strange place where its flicking between auto and RTL and ending up stuck somewhere in the middle it would need timeouts to make sure its going where its supposed to go. like to keep it in RTL if the bilge has been on for more than 10 seconds or so.

1 Like
1 Like

A great innovation for a boat. Фs I understand it, the script is automatic, it is possible to forcibly activate it from the control panel?

1 Like

yes just click the relay 0 button on mission planner. the relay can be set as an RC aux function, just set the channel to option 28 for relay 1.

1 Like

Thank you very much. I 'll test it one of these days )

1 Like